---
agentTools:
  projectIndex: https://docs.mundipagg.com/llms.txt
---

# Obter assinatura

Este recurso possibilita, através do identificador da assinatura (`subscription_id`), recuperar as informações da assinatura.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Mundipagg API",
    "version": "1"
  },
  "servers": [
    {
      "url": "https://api.mundipagg.com/core/v1"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "http",
        "scheme": "basic"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/subscriptions/{subscription_id}": {
      "get": {
        "summary": "Obter assinatura",
        "description": "Este recurso possibilita, através do identificador da assinatura (`subscription_id`), recuperar as informações da assinatura.",
        "operationId": "obter-assinatura",
        "parameters": [
          {
            "name": "subscription_id",
            "in": "query",
            "description": "Código da assinatura. <br>Formato: `sub_XXXXXXXXXXXXXXXX.`",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"id\": \"sub_05jkdIfGYPfN26mI\",\n    \"payment_method\": \"credit_card\",\n    \"currency\": \"BRL\",\n    \"interval\": \"month\",\n    \"interval_count\": 3,\n    \"billing_type\": \"prepaid\",\n    \"gateway_affiliation_id\": \"C56A4180-65AA-42EC-A945-5FD21DEC0538\",\n    \"boleto_due_days\":5,\n    \"minimum_price\": 10000,\n    \"current_period\": {\n        \"start_at\": \"2016-07-19T00:00:00Z\",\n        \"end_at\": \"2016-10-18T23:59:59Z\"\n    },\n    \"next_billing_at\": \"2016-10-19T00:00:00Z\",\n    \"installments\": 3,\n    \"customer\": {\n        \"id\": \"cus_017228NmffGbA3d4\",\n        \"name\": \"Luke Skywalker\",\n        \"email\": \"lskywalker@r2d2.com\",\n        \"delinquent\": false,\n        \"created_at\": \"2016-07-12T18:25:40Z\",\n        \"updated_at\": \"2016-07-12T18:25:40Z\",\n    },\n    \"card\": {\n        \"id\": \"card_Mome2meGz4PDNQbX\",\n        \"holder_name\": \"Luke Skywalker\",\n        \"masked_number\": \"453246******5322\",\n        \"exp_month\": 1,\n        \"exp_year\": 17,\n        \"expired\": false,\n        \"status\": \"active\",\n        \"created_at\": \"2016-07-12T18:25:40Z\",\n        \"update_at\": \"2016-07-12T18:25:40Z\",\n        \"billing_address\": {\n            \"line_1\": \"10880, Malibu Point, Malibu Central\",\n            \"zip_code\": \"90265\",\n            \"city\": \"Malibu\",\n            \"state\": \"CA\",\n            \"country\": \"US\"\n        }\n    },\n    \"discounts\": [\n        {\n            \"id\": \"si_k2zpBDMsOs0fDfHe\",\n            \"cycles\": 3,\n            \"value\": 10,\n            \"discount_type\": \"percentage\",\n            \"created_at\": \"2016-07-12T18:25:40Z\"\n        }\n    ],\n    \"increments\": [\n        {\n            \"id\": \"inc_IYzpxgjsOs0fDIoP\",\n            \"cycles\": 2,\n            \"value\": 20,\n            \"discount_type\": \"percentage\",\n            \"created_at\": \"2016-07-12T18:25:40Z\"\n        }\n    ],\n    \"items\": [\n        {\n            \"id\": \"si_B6555Riyq9lj6klS\",\n            \"description\": \"Musculação\",\n            \"quantity\": 1,\n            \"pricing_scheme\": {\n                \"price\": 18990,\n                \"scheme_type\": \"unit\"\n            },\n            \"status\": \"active\",\n            \"created_at\": \"2016-07-12T18:25:40Z\",\n            \"updated_at\": \"2016-07-12T18:25:40Z\",\n        },\n        {\n            \"id\": \"si_lFjtC2xYGttulJpn\",\n            \"description\": \"Matrícula\",\n            \"quantity\": 1,\n            \"cycles\": 1,\n            \"pricing_scheme\": {\n                \"price\": 5990,\n                \"scheme_type\": \"unit\"\n            },\n            \"status\": \"active\",\n            \"created_at\": \"2016-07-12T18:25:40Z\",\n            \"updated_at\": \"2016-07-12T18:25:40Z\",\n        }\n    ],\n    \"status\": \"active\",\n    \"created_at\": \"2016-07-12T18:25:40Z\",\n    \"updated_at\": \"2016-07-12T18:25:40Z\",\n    \"metadata\": {\n        \"id\": \"my_subscription_id\"\n    }\n}"
                  }
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"message\": \"Subscription not found.\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Subscription not found."
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "x-readme": {
          "code-samples": [
            {
              "language": "csharp",
              "code": "using MundiAPI.PCL;\nusing System.Web.Mvc;\n\nnamespace MundipaggTest.Controllers {\n\n    public class HomeController : Controller {\n\n    public ActionResult Index() {\n\n    // Secret key fornecida pela Mundipagg\n    string basicAuthUserName = \"SUA_CHAVE_SECRETA\";\n    // Senha em branco. Passando apenas a secret key\n    string basicAuthPassword = \"\";\n\n    var client = new MundiAPIClient(basicAuthUserName, basicAuthPassword);\n\n     string subscrptionId = \"sub_05jkdIfGYPfN26mI\";\n\n    var response = client.Subscriptions.GetSubscription(subscrptionId);\n\n    return View();\n    }\n}\n}",
              "name": "SDK C#"
            },
            {
              "language": "php",
              "code": "//This example was built using MundiAPI-PHP SDK.\n//For more information, please refer to https://github.com/mundipagg/MundiAPI-PHP\n\n$secretKey = 'YOUR_SECRET_KEY'; //the secret key will be provided by MundiPagg.\n$basicAuthPassword = ''; //fill it with an empty string\n\n$apiClient = new \\MundiAPILib\\MundiAPIClient(\n    $secretKey,\n    $basicAuthPassword\n);\n\n$subscriptionsController = $apiClient->getSubscriptions();\n\n$subscriptionId = \"sub_05jkdIfGYPfN26mI\";\n\n$result = $subscriptionsController->getSubscription($subscriptionId);\n\necho json_encode($result, JSON_PRETTY_PRINT);",
              "name": "SDK PHP"
            },
            {
              "language": "java",
              "code": "package examples.subscription;\n\nimport com.mundipagg.api.MundiAPIClient;\nimport com.mundipagg.api.controllers.SubscriptionsController;\nimport com.mundipagg.api.http.client.*;\nimport com.mundipagg.api.models.GetSubscriptionResponse;\n\npublic class GetSubscriptionById {\n\t\n\tpublic static void main(String[] args) {\n\n        String basicAuthUserName = \"YOUR_SECRET_KEY\"; // The username to use with basic authentication\n        String basicAuthPassword = \"\"; // The password to use with basic authentication\n\n        MundiAPIClient client = new MundiAPIClient(basicAuthUserName, basicAuthPassword);\n\n        SubscriptionsController subscriptions_controller = new SubscriptionsController();\n\n        String subscriptionId = \"sub_vJZV7aef35tQXndo\";\n\n        subscriptions_controller.getSubscriptionAsync(subscriptionId, new APICallBack<GetSubscriptionResponse>() {\n            public void onSuccess(HttpContext context, GetSubscriptionResponse response) {\n                System.out.println(\"Subscription found !\");\n                System.out.println(\"Status response: \" + context.getResponse().getStatusCode());\n                System.out.println(\"Subscription id: \" + response.getId());\n            }\n\n            public void onFailure(HttpContext context, Throwable error) {\n\n                System.out.println(\"Status response: \" + context.getResponse().getStatusCode());\n                System.out.println(error.getMessage());\n                error.printStackTrace();\n            }\n        });\n    }\n\n}",
              "name": "SDK JAVA"
            },
            {
              "language": "python",
              "code": "from mundiapi.mundiapi_client import MundiapiClient\nfrom mundiapi.controllers import *\nfrom mundiapi.exceptions.error_exception import *\n\nMundiapiClient.config.basic_auth_user_name = \"YOUR_SECRET_KEY:\"\nsubscriptions_controller = subscriptions_controller.SubscriptionsController()\n\nsubscriptionId = \"sub_2EvZ8GdFYZhXkbe4\"\n\ntry:\n    result = subscriptions_controller.get_subscription(subscriptionId)\n    assert result is not None\n    assert result.id == subscriptionId\n    print(\"Subscription id: \", result.id)\nexcept ErrorException as ex:\n    print(ex.message)\n    print(\"Errors: \", ex.errors)\nexcept Exception as ex:\n    raise ex",
              "name": "SDK PYTHON"
            }
          ],
          "samples-languages": [
            "csharp",
            "php",
            "java",
            "python"
          ]
        }
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": false,
    "proxy-enabled": false
  },
  "x-readme-fauxas": true,
  "_id": "5aba89f6b169810058a71e9a:5aba89f6b169810058a71ec5"
}
```