> ## Documentation Index
> Fetch the complete documentation index at: https://nasten.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Consultar assinatura

> Assinatura com o histórico de pagamentos paginado. As chaves da assinatura e do cliente vêm em português.



## OpenAPI

````yaml /openapi.yaml get /v1/subscriptions/{subscriptionId}
openapi: 3.1.0
info:
  title: API Nasten
  version: '1.0'
  description: >
    API de pagamentos da Nasten: Pix, cartão, boleto, saques, clientes,

    produtos, links de pagamento, assinaturas e webhooks.


    **Autenticação.** Chame `POST /auth` com Basic
    (`base64(chave_publica:chave_secreta)`)

    para obter o Bearer token usado em todas as rotas `/v1/*`. O token vale 10
    minutos.


    **Valores.** Todo valor monetário é um inteiro em centavos.


    **Modo de teste.** O host é o mesmo. Com a chave de Desenvolvimento, as
    cobranças

    viram vendas de teste, sem dinheiro de verdade. Veja `POST
    /v1/sandbox/transactions/{transactionId}/pay`.


    **Erros.** O corpo padrão é `{ "success": false, "message": "...", "code":
    "NST-<status>-<hash>" }`.

    Erro de validação traz também `errors`. O `403` traz `error` e, quando há,
    `reason`.

    O `429` traz `error`, `retryAfterMs`, `limit`, `window` e o header
    `Retry-After`.

    Algumas rotas devolvem só `success` e `message`, como indicado em cada uma.

    Qualquer rota pode responder `503` em sobrecarga temporária (`Service
    temporarily unavailable. Please retry.`).


    **Limites.** `POST /auth`: 200 requisições por minuto por chave pública.

    Demais rotas: 1800 requisições por minuto por empresa.
  contact:
    name: Suporte Nasten
    email: tech@nasten.com.br
servers:
  - url: https://api.nasten.net
    description: Produção e modo de teste (o ambiente é definido pela chave)
security:
  - bearerAuth: []
tags:
  - name: Autenticação
  - name: Pix In
  - name: Cartão
  - name: Boleto
  - name: Modo de teste
  - name: Transações
  - name: Pix Out
  - name: Financeiro
  - name: Clientes
  - name: Produtos
  - name: Links de Pagamento
  - name: Assinaturas
  - name: Webhooks
paths:
  /v1/subscriptions/{subscriptionId}:
    get:
      tags:
        - Assinaturas
      summary: Consultar assinatura
      description: >-
        Assinatura com o histórico de pagamentos paginado. As chaves da
        assinatura e do cliente vêm em português.
      operationId: consultarAssinatura
      parameters:
        - $ref: '#/components/parameters/SubscriptionId'
        - in: query
          name: paymentStatus
          description: Filtra o histórico pelo status da venda
          schema:
            $ref: '#/components/schemas/StatusDaVenda'
        - in: query
          name: paymentPage
          description: Página do histórico
          schema:
            type: integer
            minimum: 1
            default: 1
        - in: query
          name: paymentLimit
          description: Pagamentos por página
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20
      responses:
        '200':
          description: Assinatura
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - data
                properties:
                  success:
                    type: boolean
                    const: true
                  data:
                    $ref: '#/components/schemas/AssinaturaDetalhe'
        '400':
          $ref: '#/components/responses/ValidacaoFalhou'
        '401':
          $ref: '#/components/responses/NaoAutenticado'
        '404':
          description: >-
            `Assinatura não encontrada.`: inexistente ou de outra empresa. Vem
            só com `success` e `message`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErroSimples'
              example:
                success: false
                message: Assinatura não encontrada.
        '429':
          $ref: '#/components/responses/LimiteExcedido'
        '500':
          $ref: '#/components/responses/ErroInterno'
