# subscriptions.get

Detalhe da assinatura. Assinatura (`id` = `plataforma:código`): situação, plano, valor, periodicidade, compras (a venda original e as faturas), LTV e os dados do assinante. `not_found` se não existir.

- Endpoint: `POST https://app.atomiks.com.br/api/v1/subscriptions.get` (corpo JSON)
- Quem pode chamar: membro da conta
- Escopo da chave: `crm:read`
- Grava dados: não
- Pela chave de API: sim
- Ferramenta MCP: `subscriptions_get`
- Ficha em JSON: `https://app.atomiks.com.br/api/v1/openapi.json` (operationId `subscriptions.get`)

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `id` | string | sim |  |

<details><summary>JSON Schema</summary>

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 300
    }
  },
  "required": [
    "id"
  ]
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/subscriptions.get \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"id":"hotmart:00000000"}'
```

CLI:

```bash
node cli/atomiks.mjs subscriptions.get --json '{"id":"hotmart:00000000"}'
```

MCP: ferramenta `subscriptions_get` com a mesma entrada.

## Saída

Sucesso: `{"data": ...}` com o formato abaixo.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "subscription": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "shortenCode": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "active_trial",
            "active_paid",
            "active_trial_expired",
            "canceled",
            "ended"
          ]
        },
        "plan": {
          "type": "string"
        },
        "activationDate": {
          "type": "string"
        },
        "price": {
          "type": "number"
        },
        "dueDay": {
          "type": [
            "string",
            "null"
          ]
        },
        "frequency": {
          "type": "string",
          "enum": [
            "daily",
            "weekly",
            "biweekly",
            "monthly",
            "bimonthly",
            "quarterly",
            "semiannual",
            "yearly"
          ]
        },
        "lastPurchase": {
          "type": [
            "string",
            "null"
          ]
        },
        "purchasesCount": {
          "type": "number"
        },
        "nextPurchase": {
          "type": [
            "string",
            "null"
          ]
        },
        "ltv": {
          "type": "number"
        },
        "cancelledAt": {
          "type": [
            "string",
            "null"
          ]
        },
        "chargeLimit": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "remainingCharges": {
                  "type": "number"
                },
                "maxCharges": {
                  "type": "number"
                },
                "expectedEndAt": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "remainingCharges",
                "maxCharges",
                "expectedEndAt"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "endedAt": {
          "type": [
            "string",
            "null"
          ]
        },
        "isPixRecurring": {
          "type": "boolean"
        }
      },
      "required": [
        "id",
        "shortenCode",
        "status",
        "plan",
        "activationDate",
        "price",
        "dueDay",
        "frequency",
        "lastPurchase",
        "purchasesCount",
        "nextPurchase",
        "ltv",
        "cancelledAt",
        "chargeLimit",
        "endedAt",
        "isPixRecurring"
      ],
      "additionalProperties": false
    },
    "buyer": {
      "type": "object",
      "properties": {
        "leadId": {
          "type": [
            "string",
            "null"
          ]
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "email": {
          "type": [
            "string",
            "null"
          ]
        },
        "telephone": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "countryCode": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "areaCode": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "number": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "countryCode",
                "areaCode",
                "number"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "document": {
          "type": [
            "string",
            "null"
          ]
        },
        "birthDate": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "leadId",
        "name",
        "email",
        "telephone",
        "document",
        "birthDate"
      ],
      "additionalProperties": false
    },
    "purchases": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "shortenCode": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "sale",
              "invoice"
            ]
          },
          "invoiceNumber": {
            "type": [
              "number",
              "null"
            ]
          },
          "offer": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "value": {
            "type": "number"
          },
          "commission": {
            "type": "number"
          },
          "method": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "credit",
                  "pix",
                  "boleto"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "paid",
              "canceled",
              "refunded",
              "chargedBack",
              "failed"
            ]
          }
        },
        "required": [
          "code",
          "shortenCode",
          "kind",
          "invoiceNumber",
          "offer",
          "createdAt",
          "value",
          "commission",
          "method",
          "status"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "subscription",
    "buyer",
    "purchases"
  ],
  "additionalProperties": false
}
```

## Erros

`{"error": {"code", "message", "requestId"}}`. Códigos: `invalid_input` (400), `unauthorized` (401), `forbidden` / `account_pending` / `scope_missing` (403), `not_found` (404), `limit_reached` (409), `internal` (500).
