> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mx.ntxpay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Gerar JWT access token

> **Requer certificado X.509 no header `X-SSL-Client-Cert` (URL-encoded PEM)**. Autentica via certificado + clientId/clientSecret e retorna um JWT para uso nos demais endpoints.



## OpenAPI

````yaml post /api/auth/token
openapi: 3.0.0
info:
  title: NTX Pay Public API — México
  description: >-
    API Pública NTX Pay para integração com SPEI (cash-in/cash-out) no México.
    Todos os valores monetários são expressos em centavos MXN.
  version: 1.0.0
  contact: {}
servers:
  - url: https://sandbox.mx.ntxpay.com
    description: Sandbox
security: []
tags:
  - name: auth
    description: Geração de token via certificado X.509 + clientId/clientSecret
  - name: SPEI
    description: >-
      Transferências interbancárias instantâneas mexicanas (cash-in via CLABE
      descartável; cash-out para CLABE)
  - name: Balance
    description: Consulta de saldo da conta (centavos MXN)
  - name: Webhooks Config
    description: Configuração de webhooks para notificações de eventos
paths:
  /api/auth/token:
    post:
      tags:
        - auth
      summary: Gerar JWT access token
      description: >-
        **Requer certificado X.509 no header `X-SSL-Client-Cert` (URL-encoded
        PEM)**. Autentica via certificado + clientId/clientSecret e retorna um
        JWT para uso nos demais endpoints.
      operationId: AuthController_token
      parameters:
        - name: X-SSL-Client-Cert
          in: header
          required: true
          schema:
            type: string
          description: Certificado X.509 em PEM URL-encoded
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateTokenInputDto'
      responses:
        '201':
          description: Token gerado
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateTokenOutputDto'
        '400':
          description: Requisição inválida ou certificado ausente
        '401':
          description: Credenciais ou certificado inválidos
      security:
        - clientCert: []
components:
  schemas:
    GenerateTokenInputDto:
      type: object
      required:
        - clientId
        - clientSecret
      properties:
        clientId:
          type: string
          description: OAuth 2.0 client ID da sua conta NTX Pay (fornecido no onboarding)
          example: qr-93-550e8400
        clientSecret:
          type: string
          minLength: 8
          maxLength: 64
          description: OAuth 2.0 client secret (8-64 caracteres)
          example: a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
    GenerateTokenOutputDto:
      type: object
      properties:
        access_token:
          type: string
          description: JWT de acesso
          example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
        token_type:
          type: string
          example: Bearer
        expires_in:
          type: integer
          description: Tempo de expiração em segundos
          example: 600
        scope:
          type: string
          example: email profile
  securitySchemes:
    clientCert:
      type: apiKey
      in: header
      name: X-SSL-Client-Cert
      description: Certificado X.509 do cliente em PEM URL-encoded

````