components:
  parameters:
    SubscriptionId:
      in: path
      name: subscriptionId
      required: true
      description: Id da assinatura
      schema:
        type: string
      example: clsub1234567890abcdefghij
  schemas:
    StatusDaVenda:
      type: string
      enum:
        - pending
        - paid
        - refused
        - canceled
        - refund
        - chargeback
        - contest
        - infraction
        - preCharge
        - error
        - waiting
        - expired
    AssinaturaDetalhe:
      type: object
      properties:
        id:
          type: string
          example: clsub1234567890abcdefghij
        assinatura:
          type: object
          properties:
            dataDeInicio:
              type: string
              format: date-time
            status:
              $ref: '#/components/schemas/StatusDaAssinatura'
            statusLabel:
              type: string
            acessoRemovidoEm:
              type:
                - string
                - 'null'
              format: date-time
              description: Só em assinatura cancelled
            acessoAte:
              type:
                - string
                - 'null'
              format: date-time
              description: Assinatura cancelled com ciclo pago pela frente
            tipo:
              type:
                - string
                - 'null'
              description: Categoria do produto. null na assinatura de link.
            produto:
              type: string
            plano:
              type:
                - string
                - 'null'
              description: Título da oferta. null na assinatura de link.
            valorLiquidoInCents:
              type: integer
            parcelas:
              type:
                - integer
                - 'null'
              description: Total de cobranças quando há prazo fixo
            frequencia:
              type: string
              enum:
                - Semanal
                - Mensal
                - Bimestral
                - Trimestral
                - Semestral
                - Anual
            cobrancasAprovadas:
              type: integer
            dataDoCancelamento:
              type:
                - string
                - 'null'
              format: date-time
            proximaCobranca:
              type:
                - string
                - 'null'
              format: date-time
            linkDePagamento:
              type:
                - object
                - 'null'
              properties:
                id:
                  type: string
                nome:
                  type: string
            precoDaRenovacaoInCents:
              type: integer
            desconto:
              type:
                - object
                - 'null'
              properties:
                percentual:
                  type: integer
                cobrancasRestantes:
                  type:
                    - integer
                    - 'null'
                  description: null quer dizer para sempre
                proximaCobrancaInCents:
                  type: integer
            ofertaDeCancelamento:
              type:
                - object
                - 'null'
              properties:
                percentual:
                  type: integer
                cobrancas:
                  type: integer
                aplicadaEm:
                  type:
                    - string
                    - 'null'
                  format: date-time
        cliente:
          type: object
          properties:
            id:
              type: string
            nome:
              type: string
            email:
              type:
                - string
                - 'null'
            celular:
              type:
                - string
                - 'null'
            documento:
              type: string
              example: '01234567890'
            tipoDocumento:
              type: string
              example: CPF
        payments:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                description: Id da venda
              data:
                type: string
                format: date-time
                description: Aprovação, ou criação quando não foi aprovada
              status:
                $ref: '#/components/schemas/StatusDaVenda'
              valorLiquidoInCents:
                type: integer
              valorBrutoInCents:
                type: integer
              parcelas:
                type:
                  - integer
                  - 'null'
        paymentsPagination:
          anyOf:
            - $ref: '#/components/schemas/PaginacaoPorPagina'
            - type: 'null'
    ErroSimples:
      type: object
      description: Formato de algumas rotas, sem `code`.
      required:
        - success
        - message
      properties:
        success:
          type: boolean
          const: false
        message:
          type: string
    StatusDaAssinatura:
      type: string
      enum:
        - active
        - overdue
        - cancelled
        - failed
        - completed
    PaginacaoPorPagina:
      type: object
      properties:
        page:
          type: integer
          example: 1
        limit:
          type: integer
          example: 20
        total:
          type: integer
          example: 128
        totalPages:
          type: integer
          example: 7
    ErroDeValidacao:
      allOf:
        - $ref: '#/components/schemas/Erro'
        - type: object
          properties:
            errors:
              type: array
              description: Detalhe campo a campo, quando a falha é de validação
              items:
                type: object
                properties:
                  path:
                    type: string
                    example: customer.document
                  message:
                    type: string
                    example: Documento inválido
    Erro:
      type: object
      required:
        - success
        - message
        - code
      properties:
        success:
          type: boolean
          const: false
        message:
          type: string
          description: Descrição do problema. Algumas mensagens vêm em inglês.
          example: Descrição do erro
        code:
          type: string
          description: >-
            Código no formato NST-<status>-<hash>. Identifica a rota e o status,
            não a chamada. Cite ao acionar o suporte.
          example: NST-400-3f7a
    ErroDeLimite:
      allOf:
        - $ref: '#/components/schemas/Erro'
        - type: object
          properties:
            error:
              type: string
              const: Too Many Requests
            retryAfterMs:
              type: integer
              description: Milissegundos até poder repetir
              example: 42000
            limit:
              type: integer
              description: Limite da janela
              example: 1800
            window:
              type: string
              description: Tamanho da janela por extenso em inglês
              example: 1 minute
  responses:
    ValidacaoFalhou:
      description: Corpo, query ou path inválido. `message` é o primeiro item de `errors`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErroDeValidacao'
    NaoAutenticado:
      description: >
        Token ausente, malformado ou expirado (`Token inválido ou expirado`), ou
        token sem sessão válida (`Token expired or invalid`).

        Gere outro token em POST /auth e repita.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Erro'
          example:
            success: false
            message: Token inválido ou expirado
            code: NST-401-rcp9
    LimiteExcedido:
      description: >-
        Limite de requisições excedido (1800 por minuto por empresa nas rotas
        /v1/*, 200 por minuto por chave em /auth).
      headers:
        Retry-After:
          description: Segundos até poder repetir
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErroDeLimite'
    ErroInterno:
      description: >-
        Falha inesperada (`Internal server error`) ou resposta que não passou na
        conferência do servidor. Repita com backoff e, persistindo, envie o
        `code` ao suporte.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Erro'
          example:
            success: false
            message: Internal server error
            code: NST-500-9e2b
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Token obtido em POST /auth. Vale 10 minutos.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.