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

# Сгенерировать токен доступа

> Обменивает `client_id` и `client_secret` ваших учётных данных на короткоживущий токен доступа. Отправляйте полученный токен в заголовке `Authorization: Bearer <access_token>` в остальных запросах.

Токен истекает через **300 секунд (5 минут)** — сгенерируйте новый после истечения; refresh token не предусмотрен.



## OpenAPI

````yaml openapi.ru.json POST /auth
openapi: 3.0.0
info:
  title: pague.dev API
  description: Документация платёжного API pague.dev
  version: '1.0'
  contact: {}
servers:
  - url: https://api-gateway.pague.dev/v2
security: []
paths:
  /auth:
    post:
      tags:
        - Autenticação
      summary: Сгенерировать токен доступа
      description: >-
        Обменивает `client_id` и `client_secret` ваших учётных данных на
        короткоживущий токен доступа. Отправляйте полученный токен в заголовке
        `Authorization: Bearer <access_token>` в остальных запросах.


        Токен истекает через **300 секунд (5 минут)** — сгенерируйте новый после
        истечения; refresh token не предусмотрен.
      operationId: ExternalAuthController_authenticate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                client_id:
                  type: string
                  description: >-
                    Идентификатор учётных данных (mp_live_* — продакшен,
                    mp_test_* — песочница)
                  example: mp_live_0123456789abcdef01234567
                client_secret:
                  type: string
                  description: >-
                    Secret учётных данных (показывается только один раз при
                    создании)
              required:
                - client_id
                - client_secret
      responses:
        '200':
          description: Токен успешно сгенерирован
          content:
            application/json:
              schema:
                type: object
                properties:
                  access_token:
                    type: string
                    description: JWT-токен для использования в заголовке Authorization
                    example: eyJhbGciOiJSUzI1NiIs...
                  token_type:
                    type: string
                    example: Bearer
                  expires_in:
                    type: integer
                    description: Срок действия токена в секундах
                    example: 300
                required:
                  - access_token
                  - token_type
                  - expires_in
        '400':
          description: Отсутствует client_id или client_secret
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                example:
                  error: Bad Request
                  message: client_id and client_secret are required
        '401':
          description: Недействительные или отозванные учётные данные либо неверный secret
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                example:
                  error: Unauthorized
                  message: Invalid credentials
      security: []

````