openapi: 3.1.0
info:
  title: 'Публичный API iEXExchanger'
  version: 4.0.0
  description: |-
    API для работы с данными клиента, направлениями обмена, заявками, вебхуками и партнёрскими выплатами.

    Начните с GET /ping для проверки доступности и GET /private/scopes для
    просмотра каталога прав API. Для приватных операций нужны токен Sanctum в
    Authorization: Bearer <token> и подпись HMAC v2. Передавайте
    X-Api-Signature-Version со значением v2 вместе с X-Api-Timestamp,
    X-Api-Nonce и X-Api-Signature. Для создания партнёрской выплаты также нужен
    Idempotency-Key. Если операция перечисляет права в x-required-scopes,
    достаточно одного из этих прав.

    Непустое тело HMAC-запроса передавайте как application/json или application/*+json. Multipart поддерживается операциями загрузки файлов верификации, файлов полей заявки и чеков. Передавайте ровно одно поле-файл file. Лимит JSON по умолчанию составляет 1 MiB. При превышении лимита установки API возвращает HTTP 413. URL-encoded тела подписанного запроса и неоднозначные типы содержимого возвращают invalid_signature.

    Все ответы JSON имеют общую оболочку: state=0 означает успех, state=1 — ошибку. Поле error.code содержит стабильный код ошибки для программы. Списки поддерживают постраничную навигацию, а некоторые — курсор для больших выборок. При повторе изменяющего запроса с тем же телом используйте прежний Idempotency-Key.
    Повтор операции управления вебхуком с сохранённым результатом снятого
    протокола возвращает HTTP 409 с protocol_retired в error.details.reason.
    Запрос с неподдерживаемой версией тела вебхука возвращает HTTP 422.

    Английский контракт находится в openapi.yaml, русская версия в openapi.ru.yaml.
    Пути, имена полей, значения enum и коды ошибок одинаковы в обоих файлах.
    Тела примеров используют одни и те же данные песочницы. Сервер переводит текст сообщений по локали запроса.
    Код 401 указывает на отсутствие или недействительность проверки токена или подписи. Код 403 указывает на запрет доступа. Код 429 сообщает о частотном лимите или квоте. Код 503 сообщает о недоступности API или сайта.
servers:
  -
    url: /api/v3
security:
  -
    sanctumBearer: []
    apiTimestamp: []
    apiNonce: []
    apiSignature: []
tags:
  -
    name: Система
    description: 'Проверка доступности.'
  -
    name: Клиент
    description: 'Профиль и заявки авторизованного клиента.'
  -
    name: Заявки
    description: 'Списки заявок, статусы, доступные действия и подтверждение оплаты.'
  -
    name: Обмен
    description: 'Платёжные системы, направления, расчёты и заявки на обмен.'
  -
    name: Файлы
    description: 'Одноразовые разрешения на загрузку файлов для проверки.'
  -
    name: Проверки
    description: 'Требования и отправка данных для проверки личности и карты.'
  -
    name: Песочница
    description: 'Проверка сценария создания заявки без её сохранения.'
  -
    name: Отзывы
    description: 'Просмотр опубликованных отзывов и отправка отзыва по своей заявке.'
  -
    name: Партнёр
    description: 'Партнёрская статистика, привлечённые клиенты, обмены и выплаты.'
  -
    name: Платформа
    description: 'Версии контрактов, JSON-схемы и использование API.'
  -
    name: Вебхуки
    description: 'Регистрация адресов вебхуков, просмотр событий и попыток доставки.'
  -
    name: Безопасность
    description: 'Права ключей и требования безопасности запросов.'
paths:
  /ping:
    get:
      operationId: getPing
      tags:
        - Система
      security: []
      summary: 'Проверить доступность API без авторизации'
      responses:
        "200":
          $ref: "#/components/responses/PrivatePing"
        default:
          $ref: "#/components/responses/Error"
  /public/contracts:
    get:
      operationId: getPublicContracts
      tags:
        - Платформа
      security: []
      summary: 'Список версий публичных контрактов'
      responses:
        "200":
          description: 'Актуальные версии контрактов.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          contracts:
                            type: array
                            items:
                              $ref: '#/components/schemas/ContractVersion'
        default:
          $ref: "#/components/responses/Error"
  '/public/contracts/{contract}':
    get:
      operationId: getPublicContractsByContract
      tags:
        - Платформа
      security: []
      summary: 'Получить версию публичного контракта'
      parameters:
        -
          name: contract
          in: path
          required: true
          schema:
            type: string
            example: operation-contract
      responses:
        "200":
          description: 'Версия контракта.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          contract:
                            $ref: '#/components/schemas/ContractVersion'
        "404":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  /public/schemas:
    get:
      operationId: getPublicSchemas
      tags:
        - Платформа
      security: []
      summary: 'Список публичных JSON-схем'
      responses:
        "200":
          description: 'Каталог JSON-схем.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          schemas:
                            type: array
                            items:
                              $ref: '#/components/schemas/SchemaRegistryItem'
        default:
          $ref: "#/components/responses/Error"
  '/public/schemas/{schema}':
    get:
      operationId: getPublicSchemasBySchema
      tags:
        - Платформа
      security: []
      summary: 'Получить JSON-схему'
      parameters:
        -
          name: schema
          in: path
          required: true
          schema:
            type: string
            example: success-envelope.v1
      responses:
        "200":
          description: 'Содержимое JSON-схемы.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          schema:
                            type: object
                            additionalProperties: true
        "404":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  /private/ping:
    get:
      operationId: getPrivatePing
      tags:
        - Система
      summary: 'Проверить доступность API с ключом'
      description: >-
        Проверяет Bearer-токен и подпись перед вызовом операций обмена.
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
      responses:
        "200":
          $ref: "#/components/responses/PrivatePing"
        "401":
          $ref: '#/components/responses/Unauthorized'
        "429":
          $ref: "#/components/responses/RateLimited"
        default:
          $ref: "#/components/responses/Error"
  /private/health/client:
    get:
      operationId: getPrivateHealthClient
      tags:
        - Платформа
      summary: 'Проверить состояние API текущего клиента'
      x-required-scopes:
        - 'public-api:client:health:read'
        - 'public-api:client:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Диагностика API клиента.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          health:
                            $ref: '#/components/schemas/ClientApiHealth'
        "403":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  /private/contracts:
    get:
      operationId: getPrivateContracts
      tags:
        - Платформа
      summary: 'Список версий контрактов с авторизацией'
      x-required-scopes:
        - 'public-api:contracts:read'
        - 'public-api:scopes:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: "#/paths/~1public~1contracts/get/responses/200"
        "403":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  '/private/contracts/{contract}':
    get:
      operationId: getPrivateContractsByContract
      tags:
        - Платформа
      summary: 'Получить версию контракта с авторизацией'
      x-required-scopes:
        - 'public-api:contracts:read'
        - 'public-api:scopes:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        -
          name: contract
          in: path
          required: true
          schema:
            type: string
        - $ref: "#/components/parameters/SignatureVersion"
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: "#/paths/~1public~1contracts~1%7Bcontract%7D/get/responses/200"
        "404":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  /private/schemas:
    get:
      operationId: getPrivateSchemas
      tags:
        - Платформа
      summary: 'Список JSON-схем с авторизацией'
      x-required-scopes:
        - 'public-api:schemas:read'
        - 'public-api:contracts:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: "#/paths/~1public~1schemas/get/responses/200"
        "403":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  '/private/schemas/{schema}':
    get:
      operationId: getPrivateSchemasBySchema
      tags:
        - Платформа
      summary: 'Получить JSON-схему с авторизацией'
      x-required-scopes:
        - 'public-api:schemas:read'
        - 'public-api:contracts:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        -
          name: schema
          in: path
          required: true
          schema:
            type: string
        - $ref: "#/components/parameters/SignatureVersion"
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: "#/paths/~1public~1schemas~1%7Bschema%7D/get/responses/200"
        "404":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  /public/orders/statuses:
    get:
      operationId: getPublicOrdersStatuses
      tags:
        - Заявки
      security: []
      summary: 'Публичный справочник статусов заявок'
      responses:
        "200":
          $ref: "#/components/responses/OrderStatuses"
        default:
          $ref: "#/components/responses/Error"
  /private/scopes:
    get:
      operationId: getPrivateScopes
      tags:
        - Безопасность
      summary: 'Получить список прав публичного API'
      x-required-scopes:
        - 'public-api:scopes:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Каталог прав ключа.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          scopes:
                            type: array
                            items:
                              $ref: '#/components/schemas/ApiScope'
        "403":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  /private/usage:
    get:
      operationId: getPrivateUsage
      tags:
        - Платформа
      summary: 'Использование API, квоты и биллинг'
      x-required-scopes:
        - 'public-api:usage:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Сводка использования текущего ключа.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        $ref: '#/components/schemas/UsageSummary'
        "403":
          $ref: '#/components/responses/Error'
        "429":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  /private/webhooks:
    get:
      operationId: getPrivateWebhooks
      tags:
        - Вебхуки
      summary: 'Получить адреса вебхуков'
      x-required-scopes:
        - 'public-api:webhooks:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Список адресов вебхуков и каталог событий.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          endpoints:
                            type: array
                            items:
                              $ref: '#/components/schemas/WebhookEndpoint'
                          events:
                            type: array
                            items:
                              $ref: '#/components/schemas/WebhookEventCatalogItem'
                          limits:
                            type: object
        "403":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
    post:
      operationId: postPrivateWebhooks
      tags:
        - Вебхуки
      summary: 'Добавить адрес вебхука'
      description: >-
        Подписки используют компактное тело v2. Если вы передаёте
        payload_version, укажите v2. Получатель проверяет доставку по HMAC v2.

        При передаче Idempotency-Key подписка и зашифрованный ответ 201 сохраняются
        одной транзакцией. Повтор запроса с тем же ключом и телом в пределах TTL
        возвращает исходную подписку и секрет. Если ответ потерян и ключ отсутствует
        или истёк TTL, сначала проверьте список подписок.
      x-required-scopes:
        - 'public-api:webhooks:write'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          $ref: '#/components/parameters/IdempotencyKey'
        -
          $ref: '#/components/parameters/CorrelationId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookEndpointCreate'
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "201":
          description: 'Адрес вебхука и секрет, который показывается один раз.'
          headers:
            Idempotency-Replayed:
              schema: { type: string, const: "true" }
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          endpoint:
                            allOf:
                              -
                                $ref: '#/components/schemas/WebhookEndpoint'
                              -
                                type: object
                                properties:
                                  secret:
                                    type: string
                                    description: 'Секрет подписи вебхука; показывается один раз.'
        "409":
          $ref: '#/components/responses/Error'
        "422":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  /private/webhooks/test:
    post:
      operationId: postPrivateWebhooksTest
      tags:
        - Вебхуки
      summary: 'Создать тестовое событие вебхука'
      description: >-
        Ставит тестовое событие в очередь для подходящих подписок. В запросе можно выбрать тип образца.
        Тип доставляемого события всегда api.test. Ответ 201 содержит событие и запланированные доставки.
        Если подходящих подписок нет, список deliveries пуст.
      x-required-scopes:
        - 'public-api:webhooks:write'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          $ref: '#/components/parameters/IdempotencyKey'
        -
          $ref: '#/components/parameters/CorrelationId'
      requestBody:
        required: false
        content:
          application/json:
            examples:
              testEvent:
                $ref: "#/components/examples/QuickstartWebhookTestInput"
            schema:
              $ref: '#/components/schemas/WebhookTestRequest'
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "201":
          description: 'Идентификаторы созданного события и доставок.'
          content:
            application/json:
              examples:
                queued:
                  $ref: "#/components/examples/QuickstartWebhookTest"
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        $ref: '#/components/schemas/WebhookTestResult'
        "409":
          $ref: '#/components/responses/Error'
        "422":
          $ref: "#/components/responses/InvalidWebhookTestInput"
        "429":
          $ref: "#/components/responses/RateLimited"
        default:
          $ref: "#/components/responses/Error"
  /private/webhooks/events:
    get:
      operationId: getPrivateWebhooksEvents
      tags:
        - Вебхуки
      summary: 'Получить события вебхуков'
      x-required-scopes:
        - 'public-api:webhooks:deliveries:read'
        - 'public-api:webhooks:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          $ref: '#/components/parameters/Page'
        -
          $ref: '#/components/parameters/PerPage'
        -
          $ref: '#/components/parameters/PaginationMode'
        -
          $ref: '#/components/parameters/Cursor'
        -
          name: 'filter[status]'
          in: query
          schema:
            type: string
        -
          name: 'filter[event_type]'
          in: query
          schema:
            type: string
        -
          name: 'filter[resource_type]'
          in: query
          schema:
            type: string
        -
          name: 'filter[resource_id]'
          in: query
          schema:
            type: string
        -
          name: 'filter[correlation_id]'
          in: query
          schema:
            type: string
        -
          name: 'filter[created_from]'
          in: query
          schema:
            type: string
            format: date-time
        -
          name: 'filter[created_to]'
          in: query
          schema:
            type: string
            format: date-time
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Список событий вебхуков.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          events:
                            type: array
                            items:
                              $ref: '#/components/schemas/WebhookEvent'
        "403":
          $ref: '#/components/responses/Error'
        "422":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  '/private/webhooks/events/{event}':
    get:
      operationId: getPrivateWebhooksEventsByEvent
      tags:
        - Вебхуки
      summary: 'Получить событие вебхука'
      x-required-scopes:
        - 'public-api:webhooks:deliveries:read'
        - 'public-api:webhooks:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: event
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Событие вебхука и его доставки.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          event:
                            $ref: '#/components/schemas/WebhookEvent'
        "404":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  /private/webhooks/deliveries:
    get:
      operationId: getPrivateWebhooksDeliveries
      tags:
        - Вебхуки
      summary: 'Получить попытки доставки вебхуков'
      x-required-scopes:
        - 'public-api:webhooks:deliveries:read'
        - 'public-api:webhooks:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          $ref: '#/components/parameters/Page'
        -
          $ref: '#/components/parameters/PerPage'
        -
          $ref: '#/components/parameters/PaginationMode'
        -
          $ref: '#/components/parameters/Cursor'
        -
          name: 'filter[status]'
          in: query
          schema:
            type: string
        -
          name: 'filter[endpoint_id]'
          in: query
          schema:
            type: string
            format: uuid
        -
          name: 'filter[event_id]'
          in: query
          schema:
            type: string
            format: uuid
        -
          name: 'filter[event_type]'
          in: query
          schema:
            type: string
        -
          name: 'filter[correlation_id]'
          in: query
          schema:
            type: string
        -
          name: 'filter[created_from]'
          in: query
          schema:
            type: string
            format: date-time
        -
          name: 'filter[created_to]'
          in: query
          schema:
            type: string
            format: date-time
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Список доставок вебхуков.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          deliveries:
                            type: array
                            items:
                              $ref: '#/components/schemas/WebhookDelivery'
        "403":
          $ref: '#/components/responses/Error'
        "422":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  '/private/webhooks/deliveries/{delivery}':
    get:
      operationId: getPrivateWebhooksDeliveriesByDelivery
      tags:
        - Вебхуки
      summary: 'Получить попытку доставки вебхука'
      x-required-scopes:
        - 'public-api:webhooks:deliveries:read'
        - 'public-api:webhooks:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: delivery
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Доставка вебхука.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          delivery:
                            $ref: '#/components/schemas/WebhookDelivery'
        "404":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  '/private/webhooks/deliveries/{delivery}/retry':
    post:
      operationId: postPrivateWebhooksDeliveriesByDeliveryRetry
      tags:
        - Вебхуки
      summary: 'Повторить доставку вебхука'
      description: Архивная доставка возвращает HTTP 409 с error.code http_error и error.details.reason protocol_retired.
      x-required-scopes:
        - 'public-api:webhooks:deliveries:retry'
        - 'public-api:webhooks:write'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: delivery
          in: path
          required: true
          schema:
            type: string
            format: uuid
        -
          $ref: '#/components/parameters/IdempotencyKey'
        -
          $ref: '#/components/parameters/CorrelationId'
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Доставка поставлена в очередь на повтор.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          delivery:
                            $ref: '#/components/schemas/WebhookDelivery'
        "404":
          $ref: '#/components/responses/Error'
        "409":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  '/private/webhooks/{webhook}':
    get:
      operationId: getPrivateWebhooksByWebhook
      tags:
        - Вебхуки
      summary: 'Получить адрес вебхука'
      x-required-scopes:
        - 'public-api:webhooks:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          $ref: '#/components/parameters/WebhookId'
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: '#/components/responses/WebhookEndpointResult'
        "404":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
    patch:
      operationId: patchPrivateWebhooksByWebhook
      tags:
        - Вебхуки
      summary: 'Изменить адрес вебхука'
      x-required-scopes:
        - 'public-api:webhooks:write'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          $ref: '#/components/parameters/WebhookId'
        -
          $ref: '#/components/parameters/IdempotencyKey'
        -
          $ref: '#/components/parameters/CorrelationId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookEndpointUpdate'
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: '#/components/responses/WebhookEndpointResult'
        "404":
          $ref: '#/components/responses/Error'
        "409":
          $ref: '#/components/responses/Error'
        "422":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
    delete:
      operationId: deletePrivateWebhooksByWebhook
      tags:
        - Вебхуки
      summary: 'Удалить адрес вебхука'
      x-required-scopes:
        - 'public-api:webhooks:write'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          $ref: '#/components/parameters/WebhookId'
        -
          $ref: '#/components/parameters/IdempotencyKey'
        -
          $ref: '#/components/parameters/CorrelationId'
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: '#/components/responses/WebhookDeleteResult'
        "404":
          $ref: '#/components/responses/Error'
        "409":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  '/private/webhooks/{webhook}/rotate-secret':
    post:
      operationId: postPrivateWebhooksByWebhookRotateSecret
      tags:
        - Вебхуки
      summary: 'Сменить секрет подписи вебхука'
      x-required-scopes:
        - 'public-api:webhooks:write'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          $ref: '#/components/parameters/WebhookId'
        -
          $ref: '#/components/parameters/IdempotencyKey'
        -
          $ref: '#/components/parameters/CorrelationId'
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Адрес вебхука и новый секрет, который показывается один раз.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          endpoint:
                            allOf:
                              -
                                $ref: '#/components/schemas/WebhookEndpoint'
                              -
                                type: object
                                properties:
                                  secret:
                                    type: string
        "404":
          $ref: '#/components/responses/Error'
        "409":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  /private/client:
    get:
      operationId: getPrivateClient
      tags:
        - Клиент
      summary: 'Профиль текущего клиента'
      x-required-scopes:
        - 'public-api:client:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Профиль клиента.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        $ref: '#/components/schemas/Client'
        default:
          $ref: "#/components/responses/Error"
  /private/exchange/payment-systems:
    get:
      operationId: getPrivateExchangePaymentSystems
      tags:
        - Обмен
      summary: 'Получить активные платёжные системы'
      x-required-scopes:
        - 'public-api:exchange:routes:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          $ref: '#/components/parameters/Page'
        -
          $ref: '#/components/parameters/PerPage'
        -
          $ref: '#/components/parameters/PaginationMode'
        -
          $ref: '#/components/parameters/Cursor'
        -
          name: sort
          in: query
          schema:
            type: string
            example: 'sorting,id'
        -
          name: 'filter[id]'
          in: query
          schema:
            type: integer
        -
          name: 'filter[payment_id]'
          in: query
          schema:
            type: integer
        -
          name: 'filter[code_currency_id]'
          in: query
          schema:
            type: integer
        -
          name: 'filter[side]'
          in: query
          schema:
            type: string
            enum:
              - give
              - receive
              - both
        -
          name: 'filter[from_currency_id]'
          in: query
          schema:
            type: integer
        -
          name: 'filter[to_currency_id]'
          in: query
          schema:
            type: integer
        -
          name: 'filter[currency_code]'
          in: query
          schema:
            type: string
            example: USDT
        -
          name: 'filter[letter_code]'
          in: query
          schema:
            type: string
            example: USDTTRC20
        -
          name: 'filter[short_code]'
          in: query
          schema:
            type: string
            example: USDT
        -
          name: 'filter[network]'
          in: query
          schema:
            type: string
            example: TRON
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Активные платёжные системы.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: array
                        items:
                          $ref: '#/components/schemas/PaymentSystem'
        "403":
          $ref: '#/components/responses/Error'
        "422":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  /private/exchange/routes:
    get:
      operationId: getPrivateExchangeRoutes
      tags:
        - Обмен
      summary: 'Получить активные направления обмена'
      x-required-scopes:
        - 'public-api:exchange:routes:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          $ref: '#/components/parameters/Page'
        -
          $ref: '#/components/parameters/PerPage'
        -
          $ref: '#/components/parameters/PaginationMode'
        -
          $ref: '#/components/parameters/Cursor'
        -
          name: sort
          in: query
          schema:
            type: string
            example: 'sorting,id'
        -
          name: 'filter[id]'
          in: query
          schema:
            type: integer
        -
          name: 'filter[from_currency_id]'
          in: query
          schema:
            type: integer
        -
          name: 'filter[to_currency_id]'
          in: query
          schema:
            type: integer
        -
          name: 'filter[from]'
          in: query
          schema:
            type: string
            example: USDT
        -
          name: 'filter[to]'
          in: query
          schema:
            type: string
            example: USD
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Активные направления обмена.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: array
                        items:
                          $ref: '#/components/schemas/ExchangeRoute'
        "403":
          $ref: '#/components/responses/Error'
        "422":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  '/private/exchange/routes/{route}':
    get:
      operationId: getPrivateExchangeRoutesByRoute
      tags:
        - Обмен
      summary: 'Получить активное направление обмена'
      x-required-scopes:
        - 'public-api:exchange:routes:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: route
          in: path
          required: true
          schema:
            type: integer
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Направление обмена.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        $ref: '#/components/schemas/ExchangeRoute'
        "404":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  /private/exchange/routes/details:
    get:
      operationId: getPrivateExchangeRoutesDetails
      tags:
        - Обмен
      summary: 'Получить параметры направления по паре валют'
      x-required-scopes:
        - 'public-api:exchange:routes:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: '#/components/parameters/SignatureVersion'
        - name: route_id
          in: query
          schema:
            type: integer
            minimum: 1
        - name: direction_id
          in: query
          schema:
            type: integer
            minimum: 1
        - name: from_currency_id
          in: query
          schema:
            type: integer
            minimum: 1
        - name: to_currency_id
          in: query
          schema:
            type: integer
            minimum: 1
        - name: from
          in: query
          schema:
            type: string
            example: USDT
            maxLength: 64
        - name: to
          in: query
          schema:
            type: string
            example: USD
            maxLength: 64
        - name: income_payment_system
          in: query
          schema:
            type: integer
            minimum: 1
          description: Алиас from_currency_id.
        - name: outcome_payment_system
          in: query
          schema:
            type: integer
            minimum: 1
          description: Алиас to_currency_id.
        - name: from_code
          in: query
          schema:
            type: string
            maxLength: 64
          description: Идентификатор валюты отдачи. Алиас from.
        - name: to_code
          in: query
          schema:
            type: string
            maxLength: 64
          description: Идентификатор валюты получения. Алиас to.
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Параметры направления в формате, совместимом с клиентской формой обмена.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        $ref: '#/components/schemas/ExchangeRouteDetail'
        "404":
          $ref: '#/components/responses/Error'
        "422":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  '/private/exchange/routes/{route}/details':
    get:
      operationId: getPrivateExchangeRoutesByRouteDetails
      tags:
        - Обмен
      summary: 'Получить параметры направления по ID'
      x-required-scopes:
        - 'public-api:exchange:routes:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: route
          in: path
          required: true
          schema:
            type: integer
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Параметры направления в формате, совместимом с клиентской формой обмена.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        $ref: '#/components/schemas/ExchangeRouteDetail'
        "404":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  '/private/exchange/routes/{route}/capabilities':
    get:
      operationId: getPrivateExchangeRoutesByRouteCapabilities
      tags:
        - Обмен
      summary: 'Получить возможности направления по ID'
      x-required-scopes:
        - 'public-api:exchange:capabilities:read'
        - 'public-api:exchange:routes:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: route
          in: path
          required: true
          schema:
            type: integer
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Матрица возможностей направления.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          capabilities:
                            $ref: '#/components/schemas/RouteCapabilities'
        "404":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  '/private/exchange/routes/{from}/{to}/details':
    get:
      operationId: getPrivateExchangeRoutesByFromByToDetails
      tags:
        - Обмен
      summary: 'Получить параметры направления по ID выбранных валют'
      x-required-scopes:
        - 'public-api:exchange:routes:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: from
          in: path
          required: true
          description: 'ID валюты или платёжной системы на стороне «Отдаю».'
          schema:
            type: integer
        -
          name: to
          in: path
          required: true
          description: 'ID валюты или платёжной системы на стороне «Получаю».'
          schema:
            type: integer
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Параметры направления в формате, совместимом с клиентской формой обмена.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        $ref: '#/components/schemas/ExchangeRouteDetail'
        "404":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  '/private/exchange/routes/{from}/{to}/capabilities':
    get:
      operationId: getPrivateExchangeRoutesByFromByToCapabilities
      tags:
        - Обмен
      summary: 'Получить возможности направления по ID выбранных валют'
      x-required-scopes:
        - 'public-api:exchange:capabilities:read'
        - 'public-api:exchange:routes:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: from
          in: path
          required: true
          description: 'ID валюты или платёжной системы на стороне «Отдаю».'
          schema:
            type: integer
        -
          name: to
          in: path
          required: true
          description: 'ID валюты или платёжной системы на стороне «Получаю».'
          schema:
            type: integer
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Матрица возможностей направления.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          capabilities:
                            $ref: '#/components/schemas/RouteCapabilities'
        "404":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  /private/exchange/quotes:
    post:
      operationId: postPrivateExchangeQuotes
      tags:
        - Обмен
      summary: 'Предварительно рассчитать обмен'
      description: >-
        Рассчитывает обмен без создания заявки и резерва средств.
        Передайте полный result.snapshot в preflight и создание заявки, пока снимок действителен.
      x-required-scopes:
        - 'public-api:exchange:quotes:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          $ref: '#/components/parameters/CorrelationId'
      requestBody:
        required: true
        content:
          application/json:
            examples:
              quote:
                $ref: "#/components/examples/QuickstartQuoteInput"
            schema:
              $ref: '#/components/schemas/ExchangeQuoteRequest'
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Расчёт без создания заявки.'
          content:
            application/json:
              examples:
                quote:
                  $ref: "#/components/examples/QuickstartQuote"
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          quote:
                            $ref: '#/components/schemas/ExchangeQuote'
                          snapshot:
                            $ref: '#/components/schemas/RouteSnapshot'
        "422":
          $ref: "#/components/responses/InvalidExchangeInput"
        "429":
          $ref: "#/components/responses/RateLimited"
        default:
          $ref: "#/components/responses/Error"
  /private/exchange/orders/preflight:
    post:
      operationId: postPrivateExchangeOrdersPreflight
      tags:
        - Обмен
      summary: 'Проверить заявку на обмен перед созданием'
      description: >-
        Проверяет данные, подготовленные для создания заявки. HTTP 200 означает, что проверка выполнена.
        Перед созданием прочитайте result.preflight.can_create_order и result.preflight.validation_issues.
        Внешние проверки выполняются при создании.
      x-required-scopes:
        - 'public-api:exchange:preflight:read'
        - 'public-api:exchange:quotes:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          $ref: '#/components/parameters/CorrelationId'
      requestBody:
        required: true
        content:
          application/json:
            examples:
              orderInput:
                $ref: "#/components/examples/QuickstartOrderInput"
            schema:
              $ref: '#/components/schemas/ExchangeOrderPreflightRequest'
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Результат предварительной проверки: расчёт, контракт операции, требования и снимок направления.'
          content:
            application/json:
              examples:
                allowed:
                  $ref: "#/components/examples/QuickstartPreflight"
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          preflight:
                            $ref: '#/components/schemas/ExchangeOrderPreflight'
        "422":
          $ref: "#/components/responses/InvalidExchangeInput"
        "429":
          $ref: "#/components/responses/RateLimited"
        default:
          $ref: "#/components/responses/Error"
  /private/exchange/orders:
    post:
      operationId: postPrivateExchangeOrders
      tags:
        - Обмен
      summary: 'Создать заявку на обмен'
      description: >-
        Создаёт заявку с теми же данными, что и preflight. Задайте уникальный Idempotency-Key для этой заявки.
        Если результат неизвестен, повторите запрос с прежними ключом и данными, новыми timestamp, nonce и подписью.
      x-required-scopes:
        - 'public-api:exchange:orders:create'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          $ref: '#/components/parameters/IdempotencyKey'
        -
          $ref: '#/components/parameters/CorrelationId'
      requestBody:
        required: true
        content:
          application/json:
            examples:
              orderInput:
                $ref: "#/components/examples/QuickstartOrderInput"
            schema:
              $ref: '#/components/schemas/ExchangeOrderCreateRequest'
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "201":
          description: >-
            Созданная заявка или повтор её выдачи. Повтор возвращает тот же result со свежими метаданными запроса
            и заголовком Idempotency-Replayed со значением true.
          headers:
            Idempotency-Key:
              description: Ключ из запроса при его наличии.
              schema:
                type: string
                example: quickstart-order-0001
            Idempotency-Replayed:
              description: Присутствует только при повторной выдаче.
              schema: { type: string, const: 'true' }
          content:
            application/json:
              examples:
                created:
                  $ref: "#/components/examples/QuickstartOrderCreated"
                replayed:
                  $ref: "#/components/examples/QuickstartOrderReplayed"
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          order:
                            $ref: '#/components/schemas/Order'
        "403":
          $ref: '#/components/responses/Error'
        "409":
          description: >-
            При idempotency_in_progress дождитесь Retry-After и повторите запрос с теми же ключом и данными.
            При idempotency_conflict сверьте исходную операцию перед созданием новой заявки.
          headers:
            Retry-After:
              description: Секунды до повтора выполняющейся операции. Также доступны в error.details.retry_after.
              schema:
                type: string
                example: "2"
          content:
            application/json:
              examples:
                inProgress:
                  $ref: "#/components/examples/QuickstartOrderInProgress"
                conflict:
                  $ref: "#/components/examples/QuickstartOrderConflict"
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "422":
          $ref: "#/components/responses/InvalidExchangeInput"
        "429":
          $ref: "#/components/responses/RateLimited"
        default:
          $ref: "#/components/responses/Error"
  '/private/exchange/orders/{order}':
    get:
      operationId: getPrivateExchangeOrdersByOrder
      tags:
        - Обмен
      summary: 'Получить свою заявку на обмен'
      x-required-scopes:
        - 'public-api:orders:detail:read'
        - 'public-api:orders:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: order
          in: path
          required: true
          schema:
            type: string
          description: 'ID записи в базе, public_id или tracking_id.'
      responses:
        '401':
          $ref: '#/components/responses/Unauthorized'
        '200':
          description: Заявка текущего клиента.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessEnvelope'
                  - type: object
                    properties:
                      result:
                        $ref: '#/components/schemas/Order'
        '404':
          $ref: '#/components/responses/Error'
        default:
          $ref: '#/components/responses/Error'
        '422':
          $ref: '#/components/responses/Error'
    delete:
      operationId: deletePrivateExchangeOrdersByOrder
      tags:
        - Обмен
      summary: 'Отменить свою заявку на обмен'
      x-required-scopes:
        - 'public-api:exchange:orders:cancel'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: order
          in: path
          required: true
          schema:
            type: string
          description: 'ID записи в базе, public_id или tracking_id.'
        -
          $ref: '#/components/parameters/IdempotencyKey'
        -
          $ref: '#/components/parameters/CorrelationId'
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: '#/components/responses/OrderResult'
        "404":
          $ref: '#/components/responses/Error'
        "422":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  '/private/exchange/orders/{order}/status':
    get:
      operationId: getPrivateExchangeOrdersByOrderStatus
      tags:
        - Обмен
      summary: Получить статус и полную заявку
      x-required-scopes:
        - 'public-api:orders:detail:read'
        - 'public-api:orders:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: order
          in: path
          required: true
          schema:
            type: string
          description: 'ID записи в базе, public_id или tracking_id.'
      responses:
        '401':
          $ref: '#/components/responses/Unauthorized'
        '200':
          $ref: '#/components/responses/OrderStatusResult'
        '404':
          $ref: '#/components/responses/Error'
        default:
          $ref: '#/components/responses/Error'
        '422':
          $ref: '#/components/responses/Error'
  '/private/exchange/orders/{order}/actions':
    get:
      operationId: getPrivateExchangeOrdersByOrderActions
      tags:
        - Обмен
      summary: 'Получить состояние заявки и доступные действия'
      x-required-scopes:
        - 'public-api:exchange:orders:actions:read'
        - 'public-api:orders:detail:read'
        - 'public-api:orders:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: order
          in: path
          required: true
          schema:
            type: string
          description: 'ID записи в базе, public_id или tracking_id.'
      responses:
        '401':
          $ref: '#/components/responses/Unauthorized'
        '200':
          description: Состояния и переходы заявки.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessEnvelope'
                  - type: object
                    properties:
                      result:
                        type: object
                        properties:
                          actions:
                            $ref: '#/components/schemas/OrderActions'
        '404':
          $ref: '#/components/responses/Error'
        default:
          $ref: '#/components/responses/Error'
        '422':
          $ref: '#/components/responses/Error'
  '/private/exchange/orders/{order}/confirm':
    post:
      operationId: postPrivateExchangeOrdersByOrderConfirm
      tags:
        - Обмен
      summary: 'Подтвердить оплату или отметить заявку неоплаченной'
      x-required-scopes:
        - 'public-api:exchange:orders:confirm'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: order
          in: path
          required: true
          schema:
            type: string
          description: 'ID записи в базе, public_id или tracking_id.'
        -
          $ref: '#/components/parameters/IdempotencyKey'
        -
          $ref: '#/components/parameters/CorrelationId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExchangeOrderConfirmRequest'
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: '#/components/responses/OrderResult'
        "404":
          $ref: '#/components/responses/Error'
        "422":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  '/private/exchange/orders/{order}/cancel':
    post:
      operationId: postPrivateExchangeOrdersByOrderCancel
      tags:
        - Обмен
      summary: 'Отменить свою заявку на обмен'
      x-required-scopes:
        - 'public-api:exchange:orders:cancel'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: order
          in: path
          required: true
          schema:
            type: string
        -
          $ref: '#/components/parameters/IdempotencyKey'
        -
          $ref: '#/components/parameters/CorrelationId'
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: '#/components/responses/OrderResult'
        "404":
          $ref: '#/components/responses/Error'
        "422":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  '/private/exchange/orders/{order}/payment-instructions':
    get:
      operationId: getPrivateExchangeOrdersByOrderPaymentInstructions
      tags: [Обмен]
      summary: "Получить актуальные инструкции по оплате"
      description: "Читает текущее состояние без создания счёта у провайдера. Реквизиты или ссылка на оплату доступны, когда заявка готова к приёму платежа."
      x-required-scopes:
        - 'public-api:exchange:payment-instructions:read'
      security:
        - sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        - $ref: "#/components/parameters/ExchangeOrderIdentifier"
        - $ref: "#/components/parameters/CorrelationId"
      responses:
        "200":
          $ref: "#/components/responses/PaymentInstructions"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Error"
        "404":
          $ref: "#/components/responses/Error"
        default:
          $ref: "#/components/responses/Error"
    post:
      operationId: postPrivateExchangeOrdersByOrderPaymentInstructions
      tags: [Обмен]
      summary: "Подготовить инструкции по оплате"
      description: "Запускает подготовку без тела запроса. Актуальное состояние и реквизиты получайте через GET. Ответ на подготовку не содержит реквизиты или ссылку на оплату."
      x-required-scopes:
        - 'public-api:exchange:payment-instructions:write'
      security:
        - sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        - $ref: "#/components/parameters/ExchangeOrderIdentifier"
        - $ref: "#/components/parameters/IdempotencyKey"
        - $ref: "#/components/parameters/CorrelationId"
      responses:
        "200":
          $ref: "#/components/responses/PaymentInstructionsPreparation"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Error"
        "404":
          $ref: "#/components/responses/Error"
        "409":
          $ref: "#/components/responses/Error"
        "422":
          $ref: "#/components/responses/Error"
        "503":
          description: "Уведомление оператора временно недоступно. Повторите тот же запрос подготовки."
          headers:
            Retry-After:
              schema:
                type: integer
                example: 3
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        default:
          $ref: "#/components/responses/Error"
  '/private/exchange/orders/{order}/verifications':
    get:
      operationId: getPrivateExchangeOrdersByOrderVerifications
      tags:
        - Проверки
      summary: 'Получить требования проверки для заявки'
      x-required-scopes:
        - 'public-api:verifications:read'
        - 'public-api:orders:detail:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: order
          in: path
          required: true
          schema:
            type: string
          description: 'ID записи в базе, public_id или tracking_id.'
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Требования проверки по заявке.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          requirements:
                            $ref: '#/components/schemas/VerificationRequirements'
        "404":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  '/private/exchange/orders/{order}/verifications/submit':
    post:
      operationId: postPrivateExchangeOrdersByOrderVerificationsSubmit
      tags:
        - Проверки
      summary: 'Отправить данные проверки по заявке'
      x-required-scopes:
        - 'public-api:verifications:write'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: order
          in: path
          required: true
          schema:
            type: string
        -
          $ref: '#/components/parameters/IdempotencyKey'
        -
          $ref: '#/components/parameters/CorrelationId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderVerificationSubmitRequest'
      responses:
        '401':
          $ref: '#/components/responses/Unauthorized'
        '200':
          $ref: '#/components/responses/OrderVerificationSubmitResult'
        '422':
          $ref: '#/components/responses/Error'
        default:
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
  /private/files/upload-intents:
    post:
      operationId: postPrivateFilesUploadIntents
      tags:
        - Файлы
      summary: 'Создать одноразовое разрешение на загрузку'
      x-required-scopes:
        - 'public-api:files:write'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          $ref: '#/components/parameters/IdempotencyKey'
        -
          $ref: '#/components/parameters/CorrelationId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UploadIntentCreateRequest'
      responses:
        '401':
          $ref: '#/components/responses/Unauthorized'
        '201':
          description: Разрешение на загрузку.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessEnvelope'
                  - type: object
                    properties:
                      result:
                        type: object
                        properties:
                          upload_intent:
                            $ref: '#/components/schemas/UploadIntent'
        '422':
          $ref: '#/components/responses/Error'
        default:
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
  '/private/files/upload-intents/{intent}':
    get:
      operationId: getPrivateFilesUploadIntentsByIntent
      tags:
        - Файлы
      summary: 'Получить состояние разрешения на загрузку'
      x-required-scopes:
        - 'public-api:files:read'
        - 'public-api:files:write'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: '#/components/parameters/SignatureVersion'
        - name: intent
          in: path
          required: true
          schema:
            type: string
            anyOf:
              - format: uuid
              - pattern: ^[0-9]*[1-9][0-9]*$
          description: UUID или положительный числовой ID разрешения на загрузку. Используйте UUID из ответа на создание.
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Разрешение на загрузку.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          upload_intent:
                            $ref: '#/components/schemas/UploadIntent'
        "404":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  '/private/files/upload-intents/{intent}/commit':
    post:
      operationId: postPrivateFilesUploadIntentsByIntentCommit
      tags:
        - Файлы
      summary: 'Загрузить файл по разрешению'
      x-required-scopes:
        - 'public-api:files:write'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - name: intent
          in: path
          required: true
          schema:
            type: string
            anyOf:
              - format: uuid
              - pattern: ^[0-9]*[1-9][0-9]*$
          description: UUID или положительный числовой ID разрешения на загрузку. Используйте UUID из ответа на создание.
        - $ref: '#/components/parameters/IdempotencyKey'
        - $ref: '#/components/parameters/CorrelationId'
        - $ref: '#/components/parameters/SignatureVersion'
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: '#/components/responses/UploadIntentResult'
        "422":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  /private/verifications/requirements:
    get:
      operationId: getPrivateVerificationsRequirements
      tags:
        - Проверки
      summary: 'Получить требования проверки для направления или заявки'
      description: "Для чтения требований по заявке дополнительно требуется право verifications:read."
      x-required-scopes:
        - 'public-api:verifications:read'
        - 'public-api:exchange:routes:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: '#/components/parameters/SignatureVersion'
        - name: order
          in: query
          required: false
          schema:
            type: string
            maxLength: 128
        - name: route_id
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
        - name: income_payment_system
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
        - name: outcome_payment_system
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
        - name: direction_id
          in: query
          schema:
            type: integer
            minimum: 1
          description: Алиас route_id. Если передаёте оба поля, их значения должны совпадать.
        - name: from_currency_id
          in: query
          schema:
            type: integer
            minimum: 1
          description: ID валюты отдачи.
        - name: to_currency_id
          in: query
          schema:
            type: integer
            minimum: 1
          description: ID валюты получения.
        - name: from
          in: query
          schema:
            type: string
            maxLength: 64
          description: Идентификатор валюты отдачи.
        - name: to
          in: query
          schema:
            type: string
            maxLength: 64
          description: Идентификатор валюты получения.
        - name: from_code
          in: query
          schema:
            type: string
            maxLength: 64
          description: Идентификатор валюты отдачи. Алиас from.
        - name: to_code
          in: query
          schema:
            type: string
            maxLength: 64
          description: Идентификатор валюты получения. Алиас to.
      responses:
        '401':
          $ref: '#/components/responses/Unauthorized'
        '200':
          $ref: '#/components/responses/VerificationRequirementsResult'
        '422':
          $ref: '#/components/responses/Error'
        default:
          $ref: '#/components/responses/Error'
        '403':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
  /private/verifications/identity:
    get:
      operationId: getPrivateVerificationsIdentity
      tags: [Проверки]
      summary: "Получить требования проверки личности"
      description: "Возвращает опубликованную ручную форму или ссылку на авторизованный кабинет для внешнего провайдера. Ответ содержит текущее состояние проверки."
      x-required-scopes: ["public-api:verifications:read"]
      security:
        - sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
      responses:
        "200":
          $ref: "#/components/responses/IdentityVerificationRequirements"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Error"
        default:
          $ref: "#/components/responses/Error"
    post:
      operationId: postPrivateVerificationsIdentity
      tags:
        - Проверки
      summary: 'Отправить заявку на проверку личности'
      x-required-scopes:
        - 'public-api:verifications:write'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          $ref: '#/components/parameters/IdempotencyKey'
        -
          $ref: '#/components/parameters/CorrelationId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IdentityVerificationCreateRequest'
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "201":
          $ref: '#/components/responses/IdentityVerificationResult'
        "422":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  '/private/verifications/identity/{verification}':
    get:
      operationId: getPrivateVerificationsIdentityByVerification
      tags:
        - Проверки
      summary: 'Получить проверку личности'
      x-required-scopes:
        - 'public-api:verifications:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: verification
          in: path
          required: true
          description: "Передайте значение uuid из ответа проверки без преобразований. Числовой идентификатор используется для совместимости со старыми записями."
          schema:
            type: string
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: '#/components/responses/IdentityVerificationResult'
        "404":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  '/private/verifications/identity/{verification}/actions':
    get:
      operationId: getPrivateVerificationsIdentityByVerificationActions
      tags:
        - Проверки
      summary: 'Получить действия по проверке личности'
      x-required-scopes:
        - 'public-api:verifications:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: verification
          in: path
          required: true
          description: "Передайте значение uuid из ответа проверки без преобразований. Числовой идентификатор используется для совместимости со старыми записями."
          schema:
            type: string
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: '#/components/responses/VerificationActions'
        default:
          $ref: "#/components/responses/Error"
  /private/verifications/cards:
    post:
      operationId: postPrivateVerificationsCards
      tags:
        - Проверки
      summary: 'Отправить заявку на проверку карты или счёта'
      x-required-scopes:
        - 'public-api:verifications:write'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          $ref: '#/components/parameters/IdempotencyKey'
        -
          $ref: '#/components/parameters/CorrelationId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CardVerificationCreateRequest'
              anyOf:
                - required:
                    - order
                  properties:
                    order:
                      type: string
                      pattern: \S
                - required:
                    - order_id
                  properties:
                    order_id:
                      type: string
                      pattern: \S
                - required:
                    - currency_id
                  properties:
                    currency_id:
                      type: integer
                      minimum: 1
              description: Передайте currency_id для проверки вне заявки. Если проверка относится к заявке, обменник использует валюту отдачи
                этой заявки.
      responses:
        '401':
          $ref: '#/components/responses/Unauthorized'
        '201':
          description: Заявка на проверку карты создана.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessEnvelope'
                  - type: object
                    properties:
                      result:
                        type: object
                        properties:
                          verification:
                            $ref: '#/components/schemas/CardVerification'
        '422':
          $ref: '#/components/responses/Error'
        default:
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
  '/private/verifications/cards/{verification}':
    get:
      operationId: getPrivateVerificationsCardsByVerification
      tags:
        - Проверки
      summary: 'Получить проверку карты или счёта'
      x-required-scopes:
        - 'public-api:verifications:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: verification
          in: path
          required: true
          schema:
            type: string
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Данные проверки карты.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          verification:
                            $ref: '#/components/schemas/CardVerification'
        "404":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  '/private/verifications/cards/{verification}/actions':
    get:
      operationId: getPrivateVerificationsCardsByVerificationActions
      tags:
        - Проверки
      summary: 'Получить действия по проверке карты или счёта'
      x-required-scopes:
        - 'public-api:verifications:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: verification
          in: path
          required: true
          schema:
            type: string
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: '#/components/responses/VerificationActions'
        default:
          $ref: "#/components/responses/Error"
  /private/sandbox/exchange/orders/simulate:
    post:
      operationId: postPrivateSandboxExchangeOrdersSimulate
      tags:
        - Песочница
      summary: 'Проверить создание заявки на обмен без сохранения'
      description: >-
        Выполняет те же проверки preflight, что и создание заявки, не создавая запись заявки.
        Если у выбранного города включена передача наличных, передайте handover.method
        и выбранный office_id либо адрес курьера в зависимости от способа.
        Для прежних городов без такой настройки объект handover не требуется.
        Некорректный или недоступный выбор возвращает 422.
      x-required-scopes:
        - 'public-api:sandbox:run'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          $ref: '#/components/parameters/IdempotencyKey'
        -
          $ref: '#/components/parameters/CorrelationId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExchangeOrderPreflightRequest'
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: '#/components/responses/SandboxSimulation'
        "422":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  /private/reviews:
    get:
      operationId: getPrivateReviews
      tags:
        - Отзывы
      summary: 'Получить опубликованные отзывы'
      x-required-scopes:
        - 'public-api:reviews:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: '#/components/parameters/SignatureVersion'
        - $ref: '#/components/parameters/Page'
        - $ref: '#/components/parameters/PerPage'
        - $ref: '#/components/parameters/PaginationMode'
        - $ref: '#/components/parameters/Cursor'
        - name: filter[rating]
          in: query
          schema:
            type: integer
            format: int32
          description: Сохранённая оценка. Используйте 0 для отзывов без оценки.
        - name: filter[order_id]
          in: query
          schema:
            type: integer
          description: Внутренний числовой ID заявки. При создании отзыва также можно использовать публичный идентификатор или tracking_id.
        - name: filter[created_from]
          in: query
          schema:
            type: string
            format: date
        - name: filter[created_to]
          in: query
          schema:
            type: string
            format: date
        - name: filter[id]
          in: query
          schema:
            type: integer
            format: int64
          description: ID записи отзыва.
        - name: filter[direction_id]
          in: query
          schema:
            type: integer
            format: int32
          description: ID направления, связанного с отзывом.
        - name: filter[user_id]
          in: query
          schema:
            type: integer
            format: int32
          description: ID пользователя, который оставил отзыв.
        - name: filter[status]
          in: query
          schema:
            type: integer
            format: int32
          description: Фильтр по статусу отзыва. Лента содержит только опубликованные отзывы со статусом 1.
        - name: sort
          in: query
          schema:
            type: string
            pattern: ^-?(id|rating|status|created_at)(,-?(id|rating|status|created_at))*$
          description: Поля сортировки через запятую. Минус задаёт убывание. При курсорной пагинации допустимы только id или -id.
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: 'Опубликованные отзывы.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: array
                        items:
                          $ref: '#/components/schemas/Review'
        "422":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
    post:
      operationId: postPrivateReviews
      tags:
        - Отзывы
      summary: 'Оставить отзыв по своей заявке'
      x-required-scopes:
        - 'public-api:reviews:write'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          $ref: '#/components/parameters/IdempotencyKey'
        -
          $ref: '#/components/parameters/CorrelationId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReviewCreateRequest'
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "201":
          description: 'Отзыв отправлен на модерацию.'
          content:
            application/json:
              schema:
                allOf:
                  -
                    $ref: '#/components/schemas/SuccessEnvelope'
                  -
                    type: object
                    properties:
                      result:
                        type: object
                        properties:
                          review:
                            $ref: '#/components/schemas/Review'
        "404":
          $ref: '#/components/responses/Error'
        "409":
          $ref: '#/components/responses/Error'
        "422":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  /private/orders/statuses:
    get:
      operationId: getPrivateOrdersStatuses
      tags:
        - Заявки
      summary: 'Справочник статусов заявок'
      x-required-scopes:
        - 'public-api:orders:statuses:read'
        - 'public-api:orders:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: '#/components/responses/OrderStatuses'
        default:
          $ref: "#/components/responses/Error"
  /private/orders:
    get:
      operationId: getPrivateOrders
      tags:
        - Заявки
      summary: 'Получить свои заявки'
      x-required-scopes:
        - 'public-api:orders:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          $ref: '#/components/parameters/Page'
        -
          $ref: '#/components/parameters/PerPage'
        -
          $ref: '#/components/parameters/PaginationMode'
        -
          $ref: '#/components/parameters/Cursor'
        -
          name: sort
          in: query
          schema:
            type: string
            example: '-created_at'
          description: 'Поля сортировки через запятую. Допустимы: id, created_at, updated_at, completed_at, amount_in, amount_out, status.'
        -
          name: 'filter[status]'
          in: query
          schema:
            type: string
            enum:
              - active
              - final
              - expired
              - pending_payment
              - waiting_handle
              - completed
              - rejected
              - canceled_by_user
              - paid
              - frozen
              - processing_payment
              - invalid
              - deleted
              - check_payment
              - merchant_confirmation
              - auto_payout_error
              - payout_in_progress
              - payout_queue
            example: paid
          description: 'Один публичный ключ статуса. Несколько значений передавайте как `filter[status][]=paid&filter[status][]=completed`. Строка CSV не считается массивом и отклоняется как неизвестный статус.'
        -
          name: 'filter[status_id]'
          in: query
          schema:
            type: integer
            minimum: 1
            example: 7
          description: 'Числовой ID статуса; не сочетайте его с `filter[status]`.'
        -
          name: 'filter[id]'
          in: query
          schema:
            type: integer
        -
          name: 'filter[public_id]'
          in: query
          schema:
            type: string
        -
          name: 'filter[tracking_id]'
          in: query
          schema:
            type: string
        -
          name: 'filter[email]'
          in: query
          schema:
            type: string
        -
          name: 'filter[from_requisite]'
          in: query
          schema:
            type: string
        -
          name: 'filter[to_requisite]'
          in: query
          schema:
            type: string
        -
          name: 'filter[created_from]'
          in: query
          schema:
            type: string
            format: date
        -
          name: 'filter[created_to]'
          in: query
          schema:
            type: string
            format: date
        -
          name: 'filter[currency]'
          in: query
          schema:
            type: string
            example: USDT
        -
          name: 'filter[amount_min]'
          in: query
          schema:
            type: string
        -
          name: 'filter[amount_max]'
          in: query
          schema:
            type: string
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: '#/components/responses/OrdersResult'
        "403":
          $ref: '#/components/responses/Error'
        "422":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  '/private/orders/{order}':
    get:
      operationId: getPrivateOrdersByOrder
      tags:
        - Заявки
      summary: 'Получить одну свою заявку'
      x-required-scopes:
        - 'public-api:orders:detail:read'
        - 'public-api:orders:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: order
          in: path
          required: true
          schema:
            type: string
          description: 'ID записи в базе, public_id или tracking_id.'
      responses:
        '401':
          $ref: '#/components/responses/Unauthorized'
        '200':
          $ref: '#/components/responses/OwnedOrderResult'
        '404':
          $ref: '#/components/responses/Error'
        default:
          $ref: '#/components/responses/Error'
        '422':
          $ref: '#/components/responses/Error'
  /private/partner:
    get:
      operationId: getPrivatePartner
      tags:
        - Партнёр
      summary: 'Партнёрский профиль и сводка'
      x-required-scopes:
        - 'public-api:partner:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: '#/components/responses/PartnerResult'
        default:
          $ref: "#/components/responses/Error"
  /private/partner/statistics:
    get:
      operationId: getPrivatePartnerStatistics
      tags:
        - Партнёр
      summary: 'Сводная партнёрская статистика'
      x-required-scopes:
        - 'public-api:partner:statistics:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: '#/components/responses/PartnerStatisticsResult'
        default:
          $ref: "#/components/responses/Error"
  /private/partner/referrals:
    get:
      operationId: getPrivatePartnerReferrals
      tags:
        - Партнёр
      summary: 'Список привлечённых клиентов'
      x-required-scopes:
        - 'public-api:partner:referrals:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: '#/components/parameters/SignatureVersion'
        - $ref: '#/components/parameters/Page'
        - $ref: '#/components/parameters/PerPage'
        - $ref: '#/components/parameters/PaginationMode'
        - $ref: '#/components/parameters/Cursor'
        - name: filter[id]
          in: query
          schema:
            type: integer
        - name: filter[client_id]
          in: query
          schema:
            type: integer
        - name: filter[client_email]
          in: query
          schema:
            type: string
        - name: filter[client_name]
          in: query
          schema:
            type: string
        - name: filter[created_from]
          in: query
          schema:
            type: string
            format: date
        - name: filter[created_to]
          in: query
          schema:
            type: string
            format: date
        - name: sort
          in: query
          schema:
            type: string
            pattern: ^-?(id|created_at)(,-?(id|created_at))*$
          description: Поля через запятую (id, created_at). Минус задаёт сортировку по убыванию. В курсорном режиме допустимы только
            id или -id.
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: '#/components/responses/PartnerReferralsResult'
        "422":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  /private/partner/exchanges:
    get:
      operationId: getPrivatePartnerExchanges
      tags:
        - Партнёр
      summary: 'Обмены с партнёрским вознаграждением'
      x-required-scopes:
        - 'public-api:partner:exchanges:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: '#/components/parameters/SignatureVersion'
        - $ref: '#/components/parameters/Page'
        - $ref: '#/components/parameters/PerPage'
        - $ref: '#/components/parameters/PaginationMode'
        - $ref: '#/components/parameters/Cursor'
        - name: filter[id]
          in: query
          schema:
            type: integer
        - name: filter[order_id]
          in: query
          schema:
            type: integer
        - name: filter[client_id]
          in: query
          schema:
            type: integer
        - name: filter[status]
          in: query
          schema:
            type: string
        - name: filter[order_public_id]
          in: query
          schema:
            type: string
        - name: filter[order_tracking_id]
          in: query
          schema:
            type: string
        - name: filter[client_email]
          in: query
          schema:
            type: string
        - name: filter[bonus_min]
          in: query
          schema:
            type: string
        - name: filter[bonus_max]
          in: query
          schema:
            type: string
        - name: filter[created_from]
          in: query
          schema:
            type: string
            format: date
        - name: filter[created_to]
          in: query
          schema:
            type: string
            format: date
        - name: sort
          in: query
          schema:
            type: string
            pattern: ^-?(id|order_id|status|created_at|bonus)(,-?(id|order_id|status|created_at|bonus))*$
          description: Поля через запятую (id, order_id, status, created_at, bonus). Минус задаёт сортировку по убыванию. В курсорном
            режиме допустимы только id или -id.
        - name: filter[client_name]
          in: query
          schema:
            type: string
          description: Точное имя привлечённого клиента.
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: '#/components/responses/PartnerExchangesResult'
        "422":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  /private/partner/payout-methods:
    get:
      operationId: getPrivatePartnerPayoutMethods
      tags:
        - Партнёр
      summary: 'Доступные способы выплаты и партнёрский баланс'
      description: 'Возвращает только доступные этому аккаунту валюты выплаты, текущий базовый баланс, минимальную сумму и правило подтверждения.'
      x-required-scopes:
        - 'public-api:partner:payouts:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: '#/components/responses/PartnerPayoutMethods'
        default:
          $ref: "#/components/responses/Error"
  /private/partner/payouts:
    get:
      operationId: getPrivatePartnerPayouts
      tags:
        - Партнёр
      summary: 'Заявки на партнёрские выплаты'
      x-required-scopes:
        - 'public-api:partner:payouts:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: '#/components/parameters/SignatureVersion'
        - $ref: '#/components/parameters/Page'
        - $ref: '#/components/parameters/PerPage'
        - $ref: '#/components/parameters/PaginationMode'
        - $ref: '#/components/parameters/Cursor'
        - name: filter[id]
          in: query
          schema:
            type: integer
        - name: filter[public_id]
          in: query
          schema:
            type: string
        - name: filter[wallet]
          in: query
          schema:
            type: string
        - name: filter[status]
          in: query
          schema:
            type: string
            enum:
              - pending
              - paid
              - rejected
        - name: filter[currency]
          in: query
          schema:
            type: string
        - name: filter[amount_min]
          in: query
          schema:
            type: string
        - name: filter[amount_max]
          in: query
          schema:
            type: string
        - name: filter[created_from]
          in: query
          schema:
            type: string
            format: date
        - name: filter[created_to]
          in: query
          schema:
            type: string
            format: date
        - name: sort
          in: query
          schema:
            type: string
            pattern: ^-?(id|status|created_at|amount)(,-?(id|status|created_at|amount))*$
          description: Поля через запятую (id, status, created_at, amount). Минус задаёт сортировку по убыванию. В курсорном режиме допустимы
            только id или -id.
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: '#/components/responses/PartnerPayouts'
        "422":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
    post:
      operationId: postPrivatePartnerPayouts
      tags:
        - Партнёр
      summary: 'Запросить партнёрскую выплату'
      description: 'Создаёт ожидающую заявку на выплату и однократно списывает указанную базовую сумму с доступного партнёрского баланса. Если не передать amount, запрашивается весь доступный баланс. Если включено подтверждение по email, оно остаётся обязательным; фактический перевод выполняется существующим процессом выплат. Повтор того же запроса с прежним Idempotency-Key возвращает созданную заявку даже после истечения срока HTTP-кеша повторов.'
      x-required-scopes:
        - 'public-api:partner:payouts:create'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        -
          name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
            minLength: 8
            maxLength: 191
            pattern: "^[A-Za-z0-9._:-]{8,191}$"
          description: 'Стабильный уникальный ключ этой выплаты, который сохраняется при повторах запроса.'
        -
          $ref: '#/components/parameters/CorrelationId'
        - $ref: "#/components/parameters/SignatureVersion"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PartnerPayoutCreateRequest'
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        '201':
          description: Созданная заявка на выплату в ожидании обработки.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartnerPayoutCreateResponse'
          headers:
            Idempotency-Replayed:
              description: Может присутствовать, когда API возвращает прежний результат для того же ключа идемпотентности.
              schema:
                type: string
                const: 'true'
        '200':
          description: При повторе возвращена ранее созданная заявка на выплату.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartnerPayoutCreateResponse'
          headers:
            Idempotency-Replayed:
              description: Может присутствовать, когда API возвращает прежний результат для того же ключа идемпотентности.
              schema:
                type: string
                const: 'true'
        "403":
          $ref: "#/components/responses/Error"
        "409":
          $ref: '#/components/responses/Error'
        "422":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  /private/partner/payouts/preview:
    post:
      operationId: postPrivatePartnerPayoutsPreview
      tags: [Партнёр]
      summary: "Рассчитать партнёрскую выплату"
      description: "Рассчитывает выплату и комиссию по текущим условиям. Предпросмотр не создаёт заявку, не резервирует баланс и не фиксирует курс."
      x-required-scopes:
        - "public-api:partner:payouts:read"
      security:
        - sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/CorrelationId"
        - $ref: "#/components/parameters/SignatureVersion"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PartnerPayoutCreateRequest"
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          description: "Рассчитанные сумма и комиссия."
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/SuccessEnvelope"
                  - type: object
                    properties:
                      result:
                        type: object
                        required: [preview]
                        properties:
                          preview:
                            $ref: "#/components/schemas/PartnerPayoutPreview"
        "422":
          $ref: "#/components/responses/Error"
        default:
          $ref: "#/components/responses/Error"
  '/private/partner/payouts/{payout}':
    get:
      operationId: getPrivatePartnerPayoutsByPayout
      tags:
        - Партнёр
      summary: 'Получить свою заявку на партнёрскую выплату'
      x-required-scopes:
        - 'public-api:partner:payouts:read'
      security:
        -
          sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        -
          name: payout
          in: path
          required: true
          schema:
            type: integer
      responses:
        "401":
          $ref: "#/components/responses/Unauthorized"
        "200":
          $ref: '#/components/responses/PartnerPayoutDetail'
        "404":
          $ref: '#/components/responses/Error'
        default:
          $ref: "#/components/responses/Error"
  /private/exchange/orders/{order}/status-summary:
    get:
      operationId: getPrivateExchangeOrdersByOrderStatusSummary
      tags: [Обмен]
      summary: "Получить краткий статус заявки"
      description: "Возвращает текущее сохранённое состояние для опроса. Прежняя операция статуса сохраняет полное представление заявки."
      x-required-scopes: ["public-api:orders:detail:read", "public-api:orders:read"]
      security:
        - sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        - $ref: "#/components/parameters/ExchangeOrderIdentifier"
        - $ref: "#/components/parameters/CorrelationId"
      responses:
        "200":
          $ref: "#/components/responses/ExchangeOrderStatusSummary"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Error"
        "404":
          $ref: "#/components/responses/Error"
        "422":
          $ref: "#/components/responses/Error"
        default:
          $ref: "#/components/responses/Error"
  /private/exchange/orders/{order}/payment-status:
    get:
      operationId: getPrivateExchangeOrdersByOrderPaymentStatus
      tags: [Обмен]
      summary: "Получить ход оплаты"
      description: "Возвращает текущее состояние оплаты и до 50 последних зафиксированных переходов. Для исторической заявки подтверждение провайдера может отсутствовать в журнале даже после поступления средств."
      x-required-scopes: ["public-api:exchange:payment-instructions:read"]
      security:
        - sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        - $ref: "#/components/parameters/ExchangeOrderIdentifier"
        - $ref: "#/components/parameters/CorrelationId"
      responses:
        "200":
          $ref: "#/components/responses/ExchangeOrderPaymentStatus"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Error"
        "404":
          $ref: "#/components/responses/Error"
        "422":
          $ref: "#/components/responses/Error"
        default:
          $ref: "#/components/responses/Error"
  /private/exchange/orders/{order}/receipts:
    get:
      operationId: getPrivateExchangeOrdersByOrderReceipts
      tags: [Файлы]
      summary: "Получить список метаданных платёжных чеков"
      description: "Начните без after_id, затем передавайте next_after_id для продолжения в порядке возрастания ID."
      x-required-scopes: ["public-api:files:read"]
      security:
        - sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/SignatureVersion"
        - $ref: "#/components/parameters/ExchangeOrderIdentifier"
        - name: after_id
          in: query
          schema: { type: integer, minimum: 1 }
        - name: limit
          in: query
          schema: { type: integer, minimum: 1, maximum: 100, default: 25 }
        - $ref: "#/components/parameters/CorrelationId"
      responses:
        "200":
          $ref: "#/components/responses/ExchangeOrderReceipts"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Error"
        "404":
          $ref: "#/components/responses/Error"
        "422":
          $ref: "#/components/responses/Error"
        default:
          $ref: "#/components/responses/Error"
    post:
      operationId: postPrivateExchangeOrdersByOrderReceipts
      tags: [Файлы]
      summary: "Прикрепить платёжный чек"
      description: "Прикрепляет один чек к заявке владельца ключа. Подтверждение оплаты выполняется отдельной операцией. Повтор с тем же ключом и файлом возвращает исходный чек после истечения TTL обычных ответов. При удалении чека или смене владельца API возвращает 404 и сохраняет ключ занятым."
      x-required-scopes: ["public-api:files:write"]
      security:
        - sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - $ref: "#/components/parameters/ExchangeOrderIdentifier"
        - $ref: "#/components/parameters/CorrelationId"
        - $ref: "#/components/parameters/SignatureVersion"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required: [file]
              additionalProperties: false
              properties:
                file:
                  type: string
                  format: binary
      responses:
        "201":
          $ref: "#/components/responses/ExchangeOrderReceipt"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Error"
        "404":
          $ref: "#/components/responses/Error"
        "409":
          $ref: "#/components/responses/Error"
        "422":
          $ref: "#/components/responses/Error"
        default:
          $ref: "#/components/responses/Error"
  /private/exchange/routes/{route}/fields/{group}/{field}/files:
    post:
      operationId: postPrivateExchangeRouteFieldFiles
      tags: [Файлы]
      summary: "Загрузить файл для поля заявки"
      description: "Возвращает одноразовый токен, привязанный к авторизованной интеграции, направлению и полю. Для группы `user` передайте массив токенов в `user_fields[field_key]` до истечения срока."
      x-required-scopes: ["public-api:files:write"]
      security:
        - sanctumBearer: []
          apiTimestamp: []
          apiNonce: []
          apiSignature: []
      parameters:
        - name: route
          in: path
          required: true
          schema: { type: integer, minimum: 1 }
        - name: group
          in: path
          required: true
          schema: { type: string, enum: [in, out, direction, user] }
        - name: field
          in: path
          required: true
          schema: { type: integer, minimum: 1 }
        - $ref: "#/components/parameters/CorrelationId"
        - $ref: "#/components/parameters/SignatureVersion"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required: [file]
              additionalProperties: false
              properties:
                file:
                  type: string
                  format: binary
      responses:
        "201":
          $ref: "#/components/responses/OrderFieldUpload"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Error"
        "404":
          $ref: "#/components/responses/Error"
        "422":
          $ref: "#/components/responses/Error"
        default:
          $ref: "#/components/responses/Error"
webhooks:
  delivery:
    post:
      operationId: receivePublicApiWebhook
      tags: [Вебхуки]
      summary: "Получить исходящий вебхук"
      description: >-
        Проверяйте HMAC v2 секретом подписки по точным байтам JSON.
        Соедините строку webhook-v2, ID события, тип, время Unix, положительный
        номер попытки, nonce и SHA-256 тела в нижнем регистре символами LF.
        Последняя строка заканчивается хэшем. Сверяйте ID и тип события с
        подписанным телом. Обрабатывайте повторы по ID события идемпотентно.
        Тестовое событие имеет тип api.test и может содержать sample_of.
      security: []
      parameters:
        - name: X-Webhook-Signature-Version
          in: header
          required: true
          schema: { type: string, const: v2 }
        - name: X-Webhook-Event-Id
          in: header
          required: true
          schema:
            type: string
            format: uuid
        - name: X-Webhook-Event-Type
          in: header
          required: true
          schema:
            type: string
        - name: X-Webhook-Timestamp
          in: header
          required: true
          schema:
            type: string
            pattern: "^[0-9]+$"
        - name: X-Webhook-Attempt
          in: header
          required: true
          schema: { type: integer, minimum: 1 }
        - name: X-Webhook-Nonce
          in: header
          required: true
          schema:
            type: string
            format: uuid
        - name: X-Webhook-Signature
          in: header
          required: true
          schema:
            type: string
            pattern: "^sha256=[a-f0-9]{64}$"
        - name: X-Request-Id
          in: header
          schema:
            type: string
        - $ref: "#/components/parameters/CorrelationId"
      requestBody:
        required: true
        content:
          application/json:
            examples:
              statusChanged:
                $ref: "#/components/examples/QuickstartStatusChangedNotification"
              testEvent:
                $ref: "#/components/examples/QuickstartTestNotification"
            schema:
              $ref: "#/components/schemas/WebhookNotification"
      responses:
        "2XX":
          description: "Доставка принята и сохранена."
        "429":
          description: "Повторите позже. Получатель может вернуть Retry-After."
          headers:
            Retry-After:
              schema:
                type: string
        default:
          description: "Доставка не принята. Повтор зависит от политики доставки API."
components:
  securitySchemes:
    sanctumBearer:
      type: http
      scheme: bearer
      bearerFormat: Sanctum
      description: 'Токен Sanctum в заголовке `Authorization: Bearer <token>`.'
    apiTimestamp:
      type: apiKey
      in: header
      name: X-Api-Timestamp
      description: "Положительное число секунд Unix или абсолютное время ISO 8601 с секундами, смещением или Z. Допустимо до шести знаков дробной части секунды."
    apiNonce:
      type: apiKey
      in: header
      name: X-Api-Nonce
      description: Одноразовое значение для каждого ключа в пределах окна подписи. Используйте от 8 до 128 символов A–Z, a–z, 0–9, точки, подчёркивания, двоеточия и дефиса.
    apiSignature:
      type: apiKey
      in: header
      name: X-Api-Signature
      description: 'Подпись HMAC-SHA256 в шестнадцатеричном виде; допустим префикс `sha256=`.'
  parameters:
    Page:
      name: page
      in: query
      schema:
        type: integer
        minimum: 1
        default: 1
    PerPage:
      name: per_page
      in: query
      schema:
        type: integer
        minimum: 1
        maximum: 100
        default: 25
    PaginationMode:
      name: pagination
      in: query
      schema:
        type: string
        enum:
          - page
          - cursor
        default: page
      description: 'Для больших списков используйте `cursor`. Курсор поддерживает только `sort=id` или `sort=-id`; без sort применяется `-id`. Для первой страницы передайте `pagination=cursor`. Для продолжения передайте полученный `cursor`; pagination и sort можно опустить. Если sort повторяется, направление должно совпадать с курсором.'
    Cursor:
      name: cursor
      in: query
      schema:
        type: [string, "null"]
      description: 'Непрозрачный курсор из `meta.pagination.next_cursor`. Не изменяйте его и не сочетайте с противоположным направлением сортировки по id.'
    SignatureVersion:
      name: X-Api-Signature-Version
      in: header
      required: true
      description: >-
        Обязательная версия подписи запроса. Укажите v2 первой строкой
        канонического представления. Восьмой строкой добавьте Idempotency-Key
        без крайних пробелов или пустую строку при отсутствии ключа.
        Подписывайте исходные значения разобранного query.
      schema:
        type: string
        const: v2
    ExchangeOrderIdentifier:
      name: order
      in: path
      required: true
      description: "ID заявки, публичный номер или tracking ID."
      schema:
        type: string
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      schema:
        type: string
        minLength: 8
        maxLength: 191
        pattern: "^[A-Za-z0-9._:-]{8,191}$"
      description: 'Обычное окно повторов по умолчанию составляет 24 часа. Для успешного создания заявки, загрузки чека и партнёрской выплаты сохраняется долговечная квитанция.'
    CorrelationId:
      name: X-Correlation-Id
      in: header
      required: false
      schema:
        type: string
        maxLength: 128
      description: 'Идентификатор клиента для связи API-запроса с событиями вебхуков.'
    WebhookId:
      name: webhook
      in: path
      required: true
      schema:
        type: string
        format: uuid
  responses:
    IdentityVerificationRequirements:
      description: "Текущие требования проверки личности."
      headers:
        Cache-Control:
          schema:
            type: string
            example: "private, no-store"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: object
                    required: [requirements]
                    properties:
                      requirements:
                        $ref: "#/components/schemas/IdentityVerificationRequirements"
    ExchangeOrderStatusSummary:
      description: "Текущее краткое состояние заявки."
      headers:
        Cache-Control:
          schema:
            type: string
            example: "private, no-store"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    $ref: "#/components/schemas/ExchangeOrderStatusSummary"
    ExchangeOrderPaymentStatus:
      description: "Текущее состояние оплаты и журнал переходов."
      headers:
        Cache-Control:
          schema:
            type: string
            example: "private, no-store"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    $ref: "#/components/schemas/ExchangeOrderPaymentStatus"
    ExchangeOrderReceipts:
      description: "Страница метаданных чеков."
      headers:
        Cache-Control:
          schema:
            type: string
            example: "private, no-store"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    $ref: "#/components/schemas/ExchangeOrderReceipts"
    ExchangeOrderReceipt:
      description: "Метаданные загруженного платёжного чека."
      headers:
        Cache-Control:
          schema:
            type: string
            example: "private, no-store"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: object
                    required: [receipt]
                    properties:
                      receipt:
                        $ref: "#/components/schemas/ExchangeOrderReceipt"
    OrderFieldUpload:
      description: "Загруженный файл поля заявки и его токен."
      headers:
        Cache-Control:
          schema:
            type: string
            example: "private, no-store"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: object
                    required: [file]
                    properties:
                      file:
                        $ref: "#/components/schemas/OrderFieldUpload"
    Unauthorized:
      description: "Требуется действительная авторизация для API. Если токен действителен, пропуск версии подписи возвращает signature_required, а недопустимая версия возвращает invalid_signature."
      headers:
        WWW-Authenticate:
          required: true
          schema:
            type: string
            example: 'Bearer realm="exchanger-api"'
      content:
        application/json:
          examples:
            signatureRequired:
              $ref: "#/components/examples/QuickstartSignatureRequired"
          schema:
            $ref: "#/components/schemas/ErrorEnvelope"
    PrivatePing:
      description: "Доступность API."
      content:
        application/json:
          examples:
            ready:
              $ref: "#/components/examples/QuickstartPing"
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: object
                    required: [status, site_name, time]
                    properties:
                      status:
                        type: string
                      site_name:
                        type: string
                      time:
                        type: string
                        format: date-time
    OrderStatuses:
      description: "Справочник статусов заявок."
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: object
                    required: [statuses]
                    properties:
                      statuses:
                        type: array
                        items:
                          $ref: "#/components/schemas/OrderStatusDictionaryItem"
    WebhookEndpointResult:
      description: "Зарегистрированный endpoint вебхука."
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: object
                    required: [endpoint]
                    properties:
                      endpoint:
                        $ref: "#/components/schemas/WebhookEndpoint"
    WebhookDeleteResult:
      description: "Удалённый endpoint вебхука."
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: object
                    required: [id, deleted]
                    properties:
                      id:
                        type: string
                      deleted:
                        const: true
    OrderResult:
      description: "Актуальная заявка после операции."
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: object
                    required: [order]
                    properties:
                      order:
                        $ref: "#/components/schemas/Order"
    OrderStatusResult:
      description: "Актуальная заявка и статус."
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: object
                    required: [status, order]
                    properties:
                      status:
                        $ref: "#/components/schemas/OrderState"
                      order:
                        $ref: "#/components/schemas/Order"
    OrderVerificationSubmitResult:
      description: "Отправленные верификации и актуальные требования."
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: object
                    required: [submitted, requirements]
                    properties:
                      submitted:
                        type: [object, array]
                        properties:
                          identity:
                            $ref: "#/components/schemas/IdentityVerification"
                          card:
                            $ref: "#/components/schemas/CardVerification"
                      requirements:
                        $ref: "#/components/schemas/VerificationRequirements"
    UploadIntentResult:
      description: "Актуальный upload intent."
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: object
                    required: [upload_intent]
                    properties:
                      upload_intent:
                        $ref: "#/components/schemas/UploadIntent"
    VerificationRequirementsResult:
      description: "Актуальные требования верификации."
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: object
                    required: [requirements]
                    properties:
                      requirements:
                        $ref: "#/components/schemas/VerificationRequirements"
    IdentityVerificationResult:
      description: "Верификация личности клиента."
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: object
                    required: [verification]
                    properties:
                      verification:
                        $ref: "#/components/schemas/IdentityVerification"
    VerificationActions:
      description: "Доступные действия верификации."
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: object
                    required: [actions]
                    properties:
                      actions: { $ref: "#/components/schemas/VerificationActionState" }
    SandboxSimulation:
      description: "Симуляция и ID связанного вебхука."
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: object
                    required: [simulation]
                    properties:
                      simulation:
                        type: object
                        required: [id, will_create_order, created_task_id, preflight, event_id]
                        properties:
                          id:
                            type: string
                            format: uuid
                          will_create_order:
                            const: false
                          created_task_id:
                            type: "null"
                          preflight:
                            $ref: "#/components/schemas/ExchangeOrderPreflight"
                          event_id:
                            type: string
                            format: uuid
    OrdersResult:
      description: "Заявки клиента."
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: array
                    items:
                      $ref: "#/components/schemas/Order"
    OwnedOrderResult:
      description: "Заявка клиента."
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    $ref: "#/components/schemas/Order"
    PartnerResult:
      description: "Профиль партнёра, баланс и статистика."
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: object
                    required: [partner, referral_link, program, balance, statistics]
                    properties:
                      partner: { $ref: "#/components/schemas/PartnerProfile" }
                      referral_link: { $ref: "#/components/schemas/PartnerReferralLink" }
                      program: { anyOf: [{ $ref: "#/components/schemas/PartnerProgram" }, { type: "null" }] }
                      balance: { $ref: "#/components/schemas/PartnerBalance" }
                      statistics:
                        $ref: "#/components/schemas/PartnerStatistics"
    PartnerStatisticsResult:
      description: "Баланс и статистика партнёра."
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: object
                    required: [balance, statistics]
                    properties:
                      balance: { $ref: "#/components/schemas/PartnerBalance" }
                      statistics:
                        $ref: "#/components/schemas/PartnerStatistics"
    PartnerReferralsResult:
      description: "Привлечённые клиенты."
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: array
                    items:
                      $ref: "#/components/schemas/PartnerReferral"
    PartnerExchangesResult:
      description: "Партнёрские начисления за обмены."
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: array
                    items:
                      $ref: "#/components/schemas/PartnerExchange"
    PartnerPayoutMethods:
      description: "Доступный баланс и способы выплаты."
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: object
                    required: [balance, confirmation_required, methods]
                    properties:
                      balance:
                        type: object
                        required: [available, currency, minimum_payout, can_request, precision]
                        properties:
                          available:
                            type: string
                          currency:
                            type: string
                          minimum_payout:
                            type: string
                          can_request:
                            type: boolean
                          precision:
                            type: integer
                      confirmation_required:
                        type: boolean
                      methods:
                        type: array
                        items:
                          $ref: "#/components/schemas/PartnerPayoutMethod"
    PartnerPayouts:
      description: "Заявки на партнёрские выплаты."
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: array
                    items:
                      $ref: "#/components/schemas/PartnerPayout"
    PartnerPayoutDetail:
      description: "Заявка на партнёрскую выплату и статус подтверждения."
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: object
                    required: [payout, confirmation_required]
                    properties:
                      payout:
                        $ref: "#/components/schemas/PartnerPayout"
                      confirmation_required:
                        type: boolean
    PaymentInstructions:
      description: "Актуальные инструкции по оплате."
      headers:
        Cache-Control:
          schema:
            type: string
            example: "private, no-store"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: object
                    required: [payment_instructions]
                    properties:
                      payment_instructions:
                        $ref: "#/components/schemas/ExchangePaymentInstructions"
    PaymentInstructionsPreparation:
      description: "Состояние подготовки без реквизитов."
      headers:
        Cache-Control:
          schema:
            type: string
            example: "private, no-store"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/SuccessEnvelope"
              - type: object
                properties:
                  result:
                    type: object
                    required: [payment_instructions]
                    properties:
                      payment_instructions:
                        $ref: "#/components/schemas/ExchangePaymentInstructionsPreparation"
    Success:
      description: 'Стандартная оболочка успешного ответа.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SuccessEnvelope'
    Error:
      description: 'Стандартная оболочка ошибки.'
      headers:
        Retry-After:
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    RateLimited:
      description: >-
        При rate_limit_exceeded выдержите паузу Retry-After перед следующим запросом.
        При quota_exceeded время окончания периода доступно в error.details.resets_at.
      headers:
        Retry-After:
          description: Оставшиеся секунды текущего окна ограничения запросов, если заголовок передан.
          schema:
            type: string
            example: "12"
      content:
        application/json:
          examples:
            rateLimited:
              $ref: "#/components/examples/QuickstartRateLimited"
            quotaExceeded:
              $ref: "#/components/examples/QuickstartQuotaExceeded"
          schema:
            $ref: "#/components/schemas/ErrorEnvelope"
    InvalidExchangeInput:
      description: >-
        Не удалось проверить данные запроса. Найдите ошибки полей в error.details.issues и отправьте исправленные данные.
      content:
        application/json:
          examples:
            invalidAmount:
              $ref: "#/components/examples/QuickstartInvalidAmount"
          schema:
            $ref: "#/components/schemas/ErrorEnvelope"
    InvalidWebhookTestInput:
      description: >-
        Не удалось проверить тестовый запрос. Неизвестный тип образца отмечается в поле event_type.
      content:
        application/json:
          examples:
            unsupportedEvent:
              $ref: "#/components/examples/QuickstartUnsupportedWebhookEvent"
          schema:
            $ref: "#/components/schemas/ErrorEnvelope"
  examples:
    QuickstartPing:
      summary: 'Bearer-токен и HMAC v2 приняты'
      value:
        state: 0
        message: OK
        meta:
          request_id: ccdd84f4-2195-410f-96fe-6faff1e73a46
          correlation_id: ccdd84f4-2195-410f-96fe-6faff1e73a46
          timestamp: '2026-11-21T18:40:40.613566Z'
        result:
          status: ok
          site_name: iEXExchanger
          time: '2026-11-21T21:40:40+03:00'
    QuickstartSignatureRequired:
      summary: 'Действительный Bearer-токен без обязательных заголовков HMAC'
      value:
        state: 1
        message: 'HMAC signature is required for this API token.'
        code: 401
        meta:
          request_id: 1b2e3571-013b-4305-bdcf-1d53bb1cdaee
          correlation_id: 1b2e3571-013b-4305-bdcf-1d53bb1cdaee
          timestamp: '2026-11-21T18:40:40.675585Z'
        error:
          code: signature_required
          type: signature_required
          details:
            headers:
              - X-Api-Timestamp
              - X-Api-Nonce
              - X-Api-Signature
              - X-Api-Signature-Version
            algorithm: hmac-sha256-v2
    QuickstartQuoteInput:
      summary: 'Рассчитать сумму получения'
      value:
        route_id: 2
        amount: '10'
    QuickstartQuote:
      summary: 'Котировка и свежий снимок направления'
      value:
        state: 0
        message: OK
        meta:
          request_id: b5bf257b-373f-4d1b-8842-b61331206933
          correlation_id: b5bf257b-373f-4d1b-8842-b61331206933
          timestamp: '2026-11-21T18:40:40.773602Z'
        result:
          quote:
            route:
              id: 2
              status: 1
              is_enabled: true
              name: rates-fixture-4b15f06d-43c4-43d4-b5fb-de0981f88c1a
              from:
                id: 3
                payment: 'Rates fixture give'
                code: RFTHDDNAALAOP60
                designation: null
                small_code: null
                network: null
                network_out: null
                decimal: 4
              to:
                id: 4
                payment: 'Rates fixture receive'
                code: RFTWN6MSUG0SAFV
                designation: null
                small_code: null
                network: null
                network_out: null
                decimal: 4
              limits:
                min_give: '0'
                max_give: '0'
                min_receive: '0'
                max_receive: '0'
              rate:
                type: fixed
                course: '0'
                is_type_rate: false
                default_type_rate: 0
                modes: []
              features:
                requires_payment_request: false
                is_hidden_order_pay: false
                allow_export: false
              sorting:
                from: 0
                to: 0
              timestamps:
                created_at: '2026-11-21T21:39:37+03:00'
                updated_at: '2026-11-21T21:39:37+03:00'
            amounts:
              give: '10'
              receive: '12.5'
            components: []
            rate:
              display: '1 RFTHDDNAALAOP60 = 1.25 RFTWN6MSUG0SAFV'
              value: '1.25'
              source: calculation
              selected: null
              modes: []
            base_rate:
              display: '1 RFTHDDNAALAOP60 = 1.25 RFTWN6MSUG0SAFV'
              value: '1.25'
              selected: null
              modes: []
              source: direction
              note: 'Base direction rate without the selected city, selector fees, checkbox fees or card verification surcharges. Personal client discounts are already included.'
            adjustments:
              city_id: null
              selected_fee_type: null
              selected_fees: []
              selector_fees: []
              checkbox_fees: []
              card_verification_required: false
            selector_fees:
              mode: single
              options: []
            promo:
              applied: false
              base_receive_amount: '12.5'
            task_payload:
              course_float: '1.25'
              course_display: '1 RFTHDDNAALAOP60 = 1.25 RFTWN6MSUG0SAFV'
              course_float_fixed: '1.25'
              course_display_fixed: '1 RFTHDDNAALAOP60 = 1.25 RFTWN6MSUG0SAFV'
              give_price: '10'
              receiving_price: '12.5'
              amounts_payload:
                version: v1
                components: []
                meta:
                  source: calculation_result
                  components_count: 0
                  commission_mode: apply_to_base
                  market_rate: '1.25'
                  rate_source: 'Manual rate'
          snapshot:
            version: route-snapshot-v1
            route_id: 2
            hash: 626062a83e6f6a4b902a8cc5a216b7749c2e4df2f1ef42ebf71383dd4697c340
            generated_at: '2026-11-21T18:40:40.772775Z'
            expires_at: '2026-11-21T18:50:40.772775Z'
            expiry_signature: a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1
            fingerprint:
              route_updated_at: '2026-11-21T18:39:37.000000Z'
              from_currency_updated_at: '2026-11-21T18:39:37.000000Z'
              to_currency_updated_at: '2026-11-21T18:39:37.000000Z'
    QuickstartInvalidAmount:
      summary: 'В поле amount передано не число'
      value:
        state: 1
        message: 'The submitted data is invalid.'
        code: 422
        meta:
          request_id: bf1bb5c8-8c96-4196-89d1-c5482058a985
          correlation_id: bf1bb5c8-8c96-4196-89d1-c5482058a985
          timestamp: '2026-11-21T18:40:40.883808Z'
        error:
          code: validation_failed
          type: validation_failed
          details:
            fields:
              amount:
                - 'The amount field must be a number.'
            issues:
              -
                field: amount
                code: validation_failed
                message: 'The amount field must be a number.'
    QuickstartOrderInput:
      summary: 'Данные для preflight и создания заявки'
      description: 'Замените весь снимок из примера на снимок из вашего расчёта.'
      value:
        route_id: 2
        amount: '10'
        from_requisite: SANDBOX-DEMO-SOURCE
        to_requisite: SANDBOX-DEMO-DESTINATION
        snapshot:
          version: route-snapshot-v1
          route_id: 2
          hash: 626062a83e6f6a4b902a8cc5a216b7749c2e4df2f1ef42ebf71383dd4697c340
          generated_at: '2026-11-21T18:40:40.772775Z'
          expires_at: '2026-11-21T18:50:40.772775Z'
          expiry_signature: a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1
          fingerprint:
            route_updated_at: '2026-11-21T18:39:37.000000Z'
            from_currency_updated_at: '2026-11-21T18:39:37.000000Z'
            to_currency_updated_at: '2026-11-21T18:39:37.000000Z'
    QuickstartPreflight:
      summary: 'Локальные проверки пройдены. Можно создавать заявку'
      value:
        state: 0
        message: OK
        meta:
          request_id: 41819aaa-fdd6-477a-942d-d71d5a8281f4
          correlation_id: 41819aaa-fdd6-477a-942d-d71d5a8281f4
          timestamp: '2026-11-21T18:40:41.057286Z'
        result:
          preflight:
            allowed: true
            can_create_order: true
            missing_fields: []
            validation_errors: {}
            validation_issues: []
            checks:
              local: passed
              external: deferred
            quote:
              route:
                id: 2
                status: 1
                is_enabled: true
                name: rates-fixture-4b15f06d-43c4-43d4-b5fb-de0981f88c1a
                from:
                  id: 3
                  payment: 'Rates fixture give'
                  code: RFTHDDNAALAOP60
                  designation: null
                  small_code: null
                  network: null
                  network_out: null
                  decimal: 4
                to:
                  id: 4
                  payment: 'Rates fixture receive'
                  code: RFTWN6MSUG0SAFV
                  designation: null
                  small_code: null
                  network: null
                  network_out: null
                  decimal: 4
                limits:
                  min_give: '0'
                  max_give: '0'
                  min_receive: '0'
                  max_receive: '0'
                rate:
                  type: fixed
                  course: '0'
                  is_type_rate: false
                  default_type_rate: 0
                  modes: []
                features:
                  requires_payment_request: false
                  is_hidden_order_pay: false
                  allow_export: false
                sorting:
                  from: 0
                  to: 0
                timestamps:
                  created_at: '2026-11-21T21:39:37+03:00'
                  updated_at: '2026-11-21T21:39:37+03:00'
              amounts:
                give: '10'
                receive: '12.5'
              components: []
              rate:
                display: '1 RFTHDDNAALAOP60 = 1.25 RFTWN6MSUG0SAFV'
                value: '1.25'
                source: calculation
                selected: null
                modes: []
              base_rate:
                display: '1 RFTHDDNAALAOP60 = 1.25 RFTWN6MSUG0SAFV'
                value: '1.25'
                selected: null
                modes: []
                source: direction
                note: 'Base direction rate without the selected city, selector fees, checkbox fees or card verification surcharges. Personal client discounts are already included.'
              adjustments:
                city_id: null
                selected_fee_type: null
                selected_fees: []
                selector_fees: []
                checkbox_fees: []
                card_verification_required: false
              selector_fees:
                mode: single
                options: []
              promo:
                applied: false
                base_receive_amount: '12.5'
              task_payload:
                course_float: '1.25'
                course_display: '1 RFTHDDNAALAOP60 = 1.25 RFTWN6MSUG0SAFV'
                course_float_fixed: '1.25'
                course_display_fixed: '1 RFTHDDNAALAOP60 = 1.25 RFTWN6MSUG0SAFV'
                give_price: '10'
                receiving_price: '12.5'
                amounts_payload:
                  version: v1
                  components: []
                  meta:
                    source: calculation_result
                    components_count: 0
                    commission_mode: apply_to_base
                    market_rate: '1.25'
                    rate_source: 'Manual rate'
            operation_contract:
              version: operation-contract-v1
              route:
                id: 2
                status: 1
                is_enabled: true
                name: rates-fixture-4b15f06d-43c4-43d4-b5fb-de0981f88c1a
                from:
                  id: 3
                  payment: 'Rates fixture give'
                  code: RFTHDDNAALAOP60
                  designation: null
                  small_code: null
                  network: null
                  network_out: null
                  decimal: 4
                to:
                  id: 4
                  payment: 'Rates fixture receive'
                  code: RFTWN6MSUG0SAFV
                  designation: null
                  small_code: null
                  network: null
                  network_out: null
                  decimal: 4
                limits:
                  min_give: '0'
                  max_give: '0'
                  min_receive: '0'
                  max_receive: '0'
                rate:
                  type: fixed
                  course: '0'
                  is_type_rate: false
                  default_type_rate: 0
                  modes: []
                features:
                  requires_payment_request: false
                  is_hidden_order_pay: false
                  allow_export: false
                sorting:
                  from: 0
                  to: 0
                timestamps:
                  created_at: '2026-11-21T21:39:37+03:00'
                  updated_at: '2026-11-21T21:39:37+03:00'
              operation:
                id: 2
                type: direction_exchange
                attributes:
                  course:
                    rate: '1.25'
                    cities: []
                    exchange_amount: []
                    exchange_amount_basis: give
                    type_rate: []
                    selector_fees: []
                  min_in: '0'
                  max_in: '0'
                  min_out: '0'
                  max_out: '0'
                  limit_rules:
                    min_in:
                      value: '0'
                      source: base
                      is_limited: false
                    max_in:
                      value: '0'
                      source: base
                      is_limited: false
                    min_out:
                      value: '0'
                      source: base
                      is_limited: false
                    max_out:
                      value: '0'
                      source: base
                      is_limited: false
                  sorting_out: 0
                  buy_currency:
                    id: 3
                    type: payment_system
                    attributes:
                      name: 'Rates fixture give'
                      first_char: null
                      tech_name: ''
                      payment_system: 'Rates fixture give'
                      letter_cod: null
                      short_code: null
                      with_currency_code: 0
                      currency_iso_code: RFTHDDNAALAOP60
                      is_iso_code: 0
                      default_value: '1'
                      income_enabled: 0
                      outcome_enabled: 0
                      valid_type_in: null
                      valid_type_out: null
                      sorting_reserve: null
                      display_scan_qr_from: 0
                      display_scan_qr_to: 0
                      outcome_fee: 0
                      aml_text_in: null
                      aml_text_out: null
                      formalization_text: null
                      amount_decimal: 4
                      income_notice: null
                      outcome_notice: null
                      icon_url: null
                      icon_url_path: /storage/payment_systems/
                      color: ''
                      filter_ids: []
                      currency:
                        symbol: RFTHDDNAALAOP60
                        sorting: 0
                      order_form_fields:
                        field_type: string
                        label_in: null
                        label_out: null
                      mask_in: null
                      mask_out: null
                      mask_placeholder_in: null
                      mask_placeholder_out: null
                      field_comment_in: null
                      field_comment_out: null
                      button_create_order: null
                      button_create_order_text: null
                      recount_course_text: null
                      income_form_fields: []
                      outcome_form_fields: []
                      extra_out:
                        enabled: false
                  sell_currency:
                    id: 4
                    type: payment_system
                    attributes:
                      name: 'Rates fixture receive'
                      first_char: null
                      tech_name: ''
                      payment_system: 'Rates fixture receive'
                      letter_cod: null
                      short_code: null
                      with_currency_code: 0
                      currency_iso_code: RFTWN6MSUG0SAFV
                      is_iso_code: 0
                      default_value: '1'
                      income_enabled: 0
                      outcome_enabled: 0
                      valid_type_in: null
                      valid_type_out: null
                      sorting_reserve: null
                      display_scan_qr_from: 0
                      display_scan_qr_to: 0
                      outcome_fee: 0
                      aml_text_in: null
                      aml_text_out: null
                      formalization_text: null
                      amount_decimal: 4
                      income_notice: null
                      outcome_notice: null
                      icon_url: null
                      icon_url_path: /storage/payment_systems/
                      color: ''
                      filter_ids: []
                      currency:
                        symbol: RFTWN6MSUG0SAFV
                        sorting: 0
                      order_form_fields:
                        field_type: string
                        label_in: null
                        label_out: null
                      mask_in: null
                      mask_out: null
                      mask_placeholder_in: null
                      mask_placeholder_out: null
                      field_comment_in: null
                      field_comment_out: null
                      button_create_order: null
                      button_create_order_text: null
                      recount_course_text: null
                      income_form_fields: []
                      outcome_form_fields: []
                      extra_out:
                        enabled: false
                  direction_fields: []
                  user_fields: []
                  reserve_value: '100000'
                  is_user_discount: false
                  extra_commissions: []
                  is_notify_exchange_amount: 0
                  amount_range:
                    basis: give
                    ranges: []
                  prices: []
                  cities: []
                  city_detail: []
                  default_city_id: null
                  seo:
                    title: ''
                    description: ''
                    keywords: ''
                  checkbox_agreements: []
                  customer_notifications: []
                  identity_verification:
                    mode: disabled
                    description: null
                  card_verification:
                    mode: 0
                    description: null
              snapshot:
                version: route-snapshot-v1
                route_id: 2
                hash: 626062a83e6f6a4b902a8cc5a216b7749c2e4df2f1ef42ebf71383dd4697c340
                generated_at: '2026-11-21T18:40:41.046909Z'
                expires_at: '2026-11-21T18:50:41.046909Z'
                expiry_signature: a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1
                fingerprint:
                  route_updated_at: '2026-11-21T18:39:37.000000Z'
                  from_currency_updated_at: '2026-11-21T18:39:37.000000Z'
                  to_currency_updated_at: '2026-11-21T18:39:37.000000Z'
              contract:
                preflight_endpoint: /api/v3/private/exchange/orders/preflight
                quote_endpoint: /api/v3/private/exchange/quotes
                order_endpoint: /api/v3/private/exchange/orders
                status_endpoint: '/api/v3/private/exchange/orders/{order}/status'
                actions_endpoint: '/api/v3/private/exchange/orders/{order}/actions'
                payment_instructions_endpoint: '/api/v3/private/exchange/orders/{order}/payment-instructions'
                amount_side: give
                currency_fields:
                  - route_id
                  - income_payment_system
                  - outcome_payment_system
                  - from_currency_id
                  - to_currency_id
                amount_fields:
                  - income_amount
                  - amount
                requisite_fields:
                  give:
                    - income_account
                    - from_requisite
                  receive:
                    - outcome_account
                    - to_requisite
                handover:
                  field: handover
                  city_field: city_id
                  methods:
                    - office
                    - courier
                    - agreement
                dynamic_fields:
                  direction_fields: []
                  fields_in: []
                  fields_out: []
                  user_fields: []
                  checkbox_agreements: []
                rate:
                  selector: null
                  city_prices: []
                  selector_fees_title: null
                  selector_fees_text: null
                  selector_fees:
                    mode: single
                    options: []
                verification:
                  identity:
                    mode: disabled
                    description: null
                  card:
                    mode: 0
                    description: null
                  card_settings: null
                  requirements_endpoint: /api/v3/private/verifications/requirements
                files:
                  create_upload_intent_endpoint: /api/v3/private/files/upload-intents
                  commit_upload_intent_endpoint: '/api/v3/private/files/upload-intents/{intent}/commit'
                  order_field_upload_endpoint: '/api/v3/private/exchange/routes/{route}/fields/{group}/{field}/files'
                  receipts_endpoint: '/api/v3/private/exchange/orders/{order}/receipts'
                  receipts_allowed: false
            requirements:
              route_id: 2
              identity:
                required: false
                mode: disabled
                description: null
                current:
                  key: not_submitted
                  label: 'Not submitted'
                  is_final_approved: false
                flow: /api/v3/private/verifications/identity
                create_endpoint: /api/v3/private/verifications/identity
              card:
                required: false
                mode: 0
                description: null
                settings: null
                additional_photos:
                  enabled: false
                  max_count: 3
                  max_file_size_mb: 10
                  accepted_mime_types:
                    - image/jpeg
                    - image/png
                current:
                  key: not_submitted
                  label: 'Not submitted'
                  is_final_approved: false
                create_endpoint: /api/v3/private/verifications/cards
              files:
                upload_intent_endpoint: /api/v3/private/files/upload-intents
            snapshot:
              version: route-snapshot-v1
              route_id: 2
              hash: 626062a83e6f6a4b902a8cc5a216b7749c2e4df2f1ef42ebf71383dd4697c340
              generated_at: '2026-11-21T18:40:41.046909Z'
              expires_at: '2026-11-21T18:50:41.046909Z'
              expiry_signature: a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1
              fingerprint:
                route_updated_at: '2026-11-21T18:39:37.000000Z'
                from_currency_updated_at: '2026-11-21T18:39:37.000000Z'
                to_currency_updated_at: '2026-11-21T18:39:37.000000Z'
    QuickstartOrderCreated:
      summary: 'Заявка создана и ожидает оплаты'
      value:
        state: 0
        message: 'Order has been created.'
        meta:
          request_id: a7d0a4dd-75da-4547-9644-a23e8d194821
          correlation_id: a7d0a4dd-75da-4547-9644-a23e8d194821
          timestamp: '2026-11-21T18:40:41.268085Z'
        result:
          order:
            id: 5
            public_id: '2696843857965'
            tracking_id: 01a1ff69-1d03-7c35-aa9e-784a66d64f88
            cash_handover: null
            status:
              id: 2
              key: pending_payment
              name: PENDING_PAYMENT
              reason: null
              is_final: false
              is_payment_flow: true
              is_problem: false
            amounts:
              give: '10'
              receive: '12.5'
              rate: '1 RFTHDDNAALAOP60 = 1.25 RFTWN6MSUG0SAFV'
              give_with_commission: '0'
              receive_with_commission: '0'
            currencies:
              from:
                id: 3
                payment: 'Rates fixture give'
                code: RFTHDDNAALAOP60
                designation: null
                network: null
                network_out: null
                decimal: 4
              to:
                id: 4
                payment: 'Rates fixture receive'
                code: RFTWN6MSUG0SAFV
                designation: null
                network: null
                network_out: null
                decimal: 4
            direction:
              id: 2
              name: rates-fixture-4b15f06d-43c4-43d4-b5fb-de0981f88c1a
            customer:
              email: partner@example.test
              phone: null
              from_requisite: SANDBOX-DEMO-SOURCE
              to_requisite: SANDBOX-DEMO-DESTINATION
            payment:
              merchant_provider: null
              merchant_status: '0'
              payment_address: null
              is_wallet_issued: false
              timing:
                duration_seconds: 3600
                started_at: '2026-11-21T21:40:41+03:00'
                expires_at: '2026-11-21T22:40:41+03:00'
                remaining_seconds: 3600
                active: true
                overdue: false
                action: expire
                changes_status_on_expiry: true
                processed_at: null
                source: global
                version: 0
                is_snapshot: true
                server_time: '2026-11-21T21:40:41+03:00'
              request_timing: null
            flags:
              is_archive: false
              is_frozen: false
              is_new_user: false
              is_auto_check_payment: false
            timestamps:
              created_at: '2026-11-21T21:40:41+03:00'
              updated_at: '2026-11-21T21:40:41+03:00'
              started_at: null
              completed_at: null
              archived_at: null
    QuickstartOrderReplayed:
      summary: 'Сохранённая заявка, возвращённая с Idempotency-Replayed: true'
      value:
        state: 0
        message: 'Order has been created.'
        meta:
          request_id: 4a6d7dc7-c346-44e5-8b7a-f346e5af9891
          correlation_id: 4a6d7dc7-c346-44e5-8b7a-f346e5af9891
          timestamp: '2026-11-21T18:40:41.362093Z'
        result:
          order:
            id: 5
            public_id: '2696843857965'
            tracking_id: 01a1ff69-1d03-7c35-aa9e-784a66d64f88
            cash_handover: null
            status:
              id: 2
              key: pending_payment
              name: PENDING_PAYMENT
              reason: null
              is_final: false
              is_payment_flow: true
              is_problem: false
            amounts:
              give: '10'
              receive: '12.5'
              rate: '1 RFTHDDNAALAOP60 = 1.25 RFTWN6MSUG0SAFV'
              give_with_commission: '0'
              receive_with_commission: '0'
            currencies:
              from:
                id: 3
                payment: 'Rates fixture give'
                code: RFTHDDNAALAOP60
                designation: null
                network: null
                network_out: null
                decimal: 4
              to:
                id: 4
                payment: 'Rates fixture receive'
                code: RFTWN6MSUG0SAFV
                designation: null
                network: null
                network_out: null
                decimal: 4
            direction:
              id: 2
              name: rates-fixture-4b15f06d-43c4-43d4-b5fb-de0981f88c1a
            customer:
              email: partner@example.test
              phone: null
              from_requisite: SANDBOX-DEMO-SOURCE
              to_requisite: SANDBOX-DEMO-DESTINATION
            payment:
              merchant_provider: null
              merchant_status: '0'
              payment_address: null
              is_wallet_issued: false
              timing:
                duration_seconds: 3600
                started_at: '2026-11-21T21:40:41+03:00'
                expires_at: '2026-11-21T22:40:41+03:00'
                remaining_seconds: 3600
                active: true
                overdue: false
                action: expire
                changes_status_on_expiry: true
                processed_at: null
                source: global
                version: 0
                is_snapshot: true
                server_time: '2026-11-21T21:40:41+03:00'
              request_timing: null
            flags:
              is_archive: false
              is_frozen: false
              is_new_user: false
              is_auto_check_payment: false
            timestamps:
              created_at: '2026-11-21T21:40:41+03:00'
              updated_at: '2026-11-21T21:40:41+03:00'
              started_at: null
              completed_at: null
              archived_at: null
    QuickstartOrderInProgress:
      summary: 'Такой же запрос ещё выполняется'
      value:
        state: 1
        message: 'A request with this Idempotency-Key is already in progress.'
        code: 409
        meta:
          request_id: quickstart-order-in-progress
          correlation_id: quickstart-order-in-progress
          timestamp: '2026-11-21T18:40:00.000000Z'
        error:
          code: idempotency_in_progress
          type: idempotency_in_progress
          details:
            retry_after: 2
    QuickstartOrderConflict:
      summary: 'Ключ уже связан с другим запросом'
      value:
        state: 1
        message: 'The Idempotency-Key was already used with a different request.'
        code: 409
        meta:
          request_id: 52dcb1dc-e78c-4256-891a-388b7f0cb9f3
          correlation_id: 52dcb1dc-e78c-4256-891a-388b7f0cb9f3
          timestamp: '2026-11-21T18:40:41.450282Z'
        error:
          code: idempotency_conflict
          type: idempotency_conflict
          details: null
    QuickstartRateLimited:
      summary: 'Достигнут лимит частоты запросов'
      value:
        state: 1
        message: 'Too many API requests. Try again later.'
        code: 429
        meta:
          request_id: quickstart-request-rate
          correlation_id: quickstart-request-rate
          timestamp: '2026-11-21T18:40:00.000000Z'
        error:
          code: rate_limit_exceeded
          type: rate_limit_exceeded
          details:
            limit: 60
            retry_after: 12
    QuickstartQuotaExceeded:
      summary: 'Дневная квота исчерпана'
      value:
        state: 1
        message: 'The API quota for the current period has been exhausted.'
        code: 429
        meta:
          request_id: quickstart-request-quota
          correlation_id: quickstart-request-quota
          timestamp: '2026-11-21T18:40:00.000000Z'
        error:
          code: quota_exceeded
          type: quota_exceeded
          details:
            exceeded: true
            period: day
            limit: 1000
            used: 1000
            remaining: 0
            resets_at: '2026-11-22T00:00:00.000000Z'
    QuickstartWebhookTestInput:
      summary: 'Запросить тестовое уведомление для выбранной подписки'
      value:
        endpoint_id: 02f69097-6934-483e-b3c9-72767fdc4a6c
        event_type: order.payment_received
    QuickstartWebhookTest:
      summary: 'Тестовое событие и доставка поставлены в очередь'
      value:
        state: 0
        message: OK
        meta:
          request_id: bd34ec7e-8007-41a0-86d2-de8a30e63d85
          correlation_id: bd34ec7e-8007-41a0-86d2-de8a30e63d85
          timestamp: '2026-11-21T18:40:41.539921Z'
        result:
          event:
            id: 96da6cfd-7d0b-4c7d-a86c-845d24544baf
            type: api.test
            status: queued
            request_id: bd34ec7e-8007-41a0-86d2-de8a30e63d85
            correlation_id: bd34ec7e-8007-41a0-86d2-de8a30e63d85
          deliveries:
            -
              id: 9d338990-e7ef-4945-b2cb-0e50777b3561
              status: queued
              endpoint_id: 02f69097-6934-483e-b3c9-72767fdc4a6c
              payload_version: v2
              signature_version: v2
              retry_blocked_reason: null
    QuickstartUnsupportedWebhookEvent:
      summary: 'Тип события для образца неизвестен'
      value:
        state: 1
        message: 'The given data was invalid.'
        code: 422
        meta:
          request_id: quickstart-webhook-validation
          correlation_id: quickstart-webhook-validation
          timestamp: '2026-11-21T18:40:00.000000Z'
        error:
          code: validation_failed
          type: validation_failed
          details:
            event_type:
              - 'The selected event type is invalid.'
            fields:
              event_type:
                - 'The selected event type is invalid.'
            issues:
              -
                field: event_type
                code: validation_failed
                message: 'The selected event type is invalid.'
    QuickstartStatusChangedNotification:
      summary: 'Статус заявки изменился'
      value:
        id: 356b5b2e-ba7b-45c6-9be2-b00e21253723
        type: order.status_changed
        created_at: '2026-11-21T18:45:00.000000Z'
        request_id: quickstart-order-payment
        correlation_id: quickstart-order-payment
        payload_version: v2
        data:
          resource:
            type: order
            id: 01a1ff69-1d03-7c35-aa9e-784a66d64f88
          from_status: 2
          to_status: 3
    QuickstartTestNotification:
      summary: 'Исходящая доставка тестового события'
      value:
        created_at: '2026-11-21T18:40:41.539921Z'
        request_id: bd34ec7e-8007-41a0-86d2-de8a30e63d85
        correlation_id: bd34ec7e-8007-41a0-86d2-de8a30e63d85
        type: api.test
        test: true
        sample_of: order.payment_received
        payload_version: v2
        data:
          resource:
            type: api_test
            id: 02f69097-6934-483e-b3c9-72767fdc4a6c
        id: 96da6cfd-7d0b-4c7d-a86c-845d24544baf
  schemas:
    ExchangeDynamicFields:
      type: object
      properties:
        direction_fields:
          type: array
          items: { $ref: "#/components/schemas/ExchangeDynamicField" }
        fields_in:
          type: array
          items: { $ref: "#/components/schemas/ExchangeDynamicField" }
        fields_out:
          type: array
          items: { $ref: "#/components/schemas/ExchangeDynamicField" }
        user_fields:
          type: array
          items: { $ref: "#/components/schemas/ExchangeDynamicField" }
        checkbox_agreements:
          type: array
          items: { type: object }
    ExchangeDynamicField:
      type: object
      required: [key, type, required]
      properties:
        key: { type: string }
        type: { type: string }
        required: { type: boolean }
        show_label: { type: boolean }
        label: { type: string }
        placeholder: { type: string }
        description: { type: string }
        example:
          type: string
          description: Локализованный пример значения поля.
        content_type:
          type: string
          description: Формат вводимых данных для отображения поля.
        validation:
          type: object
          description: Подсказки для проверки на клиенте. Сервер применяет настроенные правила при создании заявки.
          properties:
            min_length: { type: integer, minimum: 1 }
            max_length: { type: integer, minimum: 1 }
            error_message: { type: string }
            remove_spaces: { type: boolean }
            has_validator_combination: { type: boolean }
            show_card_brand: { type: boolean }
            qr_wallet_schemes:
              type: array
              items: { type: string }
        display_scan_qr:
          type: boolean
          description: Включает сканер QR для валютного поля типа input, select или radio в клиентах с поддержкой сканирования.
        mask:
          type: string
          description: Маска ввода для текстового поля валюты.
        mask_placeholder:
          type: string
          minLength: 1
          maxLength: 1
          description: Символ, который обозначает незаполненную позицию маски.
        wallet_validator_type:
          type: string
          description: Тип серверной проверки реквизита в текстовом поле валюты.
        options:
          type: array
          items: { type: object }
        file:
          type: object
          properties:
            allowed_types: { type: array, items: { type: string } }
            allowed_extensions: { type: array, items: { type: string } }
            accept: { type: string }
            max_file_size_mb: { type: [integer, "null"] }
            max_files: { type: [integer, "null"] }
        upload:
          type: object
          properties:
            endpoint: { type: string }
            direction_id: { type: integer }
            field_id: { type: integer }
            scope: { type: string, enum: [currency, direction, user] }
            group: { type: string, enum: [in, out, direction, user] }
    PartnerExchangeListSummary:
      type: object
      required: [total, bonus_sum, currency, confirmed_accruals, by_currency]
      properties:
        total: { type: integer }
        bonus_sum: { type: string }
        currency: { type: [string, "null"] }
        confirmed_accruals: { type: integer }
        by_currency: { type: array, items: { $ref: "#/components/schemas/PartnerBonusCurrencySummary" } }
    PartnerPayoutListSummary:
      type: object
      required: [total, paid, pending, rejected]
      properties:
        total: { type: integer }
        paid: { type: integer }
        pending: { type: integer }
        rejected: { type: integer }
    IdentityVerificationRequirements:
      type: object
      required: [mode, current, form, handoff_url]
      properties:
        mode: { enum: [manual, provider, unavailable] }
        current:
          $ref: "#/components/schemas/VerificationStatus"
        form:
          anyOf:
            - $ref: "#/components/schemas/IdentityVerificationForm"
            - type: "null"
        handoff_url: { type: [string, "null"] }
    IdentityVerificationForm:
      type: object
      required: [id, name, description, purpose, version, fields, upload]
      properties:
        id: { type: [integer, "null"] }
        name: { type: string }
        description: { type: [string, "null"] }
        purpose: { type: string }
        version: { type: integer }
        fields:
          type: array
          items:
            $ref: "#/components/schemas/IdentityVerificationField"
        upload:
          type: object
          required: [purpose, endpoint, extensions, max_bytes]
          properties:
            purpose: { const: identity_verification }
            endpoint: { type: string }
            extensions: { type: array, items: { type: string } }
            max_bytes: { type: integer }
    IdentityVerificationField:
      type: object
      required: [key, type, label, placeholder, help_text, required, sort, options, validation]
      properties:
        key: { type: string }
        type: { enum: [input, description, textarea, email, phone, date, select, file, image, multi_file] }
        label: { type: string }
        placeholder: { type: [string, "null"] }
        help_text: { type: [string, "null"] }
        required: { type: boolean }
        sort: { type: integer }
        options:
          type: array
          items:
            type: object
            required: [label, value]
            properties:
              label: { type: string }
              value: { type: string }
        validation:
          type: [object, array]
          properties:
            min: { type: [integer, "null"] }
            max: { type: integer }
            regex: { type: [string, "null"] }
            mimes: { type: array, items: { type: string } }
            max_mb: { type: integer }
            max_files: { type: integer }
    ApiErrorDetails:
      type: [object, array, "null"]
      maxItems: 0
      items: {}
      properties:
        fields:
          type: object
          additionalProperties:
            type: array
            items: { type: string }
        issues:
          type: array
          items:
            $ref: "#/components/schemas/ApiIssue"
        required_scopes:
          type: array
          items: { type: string }
        retry_after: { type: [integer, "null"], minimum: 0 }
        period: { enum: [day, month] }
        limit: { type: [integer, "null"] }
        used: { type: integer }
        remaining: { type: [integer, "null"] }
        resets_at: { type: [string, "null"], format: date-time }
        reason: { type: [string, "null"] }
        is_banned: { type: boolean }
        ends_at: { type: [string, "null"], format: date-time }
        idempotency_key: { type: string }
        message: { type: string }
        cost: { type: [object, "null"] }
        headers:
          type: array
          items: { type: string }
          description: Заголовки, нужные для проверки подписи. При ошибке подписи v2 список включает X-Api-Signature-Version.
        algorithm: { type: string }
        ip: { type: [string, "null"] }
        max: { type: integer }
        locked_until: { type: [string, "null"], format: date-time }
        exceeded: { type: boolean }
    ApiIssue:
      type: object
      required: [field, code, message]
      properties:
        field: { type: [string, "null"] }
        code: { type: string }
        message: { type: string }
        severity: { enum: [error, warning, info] }
        meta: { type: [object, array] }
    PreflightChecks:
      type: object
      required: [local, external]
      properties:
        local: { enum: [passed, failed, not_run] }
        external: { const: deferred }
    RouteCapabilityAction:
      type: object
      required: [available, method, endpoint, scope]
      properties:
        available: { type: boolean }
        authorized: { type: [boolean, "null"] }
        method: { type: string }
        endpoint: { type: string }
        scope: { type: string }
        required_scopes_any:
          type: array
          items: { type: string }
    RouteCapabilityField:
      type: object
      required: [key, required, type, source]
      properties:
        key: { type: string }
        required: { type: boolean }
        type: { type: string }
        source: { type: string }
        aliases:
          type: array
          items: { type: string }
        alternatives:
          type: array
          items: { type: string }
        allowed:
          type: array
          items: { type: [string, integer] }
        schema: { type: [object, array] }
    ExchangeOrderIdentity:
      type: object
      required: [public_id, tracking_id]
      properties:
        public_id: { type: string }
        tracking_id: { type: [string, "null"] }
    ExchangeOrderStatusSummary:
      type: object
      required: [order, status, updated_at]
      properties:
        order:
          $ref: "#/components/schemas/ExchangeOrderIdentity"
        status:
          $ref: "#/components/schemas/OrderState"
        updated_at: { type: [string, "null"], format: date-time }
    ExchangeOrderPaymentStatus:
      type: object
      required: [order, payment]
      properties:
        order:
          $ref: "#/components/schemas/ExchangeOrderIdentity"
        payment:
          type: object
          required: [checking, provider_confirmed, provider_confirmed_at, current_status, timeline, timeline_truncated]
          properties:
            checking: { type: boolean }
            provider_confirmed: { type: boolean }
            provider_confirmed_at: { type: [string, "null"], format: date-time }
            current_status:
              type: [object, "null"]
              required: [key, value, updated_at]
              properties:
                key: { type: string }
                value: { type: integer }
                updated_at: { type: [string, "null"], format: date-time }
            timeline:
              type: array
              items:
                $ref: "#/components/schemas/OrderPaymentTimelineItem"
            timeline_truncated: { type: boolean }
    OrderPaymentTimelineItem:
      type: object
      required: [key, status_value, state, occurred_at]
      properties:
        key: { type: string }
        status_value: { type: [integer, "null"] }
        state: { enum: [todo, active, done, warning, error] }
        occurred_at: { type: [string, "null"], format: date-time }
    ExchangeOrderReceipt:
      type: object
      required: [id, mime_type, size_bytes, created_at]
      properties:
        id: { type: integer }
        mime_type: { type: [string, "null"] }
        size_bytes: { type: [integer, "null"] }
        created_at: { type: [string, "null"], format: date-time }
    ExchangeOrderReceipts:
      type: object
      required: [receipts, next_after_id]
      properties:
        receipts:
          type: array
          items:
            $ref: "#/components/schemas/ExchangeOrderReceipt"
        next_after_id: { type: [integer, "null"] }
    OrderFieldUpload:
      type: object
      required: [token, public_id, name, extension, mime_type, size_bytes, expires_at]
      properties:
        token: { type: string }
        public_id: { type: string }
        name: { type: string }
        extension: { type: string }
        mime_type: { type: string }
        size_bytes: { type: integer }
        expires_at: { type: string, format: date-time }
    WebhookPayloadVersion:
      type: string
      const: v2
    WebhookNotificationV2:
      type: object
      required: [id, type, created_at, request_id, correlation_id, payload_version, data]
      properties:
        id: { type: string, format: uuid }
        type: { type: string }
        created_at: { type: string, format: date-time }
        request_id: { type: string }
        correlation_id: { type: string }
        payload_version: { const: v2 }
        data:
          type: object
          required: [resource]
          additionalProperties: false
          properties:
            resource:
              type: object
              required: [type, id]
              additionalProperties: false
              properties:
                type: { type: [string, "null"] }
                id: { type: [string, "null"] }
            from_status: { type: integer }
            to_status: { type: integer }
        test: { const: true }
        sample_of: { type: string }
    ApiErrorCode:
      type: string
      enum:
        - authentication_required
        - api_token_required
        - api_disabled
        - site_maintenance
        - api_user_disabled
        - account_banned
        - verification_protection
        - api_admin_account_denied
        - ip_not_allowed
        - scope_denied
        - rate_limit_exceeded
        - signature_required
        - invalid_signature
        - signature_expired
        - signature_replay
        - not_found
        - method_not_allowed
        - validation_failed
        - invalid_filter
        - invalid_cursor
        - invalid_scope
        - token_not_found
        - token_inactive
        - quota_exceeded
        - idempotency_conflict
        - idempotency_in_progress
        - invalid_idempotency_key
        - webhook_endpoint_limit_exceeded
        - webhook_endpoint_not_found
        - http_error
        - server_error
    PartnerProfile:
      type: object
      required: [id, name, email, method, personal_percent, max_percent]
      properties:
        id: { type: integer }
        name: { type: string }
        email: { type: string }
        method: { type: integer }
        personal_percent: { type: number }
        max_percent: { type: number }
    PartnerReferralLink:
      type: object
      required: [id, code, url, created_at]
      properties:
        id: { type: [integer, "null"] }
        code: { type: [string, "null"] }
        url: { type: [string, "null"] }
        created_at: { type: [string, "null"], format: date-time }
    PartnerProgram:
      type: object
      required: [id, name, title, description, percent, minimum_accrual]
      properties:
        id: { type: integer }
        name: { type: [string, "null"] }
        title: { type: [string, "null"] }
        description: { type: [string, "null"] }
        percent: { type: number }
        minimum_accrual: { type: string }
    PartnerBalance:
      type: object
      required: [available, hold, currency]
      properties:
        available: { type: string }
        hold: { type: string }
        currency: { type: string }
    PartnerReferral:
      type: object
      required: [id, client, orders, created_at]
      properties:
        id: { type: integer }
        client: { anyOf: [{ $ref: "#/components/schemas/PartnerReferralClient" }, { type: "null" }] }
        orders:
          type: object
          required: [total, completed, last_completed_at]
          properties:
            total: { type: integer }
            completed: { type: integer }
            last_completed_at: { type: [string, "null"], format: date-time }
        created_at: { type: [string, "null"], format: date-time }
    PartnerExchange:
      type: object
      required: [id, status, is_reversal, reversal_of_id, bonus, order, client, available_at, confirmed_at, reversed_at, created_at]
      properties:
        id: { type: integer }
        status: { type: string }
        is_reversal: { type: boolean }
        reversal_of_id: { type: [integer, "null"] }
        bonus:
          type: object
          required: [amount, currency, percent]
          properties:
            amount: { type: string }
            currency: { type: [string, "null"] }
            percent: { type: string }
        order: { anyOf: [{ $ref: "#/components/schemas/PartnerExchangeOrder" }, { type: "null" }] }
        client: { anyOf: [{ $ref: "#/components/schemas/PartnerExchangeClient" }, { type: "null" }] }
        available_at: { type: [string, "null"], format: date-time }
        confirmed_at: { type: [string, "null"], format: date-time }
        reversed_at: { type: [string, "null"], format: date-time }
        created_at: { type: [string, "null"], format: date-time }
    PartnerExchangeOrder:
      type: object
      required: [id, public_id, status_id, amount_in, amount_out, rate]
      properties:
        id: { type: integer }
        public_id: { type: string }
        status_id: { type: integer }
        amount_in: { type: string }
        amount_out: { type: string }
        rate: { type: [string, "null"] }
    PartnerReferralClient:
      type: object
      required: [id, name, email, created_at]
      properties:
        id: { type: integer }
        name: { type: string }
        email: { type: string }
        created_at: { type: [string, "null"], format: date-time }
    PartnerExchangeClient:
      type: object
      required: [id, name, email]
      properties:
        id: { type: integer }
        name: { type: string }
        email: { type: string }
    PartnerPayoutStatistics:
      type: object
      required: [total, paid, pending, rejected, paid_amount, pending_amount, paid_currency, pending_currency, by_currency]
      properties:
        total: { type: integer }
        paid: { type: integer }
        pending: { type: integer }
        rejected: { type: integer }
        paid_amount: { type: string }
        pending_amount: { type: string }
        paid_currency: { type: [string, "null"] }
        pending_currency: { type: [string, "null"] }
        by_currency: { type: array, items: { $ref: "#/components/schemas/PartnerPayoutCurrencySummary" } }
    PartnerBonusCurrencySummary:
      type: object
      required: [currency, bonus_sum, confirmed_accruals]
      properties:
        currency: { type: [string, "null"] }
        bonus_sum: { type: string }
        confirmed_accruals: { type: integer }
    PartnerLedgerStatistics:
      type: object
      required: [referral_total_earned, referral_total_withdrawn, total_earned, total_withdrawn]
      properties:
        referral_total_earned: { type: string }
        referral_total_withdrawn: { type: string }
        total_earned: { type: string }
        total_withdrawn: { type: string }
    VerificationActionState:
      type: object
      required: [status, allowed_actions]
      properties:
        status: { $ref: "#/components/schemas/VerificationStatus" }
        allowed_actions:
          type: object
          required: [wait_review, resubmit_after_reject]
          properties:
            wait_review:
              type: object
              required: [allowed]
              properties:
                allowed: { type: boolean }
            resubmit_after_reject:
              type: object
              required: [allowed]
              properties:
                allowed: { type: boolean }
    OrderPaymentTiming:
      type: object
      required: [duration_seconds, started_at, expires_at, remaining_seconds, active, overdue, action, changes_status_on_expiry, processed_at, source, version, is_snapshot, server_time]
      properties:
        duration_seconds: { type: integer }
        started_at: { type: [string, "null"], format: date-time }
        expires_at: { type: [string, "null"], format: date-time }
        remaining_seconds: { type: [integer, "null"] }
        active: { type: boolean }
        overdue: { type: boolean }
        action: { type: string }
        changes_status_on_expiry: { type: boolean }
        processed_at: { type: [string, "null"], format: date-time }
        source: { type: string }
        version: { type: integer }
        is_snapshot: { type: boolean }
        server_time: { type: string, format: date-time }
    OrderRequestPaymentTiming:
      type: object
      required: [mode, is_planned, requires_operator_plan, timer_start, wait_minutes, wait_total_seconds, wait_started_at, wait_expires_at, wait_remaining_seconds, wait_overdue, payment_minutes, payment_total_seconds, payment_started_at, payment_expires_at, payment_remaining_seconds, payment_active, payment_overdue, payment_deadline_action, payment_status_changes_on_expiry, payment_deadline_processed_at, payment_deadline_version, server_time]
      properties:
        mode: { type: string }
        is_planned: { type: boolean }
        requires_operator_plan: { type: boolean }
        timer_start: { type: string }
        wait_minutes: { type: integer }
        wait_total_seconds: { type: integer }
        wait_started_at: { type: [string, "null"], format: date-time }
        wait_expires_at: { type: [string, "null"], format: date-time }
        wait_remaining_seconds: { type: [integer, "null"] }
        wait_overdue: { type: boolean }
        payment_minutes: { type: integer }
        payment_total_seconds: { type: integer }
        payment_started_at: { type: [string, "null"], format: date-time }
        payment_expires_at: { type: [string, "null"], format: date-time }
        payment_remaining_seconds: { type: [integer, "null"] }
        payment_active: { type: boolean }
        payment_overdue: { type: boolean }
        payment_deadline_action: { type: string }
        payment_status_changes_on_expiry: { type: boolean }
        payment_deadline_processed_at: { type: [string, "null"], format: date-time }
        payment_deadline_version: { type: integer }
        server_time: { type: string, format: date-time }
    PagePagination:
      type: object
      required: [mode, current_page, per_page, total, last_page, from, to, has_more]
      properties:
        mode: { const: page }
        current_page: { type: integer, minimum: 1 }
        per_page: { type: integer, minimum: 1 }
        total: { type: integer, minimum: 0 }
        last_page: { type: integer, minimum: 1 }
        from: { type: [integer, "null"] }
        to: { type: [integer, "null"] }
        has_more: { type: boolean }
    CursorPagination:
      type: object
      required: [mode, per_page, cursor, next_cursor, has_more, sort]
      properties:
        mode: { const: cursor }
        per_page: { type: integer, minimum: 1 }
        cursor: { type: [string, "null"] }
        next_cursor: { type: [string, "null"] }
        has_more: { type: boolean }
        sort: { type: array, items: { enum: [id, "-id"] } }
    OrderState:
      type: object
      required: [id, key, name, is_final, is_payment_flow, is_problem]
      properties:
        id:
          type: integer
        key:
          type: string
        name:
          type: string
        reason: { type: [string, "null"] }
        is_final:
          type: boolean
        is_payment_flow:
          type: boolean
        is_problem:
          type: boolean
    OrderStatusDictionaryItem:
      type: object
      required: [id, key, name, is_final, is_payment_flow, is_problem, color, class, allows_operator_actions, sorting]
      properties:
        id:
          type: integer
        key:
          type: string
        name:
          type: string
        is_final:
          type: boolean
        is_payment_flow:
          type: boolean
        is_problem:
          type: boolean
        color:
          type: [string, "null"]
        class:
          type: [string, "null"]
        allows_operator_actions:
          type: boolean
        sorting:
          type: integer
    IdentityVerification:
      type: object
      required: [id, uuid, purpose, status, review, created_at, updated_at]
      properties:
        id: { type: integer }
        uuid:
          type: [string, "null"]
          description: "Непрозрачный публичный идентификатор проверки."
        source: { const: manual_kyc }
        purpose: { type: string }
        full_name: { type: [string, "null"] }
        files:
          type: array
          items: { type: string }
        status:
          $ref: "#/components/schemas/VerificationStatus"
        review:
          type: object
          required: [reason, comment, reviewed_at]
          properties:
            reason: { type: [string, "null"] }
            comment: { type: [string, "null"] }
            reviewed_at: { type: [string, "null"], format: date-time }
        created_at: { type: [string, "null"], format: date-time }
        updated_at: { type: [string, "null"], format: date-time }
    PartnerPayoutMethod:
      type: object
      required: [currency_id, payment, code, designation, precision, wallet, fees]
      properties:
        currency_id:
          type: integer
        payment:
          type: string
        code:
          type: string
        designation:
          type: string
        precision:
          type: integer
        wallet:
          type: object
          required: [mask, min_length, max_length]
          properties:
            mask:
              type: string
            min_length:
              type: integer
            max_length:
              type: integer
        fees:
          type: object
          required: [percent, fixed]
          properties:
            percent:
              type: string
            fixed:
              type: string
    PartnerPayoutCurrencySummary:
      type: object
      required: [currency, paid_amount, pending_amount]
      properties:
        currency:
          type: [string, "null"]
        paid_amount:
          type: string
        pending_amount:
          type: string
    PartnerStatistics:
      type: object
      required: [referrals, exchanges, payouts, ledger]
      properties:
        referrals:
          type: object
          required: [total, with_bonus_orders, active_last_30_days]
          properties:
            total: { type: integer }
            with_bonus_orders: { type: integer }
            active_last_30_days: { type: integer }
        exchanges:
          type: object
          required: [bonus_orders, bonus_orders_in_currency, currency, total_bonus, avg_bonus, by_currency, first_bonus_at, last_bonus_at]
          properties:
            bonus_orders: { type: integer }
            bonus_orders_in_currency: { type: integer }
            currency: { type: [string, "null"] }
            total_bonus: { type: string }
            avg_bonus: { type: string }
            by_currency: { type: array, items: { $ref: "#/components/schemas/PartnerBonusCurrencySummary" } }
            first_bonus_at: { type: [string, "null"] }
            last_bonus_at: { type: [string, "null"] }
        payouts: { $ref: "#/components/schemas/PartnerPayoutStatistics" }
        ledger: { $ref: "#/components/schemas/PartnerLedgerStatistics" }
    SuccessEnvelope:
      type: object
      required:
        - state
        - message
        - result
        - meta
      properties:
        state:
          type: integer
          enum:
            - 0
        message:
          type: string
        result: {}
        meta:
          $ref: '#/components/schemas/Meta'
    ErrorEnvelope:
      type: object
      required:
        - state
        - message
        - code
        - error
        - meta
      properties:
        state:
          type: integer
          enum:
            - 1
        message:
          type: string
        code:
          type: integer
          description: 'Код состояния HTTP.'
        error:
          type: object
          required:
            - code
            - type
            - details
          properties:
            code:
              $ref: "#/components/schemas/ApiErrorCode"
              description: 'Стабильный машинный код ошибки API.'
            type:
              $ref: "#/components/schemas/ApiErrorCode"
              deprecated: true
              description: 'Совместимый псевдоним поля `error.code`.'
            details:
              $ref: "#/components/schemas/ApiErrorDetails"
        meta:
          $ref: '#/components/schemas/Meta'
    Meta:
      type: object
      required: [request_id, correlation_id, timestamp]
      properties:
        request_id:
          type: string
        correlation_id:
          type: string
        timestamp:
          type: string
          format: date-time
        pagination:
          $ref: '#/components/schemas/Pagination'
        filters:
          oneOf:
            - type: object
            - { type: array, maxItems: 0, items: {} }
        sort: { type: array, items: { type: string } }
        summary:
          anyOf:
            - $ref: "#/components/schemas/PartnerExchangeListSummary"
            - $ref: "#/components/schemas/PartnerPayoutListSummary"
    Pagination:
      oneOf:
        - $ref: "#/components/schemas/PagePagination"
        - $ref: "#/components/schemas/CursorPagination"
      discriminator:
        propertyName: mode
        mapping:
          page: "#/components/schemas/PagePagination"
          cursor: "#/components/schemas/CursorPagination"
    Client:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        email:
          type: string
        balance:
          type: [object, "null"]
          description: 'Доступно только при праве ключа public-api:client:balance:read; иначе null.'
        orders:
          type: object
        api_token:
          anyOf:
            - $ref: '#/components/schemas/ApiTokenSummary'
            - type: "null"
    PartnerPayoutCreateRequest:
      type: object
      required:
        - currency_id
        - wallet
      properties:
        currency_id:
          type: integer
          minimum: 1
          description: 'ID из ответа GET /private/partner/payout-methods.'
        wallet:
          type: string
          minLength: 2
          maxLength: 191
        amount:
          type: [string, "null"]
          pattern: '^[0-9]{1,30}(\.[0-9]{1,18})?$'
          description: "Должна быть точно представима в масштабе базового баланса из способов выплаты. Пропустите поле или передайте null для выплаты всего доступного баланса."
    PartnerPayoutPreview:
      type: object
      required: [amount, currency, fees, precision, confirmation_required, calculated_at]
      properties:
        amount:
          type: object
          required: [requested, base, base_currency]
          properties:
            requested:
              type: string
            base:
              type: string
            base_currency:
              type: string
        currency:
          type: object
          required: [id, code, payment, designation]
          properties:
            id:
              type: integer
            code:
              type: string
            payment:
              type: [string, "null"]
            designation:
              type: [string, "null"]
        fees:
          type: object
          required: [percent, fixed]
          properties:
            percent:
              type: string
            fixed:
              type: string
        precision:
          type: integer
        confirmation_required:
          type: boolean
        calculated_at:
          type: string
          format: date-time
    PartnerPayoutCreateResponse:
      allOf:
        -
          $ref: '#/components/schemas/SuccessEnvelope'
        -
          type: object
          properties:
            result:
              type: object
              required:
                - payout
                - confirmation_required
                - replayed
              properties:
                payout:
                  $ref: '#/components/schemas/PartnerPayout'
                confirmation_required:
                  type: boolean
                replayed:
                  type: boolean
    PartnerPayout:
      type: object
      required:
        - id
        - status
        - amount
        - currency
        - wallet
        - created_at
      properties:
        id:
          type: integer
        status:
          type: string
          enum:
            - pending
            - paid
            - rejected
        amount:
          type: object
          properties:
            requested:
              type: string
              description: 'Сумма в валюте выплаты после конвертации и комиссий.'
            base:
              type: string
              description: 'Точная сумма списания с базового партнёрского баланса.'
            base_currency:
              type: string
        currency:
          type: [object, "null"]
          properties:
            id:
              type: integer
            payment:
              type: [string, "null"]
            code:
              type: [string, "null"]
            designation:
              type: [string, "null"]
        wallet:
          type: [string, "null"]
        reason:
          type: [string, "null"]
        created_at:
          type: [string, "null"]
          format: date-time
        verified_at:
          type: [string, "null"]
          format: date-time
        updated_at:
          type: [string, "null"]
          format: date-time
        rejected_at:
          type: [string, "null"]
          format: date-time
    ApiScope:
      type: object
      required:
        - scope
        - group
        - title
        - description
        - risk
        - grantable
        - endpoints
      properties:
        scope:
          type: string
          example: 'public-api:client:read'
        group:
          type: string
          example: client
        title:
          type: string
          example: 'Client profile'
        description:
          type: string
        risk:
          type: string
          enum:
            - low
            - standard
            - medium
            - high
        grantable:
          type: boolean
        endpoints:
          type: array
          items:
            type: string
    ApiTokenSummary:
      type: [object, "null"]
      properties:
        id:
          type: integer
        name:
          type: string
        scopes:
          type: array
          items:
            type: string
        scope_details:
          type: array
          items:
            $ref: '#/components/schemas/ApiScope'
        security:
          type: object
          properties:
            hmac_required:
              type: boolean
            hmac_verified:
              type: boolean
            signature_algorithm:
              type: string
              const: hmac-sha256-v2
        last_used_at:
          type: [string, "null"]
          format: date-time
        expires_at:
          type: [string, "null"]
          format: date-time
    UsagePeriod:
      type: object
      required:
        - limit
        - used
        - remaining
        - resets_at
      properties:
        limit:
          type: [integer, "null"]
        used:
          type: integer
        remaining:
          type: [integer, "null"]
        resets_at:
          type: string
          format: date-time
    UsageSummary:
      type: object
      properties:
        api_token:
          type: [object, "null"]
          properties:
            id:
              type: integer
            name:
              type: string
            status:
              type: string
            plan:
              type: string
            billable:
              type: boolean
        quota:
          type: [object, "null"]
          properties:
            day:
              $ref: '#/components/schemas/UsagePeriod'
            month:
              $ref: '#/components/schemas/UsagePeriod'
        billing:
          type: [object, "null"]
          properties:
            currency:
              type: string
            unit_price:
              type: string
            billable_units:
              type: integer
            estimated_amount:
              type: string
        usage:
          type: object
          additionalProperties:
            type: object
            properties:
              requests:
                type: integer
              errors:
                type: integer
              billable_units:
                type: integer
              total_duration_ms:
                type: integer
    CurrencySummary:
      type: object
      properties:
        id:
          type: integer
        payment:
          type: [string, "null"]
        code:
          type: [string, "null"]
        designation:
          type: [string, "null"]
        small_code:
          type: [string, "null"]
        network:
          type: [string, "null"]
        network_out:
          type: [string, "null"]
        decimal:
          type: integer
    PaymentSystem:
      type: object
      properties:
        id:
          type: integer
        type:
          type: string
          enum:
            - payment_system
        name:
          type: string
        payment:
          type: object
          properties:
            id:
              type: integer
            name:
              type: string
            logo:
              type: [string, "null"]
            logo_url:
              type: [string, "null"]
        currency:
          type: object
          properties:
            id:
              type: integer
            code:
              type: string
            sign:
              type: [string, "null"]
        codes:
          type: object
          properties:
            letter:
              type: [string, "null"]
            short:
              type: [string, "null"]
            network_in:
              type: [string, "null"]
            network_out:
              type: [string, "null"]
        precision:
          type: object
          properties:
            amount_decimal:
              type: integer
        capabilities:
          type: object
          properties:
            can_give:
              type: boolean
            can_receive:
              type: boolean
            income_enabled:
              type: integer
            outcome_enabled:
              type: integer
        routes:
          type: object
          properties:
            give_to:
              type: array
              items:
                type: object
                properties:
                  route_id:
                    type: integer
                  currency_id:
                    type: integer
            receive_from:
              type: array
              items:
                type: object
                properties:
                  route_id:
                    type: integer
                  currency_id:
                    type: integer
        form:
          type: object
          additionalProperties: true
        notices:
          type: object
          additionalProperties: true
        network:
          type: [object, "null"]
          additionalProperties: true
        filters:
          type: object
          properties:
            ids:
              type: array
              items:
                type: integer
        sorting:
          type: object
          additionalProperties:
            type: integer
    ExchangeRoute:
      type: object
      properties:
        id:
          type: integer
        status:
          type: integer
        is_enabled:
          type: boolean
        name:
          type: [string, "null"]
        from:
          $ref: '#/components/schemas/CurrencySummary'
        to:
          $ref: '#/components/schemas/CurrencySummary'
        limits:
          type: object
          properties:
            min_give:
              type: [string, "null"]
            max_give:
              type: [string, "null"]
            min_receive:
              type: [string, "null"]
            max_receive:
              type: [string, "null"]
        rate:
          type: object
          properties:
            type:
              type: string
              enum:
                - fixed
                - selectable
            course:
              type: [string, "null"]
            is_type_rate:
              type: boolean
            default_type_rate:
              type: integer
              enum:
                - 0
                - 1
            modes:
              $ref: "#/components/schemas/ExchangeRateModes"
        features:
          type: object
          additionalProperties: true
        sorting:
          type: object
          additionalProperties:
            type: integer
        timestamps:
          type: object
          additionalProperties: true
    ExchangeRateModes:
      description: "Карта режимов курса. Ответы без доступных режимов содержат пустой массив."
      anyOf:
        - type: object
          additionalProperties:
            type: object
        - type: array
          maxItems: 0
          items: {}
    ExchangeRouteDetail:
      type: object
      properties:
        route:
          $ref: '#/components/schemas/ExchangeRoute'
        operation:
          type: object
          description: 'Данные операции в формате, совместимом с детальной операцией клиентского API.'
          additionalProperties: true
          properties:
            attributes:
              type: object
              additionalProperties: true
              properties:
                city_detail:
                  $ref: "#/components/schemas/ExchangeCityDetails"
        snapshot:
          $ref: '#/components/schemas/RouteSnapshot'
        operation_contract:
          $ref: '#/components/schemas/OperationContract'
        contract:
          type: object
          properties:
            quote_endpoint:
              type: string
            preflight_endpoint:
              type: string
            order_endpoint:
              type: string
            amount_side:
              type: string
              enum:
                - give
            currency_fields:
              type: array
              items:
                type: string
    RouteSnapshot:
      type: object
      required:
        - version
        - route_id
        - hash
        - expiry_signature
        - generated_at
        - expires_at
      properties:
        version:
          type: string
          example: route-snapshot-v1
        route_id:
          type: integer
        hash:
          type: string
        expiry_signature:
          type: string
          pattern: "^[a-f0-9]{64}$"
          description: "Непрозрачное подтверждение срока действия. Передайте снимок целиком. Если поля нет, запросите свежий расчёт, детали направления или preflight."
        generated_at:
          type: string
          format: date-time
        expires_at:
          type: string
          format: date-time
        fingerprint:
          type: object
          additionalProperties: true
    OperationContract:
      type: object
      properties:
        version:
          type: string
          example: operation-contract-v1
        route:
          $ref: '#/components/schemas/ExchangeRoute'
        operation:
          type: object
          additionalProperties: true
          properties:
            attributes:
              type: object
              additionalProperties: true
              properties:
                city_detail:
                  $ref: "#/components/schemas/ExchangeCityDetails"
        snapshot:
          $ref: '#/components/schemas/RouteSnapshot'
        contract:
          type: object
          additionalProperties: true
          properties:
            dynamic_fields:
              $ref: "#/components/schemas/ExchangeDynamicFields"
            rate:
              type: object
              required: [selector_fees]
              properties:
                selector_fees:
                  $ref: "#/components/schemas/ExchangeSelectorFees"
            files:
              type: object
              properties:
                create_upload_intent_endpoint: { type: string }
                commit_upload_intent_endpoint: { type: string }
                order_field_upload_endpoint: { type: string }
                receipts_endpoint: { type: string }
                receipts_allowed: { type: boolean }
    ExchangeCityDetails:
      description: "Ключ id_<direction-city-row-id> использует ID строки города направления, а не ID географического города. При отсутствии доступных городов возвращается пустой массив."
      anyOf:
        - type: object
          additionalProperties:
            type: object
            properties:
              information: { type: [string, "null"] }
              handover:
                $ref: "#/components/schemas/CityHandoverConfiguration"
        - type: array
          maxItems: 0
          items: {}
    CityHandoverConfiguration:
      type: object
      required: [enabled, methods, offices]
      properties:
        enabled:
          type: boolean
          description: Пустая прежняя конфигурация выключена; включённая конфигурация без доступных способов не разрешает создание заявки.
        methods:
          type: array
          items:
            type: string
            enum: [office, courier, agreement]
        courier_description:
          type: string
          minLength: 1
          description: Необязательное описание на языке запроса с настроенным языковым fallback. Поле отсутствует без способа courier или при пустых переводах; карты переводов не возвращаются.
        offices:
          type: array
          description: Активные назначенные офисы компании выбранного города; адрес клиента для курьера сюда не входит.
          items:
            $ref: "#/components/schemas/CityHandoverOffice"
    CityHandoverOffice:
      type: object
      required: [id, name, address]
      properties:
        id:
          type: integer
          minimum: 1
        name:
          type: string
          description: Имя офиса на языке запроса; отсутствующий или пустой перевод использует настроенный языковой fallback. Карта переводов не возвращается.
        address:
          type: string
          description: Адрес компании с тем же языковым fallback. Это строка, а не адрес клиента для курьера или карта переводов.
    CityHandoverSelection:
      type: object
      description: Обязателен только при включённой передаче в выбранном городе направления. Не меняет курс и не добавляет комиссию доставки.
      oneOf:
        - type: object
          required: [method, office_id]
          additionalProperties: false
          properties:
            method:
              type: string
              enum: [office]
            office_id:
              type: integer
              minimum: 1
        - type: object
          required: [method, address]
          additionalProperties: false
          properties:
            method:
              type: string
              enum: [courier]
            address:
              type: string
              minLength: 1
              maxLength: 1000
        - type: object
          required: [method]
          additionalProperties: false
          properties:
            method:
              type: string
              enum: [agreement]
    CashHandoverSnapshot:
      type: [object, "null"]
      description: Исторические условия заявки доступны только в приватном ответе владельцу. Адрес курьера является персональными данными.
      required: [version, method, direction_city_id, city_id, office_id, office_name, address]
      properties:
        version:
          type: integer
          enum: [1]
        method:
          type: string
          enum: [office, courier, agreement]
        direction_city_id:
          type: integer
          minimum: 1
        city_id:
          type: integer
          minimum: 1
        office_id:
          type: [integer, "null"]
        office_name:
          type: [string, "null"]
        address:
          type: [string, "null"]
    ExchangeAmountInput:
      description: "Положительная десятичная сумма без экспоненциальной записи. Для сохранения точности передавайте её строкой."
      anyOf:
        - type: string
          pattern: "^[0-9]+(?:[.][0-9]+)?$"
        - type: number
          exclusiveMinimum: 0
    ExchangeRouteSelector:
      type: object
      anyOf:
        - required: [route_id]
          properties:
            route_id: { type: integer }
        - required: [direction_id]
          properties:
            direction_id: { type: integer }
        - allOf:
            - anyOf:
                - required: [income_payment_system]
                  properties:
                    income_payment_system: { type: integer }
                - required: [from_currency_id]
                  properties:
                    from_currency_id: { type: integer }
                - required: [from]
                  properties:
                    from: { type: string }
                - required: [from_code]
                  properties:
                    from_code: { type: string }
            - anyOf:
                - required: [outcome_payment_system]
                  properties:
                    outcome_payment_system: { type: integer }
                - required: [to_currency_id]
                  properties:
                    to_currency_id: { type: integer }
                - required: [to]
                  properties:
                    to: { type: string }
                - required: [to_code]
                  properties:
                    to_code: { type: string }
    ExchangeSelectedFeeInput:
      type: object
      required: [id]
      properties:
        id: { type: integer, minimum: 1 }
        scope: { type: string, enum: [common, individual] }
    ExchangeSelectedFee:
      allOf:
        - $ref: "#/components/schemas/ExchangeSelectedFeeInput"
        - type: object
          required: [scope]
    ExchangeSelectorFees:
      type: object
      required: [mode, options]
      properties:
        mode: { type: string, enum: [single, multi] }
        options:
          type: array
          items:
            allOf:
              - $ref: "#/components/schemas/ExchangeSelectedFee"
              - type: object
                required: [name, description]
                properties:
                  name: { type: string }
                  description: { type: string }
    ExchangeQuoteRequest:
      type: object
      properties:
        route_id:
          type: [integer, "null"]
        direction_id:
          type: [integer, "null"]
        income_payment_system:
          type: [integer, "null"]
        outcome_payment_system:
          type: [integer, "null"]
        from_currency_id:
          type: [integer, "null"]
        to_currency_id:
          type: [integer, "null"]
        from:
          type: [string, "null"]
        to:
          type: [string, "null"]
        from_code:
          type: [string, "null"]
        to_code:
          type: [string, "null"]
        amount:
          anyOf:
            - $ref: "#/components/schemas/ExchangeAmountInput"
            - type: "null"
          example: '100'
        income_amount:
          anyOf:
            - $ref: "#/components/schemas/ExchangeAmountInput"
            - type: "null"
          description: 'Псевдоним поля amount.'
        city_id:
          type: [integer, "null"]
        type_rate:
          description: '0/fixed — фиксированный курс; 1/floating — плавающий курс.'
          oneOf:
            -
              type: integer
              enum:
                - 0
                - 1
            -
              type: string
              enum:
                - '0'
                - '1'
                - fixed
                - floating
            - type: "null"
        selected_fee_type:
          type: [string, "null"]
          maxLength: 50
          deprecated: true
          description: "Принимается для совместимости. Для выбора передавайте selected_fees."
        selected_fees:
          description: "Список выбранных селекторов комиссии из контракта направления. Объекты-карты поддерживаются для совместимости."
          anyOf:
            - type: array
              items:
                $ref: "#/components/schemas/ExchangeSelectedFeeInput"
            - type: object
              additionalProperties: true
            - type: "null"
        selector_fees:
          type: [object, array, "null"]
          deprecated: true
          description: "Принимается для совместимости. Для выбора передавайте selected_fees."
        checkbox_agreements:
          type: object
          additionalProperties: true
          description: 'Ключи соглашений и состояния выбора из контракта направления. Комиссии определяются по активным серверным соглашениям, доступным этому направлению.'
          example:
            discount: true
            commission: false
        checkbox_fees:
          type: object
          additionalProperties: true
          deprecated: true
          description: 'Принимается для совместимости и игнорируется. Передавайте checkbox_agreements; значения комиссий определяет сервер.'
        card_verification_required:
          type: [boolean, "null"]
        promo_code:
          type: [string, "null"]
          maxLength: 64
      allOf:
        - $ref: "#/components/schemas/ExchangeRouteSelector"
        - anyOf:
            - required: [amount]
              properties:
                amount: { $ref: "#/components/schemas/ExchangeAmountInput" }
            - required: [income_amount]
              properties:
                income_amount: { $ref: "#/components/schemas/ExchangeAmountInput" }
    ExchangeOrderPreflightRequest:
      $ref: "#/components/schemas/ExchangeOrderCreateRequest"
      description: "Поля заявки для предпроверки и sandbox-симуляции."
    ExchangeOrderPreflight:
      type: object
      required: [allowed, can_create_order, checks, missing_fields, validation_errors, validation_issues, quote, operation_contract, requirements, snapshot]
      properties:
        checks:
          $ref: "#/components/schemas/PreflightChecks"
        validation_issues:
          type: array
          items:
            $ref: "#/components/schemas/ApiIssue"
        allowed:
          type: boolean
        can_create_order:
          type: boolean
        missing_fields:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
              type:
                type: string
              message:
                type: string
        validation_errors:
          type: object
          description: "Сообщения валидации по полям после заполнения обязательных данных. Проверка учитывает локальные правила."
          additionalProperties:
            type: array
            items:
              type: string
        quote:
          $ref: '#/components/schemas/ExchangeQuote'
        operation_contract:
          $ref: '#/components/schemas/OperationContract'
        requirements:
          $ref: '#/components/schemas/VerificationRequirements'
        snapshot:
          $ref: '#/components/schemas/RouteSnapshot'
    ExchangeQuote:
      type: object
      required: [selector_fees]
      properties:
        selector_fees:
          $ref: "#/components/schemas/ExchangeSelectorFees"
        route:
          $ref: '#/components/schemas/ExchangeRoute'
        amounts:
          type: object
          properties:
            give:
              type: string
            receive:
              type: string
        components:
          type: array
          items:
            type: object
            additionalProperties: true
        rate:
          type: object
          properties:
            display:
              type: string
            value:
              type: string
            source:
              type: string
              enum:
                - calculation
            selected:
              type: [string, "null"]
              enum:
                - fixed
                - floating
                - null
            modes:
              $ref: "#/components/schemas/ExchangeRateModes"
        base_rate:
          type: object
          description: 'Базовый курс направления без поправок расчёта по городу, селекторам, флажкам и проверке. Если самостоятельная формула города работает, а общий источник недоступен, value и display равны null, available — false.'
          properties:
            display:
              type: [string, 'null']
            value:
              type: [string, 'null']
            available:
              type: boolean
              description: 'Передаётся со значением false при недоступной общей базе. В обычном ответе с доступной базой поле отсутствует для сохранения совместимости.'
            source:
              type: string
              enum:
                - direction
            selected:
              type: [string, "null"]
              enum:
                - fixed
                - floating
                - null
            modes:
              $ref: "#/components/schemas/ExchangeRateModes"
            note:
              type: string
        adjustments:
          type: object
          description: 'Параметры расчёта, повлиявшие на курс.'
          properties:
            city_id:
              type: [integer, "null"]
            selected_fee_type:
              type: [string, "null"]
            selected_fees:
              type: array
              items:
                $ref: "#/components/schemas/ExchangeSelectedFee"
            selector_fees:
              type: array
              items: {}
            checkbox_fees:
              type: array
              items: {}
            card_verification_required:
              type: boolean
        promo:
          type: object
          properties:
            applied:
              type: boolean
            base_receive_amount:
              type: string
        task_payload:
          type: object
          additionalProperties: true
    ExchangeOrderCreateRequest:
      type: object
      properties:
        country:
          type: [string, "null"]
          minLength: 2
          maxLength: 2
        handover:
          anyOf:
            - $ref: "#/components/schemas/CityHandoverSelection"
            - type: "null"
        outcome_amount:
          anyOf:
            - $ref: "#/components/schemas/ExchangeAmountInput"
            - type: "null"
        receive_amount:
          anyOf:
            - $ref: "#/components/schemas/ExchangeAmountInput"
            - type: "null"
          description: 'Псевдоним поля outcome_amount.'
        email:
          type: [string, "null"]
          format: email
          deprecated: true
          description: "Принимается для совместимости. В заявке используется email владельца ключа."
        income_account:
          type: [string, "null"]
        outcome_account:
          type: [string, "null"]
        from_requisite:
          type: [string, "null"]
          description: 'Псевдоним поля income_account.'
        to_requisite:
          type: [string, "null"]
          description: 'Псевдоним поля outcome_account.'
        fields_in:
          type: [object, "null"]
          additionalProperties: true
        fields_out:
          type: [object, "null"]
          additionalProperties: true
        direction_fields:
          type: [object, "null"]
          additionalProperties: true
        user_fields:
          type: [object, "null"]
          additionalProperties: true
          description: Для файловых полей укажите массив одноразовых токенов из группы `user` выбранного направления. Для остальных полей действуют обычные скалярные значения.
        extra_out:
          type: [object, "null"]
          additionalProperties: true
        device_type:
          type: [string, "null"]
          maxLength: 32
        snapshot:
          anyOf:
            - $ref: '#/components/schemas/RouteSnapshot'
            - type: "null"
      allOf:
        - $ref: "#/components/schemas/ExchangeQuoteRequest"
    ExchangeOrderConfirmRequest:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - paid
            - unpaid
        income_code:
          deprecated: true
          description: "Принимается для совместимости. Прикрепите чек отдельной операцией receipts."
          type: string
          minLength: 15
    ExchangePaymentInstructions:
      type: object
      required: [tracking_id, status, mode, payment_expires_at, amount, currency, network, details]
      properties:
        tracking_id:
          type: string
        status:
          type: string
          enum: [ready, expired, unavailable, verification_required, awaiting_operator, pending, not_prepared]
        mode:
          type: string
          enum: [none, checkout, requisites]
        payment_expires_at:
          type: [string, "null"]
          format: date-time
        amount:
          type: string
          description: "Десятичная сумма к оплате."
        currency:
          type: [string, "null"]
        network:
          type: [string, "null"]
        details:
          oneOf:
            - type: "null"
            - type: object
              required: [checkout_url]
              additionalProperties: false
              properties:
                checkout_url:
                  type: string
            - type: object
              required: [account, memo, bank, fields]
              additionalProperties: false
              properties:
                account:
                  type: string
                memo:
                  type: [string, "null"]
                bank:
                  type: [string, "null"]
                fields:
                  type: array
                  items:
                    type: object
                    required: [key, name, value, comment]
                    properties:
                      key:
                        type: string
                      name:
                        type: string
                      value:
                        type: string
                      comment:
                        type: [string, "null"]
    ExchangePaymentInstructionsPreparation:
      allOf:
        - $ref: "#/components/schemas/ExchangePaymentInstructions"
        - type: object
          properties:
            details:
              type: "null"
    OrderActions:
      type: object
      properties:
        status:
          type: object
          additionalProperties: true
        allowed_actions:
          type: object
          additionalProperties:
            type: object
            required:
              - allowed
            properties:
              allowed:
                type: boolean
                description: Доступно в текущем состоянии заявки.
              authorized:
                type: boolean
                description: У текущего API-ключа есть право на это действие.
              reason:
                enum:
                  - expired
                  - unavailable
                  - verification_required
                  - null
              method:
                type: string
              endpoint:
                type: string
              payload:
                type: object
        transitions:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
              key:
                type: string
        requirements:
          $ref: '#/components/schemas/VerificationRequirements'
        payment_timing:
          $ref: '#/components/schemas/OrderPaymentTiming'
        request_payment_timing:
          anyOf:
            - $ref: '#/components/schemas/OrderRequestPaymentTiming'
            - type: 'null'
      required:
        - status
        - payment_timing
        - request_payment_timing
        - allowed_actions
        - transitions
        - requirements
    Order:
      type: object
      required: [id, public_id, tracking_id, cash_handover, status, amounts, currencies, direction, customer, payment, flags, timestamps]
      properties:
        id: { type: integer }
        public_id: { type: string }
        tracking_id: { type: [string, "null"] }
        cash_handover: { $ref: "#/components/schemas/CashHandoverSnapshot" }
        status: { $ref: "#/components/schemas/OrderState" }
        amounts:
          type: object
          required: [give, receive, rate, give_with_commission, receive_with_commission]
          properties:
            give: { type: string }
            receive: { type: string }
            rate: { type: [string, "null"] }
            give_with_commission: { type: [string, "null"] }
            receive_with_commission: { type: [string, "null"] }
        currencies:
          type: object
          required: [from, to]
          properties:
            from: { anyOf: [{ $ref: "#/components/schemas/CurrencySummary" }, { type: "null" }] }
            to: { anyOf: [{ $ref: "#/components/schemas/CurrencySummary" }, { type: "null" }] }
        direction:
          type: object
          required: [id, name]
          properties:
            id: { type: [integer, "null"] }
            name: { type: [string, "null"] }
        customer:
          type: object
          required: [email, phone, from_requisite, to_requisite]
          properties:
            email: { type: [string, "null"] }
            phone: { type: [string, "null"] }
            from_requisite: { type: [string, "null"] }
            to_requisite: { type: [string, "null"] }
        payment:
          type: object
          required: [merchant_provider, merchant_status, payment_address, is_wallet_issued, timing, request_timing]
          properties:
            merchant_provider: { type: [string, "null"] }
            merchant_status: { type: [string, "null"] }
            payment_address: { type: [string, "null"] }
            is_wallet_issued: { type: boolean }
            timing: { $ref: "#/components/schemas/OrderPaymentTiming" }
            request_timing: { anyOf: [{ $ref: "#/components/schemas/OrderRequestPaymentTiming" }, { type: "null" }] }
        flags:
          type: object
          required: [is_archive, is_frozen, is_new_user, is_auto_check_payment]
          properties:
            is_archive: { type: boolean }
            is_frozen: { type: boolean }
            is_new_user: { type: boolean }
            is_auto_check_payment: { type: boolean }
        timestamps:
          type: object
          required: [created_at, updated_at, started_at, completed_at, archived_at]
          properties:
            created_at: { type: [string, "null"], format: date-time }
            updated_at: { type: [string, "null"], format: date-time }
            started_at: { type: [string, "null"], format: date-time }
            completed_at: { type: [string, "null"], format: date-time }
            archived_at: { type: [string, "null"], format: date-time }
    UploadIntentCreateRequest:
      type: object
      required:
        - purpose
      properties:
        purpose:
          type: string
          enum:
            - identity_verification
            - card_verification
        resource_type:
          type:
            - string
            - 'null'
          maxLength: 64
        resource_id:
          type:
            - string
            - 'null'
          maxLength: 128
        field_key:
          type:
            - string
            - 'null'
          maxLength: 128
        allowed_extensions:
          type:
            - array
            - 'null'
          items:
            type: string
            maxLength: 16
        max_bytes:
          type:
            - integer
            - 'null'
          minimum: 1024
      if:
        required:
          - resource_type
        properties:
          resource_type:
            const: order
      then:
        required:
          - resource_id
        properties:
          resource_id:
            type: string
            pattern: \S
    UploadIntent:
      type: object
      properties:
        id:
          type: integer
        uuid:
          type: string
          format: uuid
        purpose:
          type: string
        resource_type:
          type: [string, "null"]
        resource_id:
          type: [string, "null"]
        field_key:
          type: [string, "null"]
        status:
          type: string
          enum:
            - pending
            - committed
            - consumed
            - expired
        allowed_extensions:
          type: array
          items:
            type: string
        max_bytes:
          type: integer
        file:
          type: object
          additionalProperties: true
        expires_at:
          type: [string, "null"]
          format: date-time
        committed_at:
          type: [string, "null"]
          format: date-time
        consumed_at:
          type: [string, "null"]
          format: date-time
    VerificationStatus:
      type: object
      required: [key, label, is_final_approved]
      properties:
        id:
          type: [integer, "null"]
        key:
          type: string
          enum:
            - not_submitted
            - pending
            - approved
            - rejected
        label:
          type: string
        is_final_approved:
          type: boolean
        verification_id:
          type: [integer, "null"]
        verification_uuid:
          type: string
          description: "Непрозрачный публичный идентификатор проверки."
    VerificationRequirements:
      type: object
      properties:
        route_id:
          type: [integer, "null"]
        order:
          type: [object, "null"]
          additionalProperties: true
        identity:
          type: object
          properties:
            required:
              type: boolean
            mode:
              type: [string, "null"]
            description:
              type: [string, "null"]
            current:
              $ref: '#/components/schemas/VerificationStatus'
            create_endpoint:
              type: string
            blocks_payment: { type: boolean }
            can_submit: { type: boolean }
            flow: { type: string }
        card:
          type: object
          properties:
            required:
              type: boolean
            mode:
              type: [integer, "null"]
            description:
              type: [string, "null"]
            settings:
              type: [object, "null"]
              additionalProperties: true
            additional_photos:
              $ref: '#/components/schemas/CardVerificationAdditionalPhotos'
            current:
              $ref: '#/components/schemas/VerificationStatus'
            create_endpoint:
              type: string
            blocks_payment: { type: boolean }
            can_submit: { type: boolean }
        files:
          type: [object, "null"]
          additionalProperties: true
    CardVerificationAdditionalPhotos:
      type: object
      required:
        - enabled
        - max_count
        - max_file_size_mb
        - accepted_mime_types
      properties:
        enabled:
          type: boolean
        max_count:
          type: integer
          minimum: 1
          maximum: 5
        max_file_size_mb:
          type: integer
          minimum: 1
          maximum: 10
        accepted_mime_types:
          type: array
          items:
            type: string
            enum:
              - image/jpeg
              - image/png
    IdentityVerificationCreateRequest:
      type: object
      description: "Передайте значения и намерения загрузки по ключам опубликованной формы. Прежние поля full_name и file_intents принимаются, когда соответствуют форме."
      properties:
        fields:
          type: object
          maxProperties: 80
          additionalProperties:
            type: [string, number, boolean, array, "null"]
        file_intents_by_field:
          type: object
          maxProperties: 30
          additionalProperties:
            type: array
            maxItems: 10
            uniqueItems: true
            items: { type: string, format: uuid }
        full_name: { type: [string, "null"], maxLength: 255 }
        file_intents:
          type: array
          minItems: 1
          maxItems: 2
          uniqueItems: true
          items: { type: string, format: uuid }
    CardVerificationCreateRequest:
      type: object
      required:
        - card_number
        - file_intent
      properties:
        order:
          type:
            - string
            - 'null'
          maxLength: 128
        order_id:
          type:
            - string
            - 'null'
          maxLength: 128
        currency_id:
          type:
            - integer
            - 'null'
        card_number:
          type: string
          maxLength: 255
        name:
          type:
            - string
            - 'null'
          maxLength: 255
        file_intent:
          type: string
          format: uuid
        additional_file_intents:
          type: array
          description: Дополнительные фото карты; принимаются только если включены в настройках проверки.
          maxItems: 5
          uniqueItems: true
          items:
            type: string
            format: uuid
    CardVerificationFile:
      type: object
      required:
        - image
        - preview
      properties:
        image:
          type: [string, "null"]
        preview:
          type: [string, "null"]
    CardVerificationAdditionalFile:
      allOf:
        -
          $ref: '#/components/schemas/CardVerificationFile'
        -
          type: object
          properties:
            original_name:
              type: [string, "null"]
            mime:
              type: [string, "null"]
            size:
              type: [integer, "null"]
              minimum: 0
    CardVerification:
      type: object
      required:
        - id
        - card_mask
        - status
        - file
        - additional_files
      properties:
        id:
          type: integer
        uuid:
          type: [string, "null"]
        order_id:
          type: [integer, "null"]
        currency_id:
          type: [integer, "null"]
        name:
          type: [string, "null"]
        card_mask:
          type: string
        status:
          $ref: '#/components/schemas/VerificationStatus'
        file:
          $ref: '#/components/schemas/CardVerificationFile'
        additional_files:
          type: array
          items:
            $ref: '#/components/schemas/CardVerificationAdditionalFile'
        message:
          type: [string, "null"]
        created_at:
          type: [string, "null"]
          format: date-time
        updated_at:
          type: [string, "null"]
          format: date-time
    OrderVerificationSubmitRequest:
      type: object
      properties:
        identity:
          anyOf:
            - $ref: '#/components/schemas/IdentityVerificationCreateRequest'
            - type: 'null'
        card:
          anyOf:
            - $ref: '#/components/schemas/CardVerificationCreateRequest'
            - type: 'null'
      anyOf:
        - required:
            - identity
          properties:
            identity:
              type: object
              minProperties: 1
        - required:
            - card
          properties:
            card:
              type: object
              minProperties: 1
    ReviewCreateRequest:
      type: object
      required:
        - name
        - text
      properties:
        name:
          type: string
          maxLength: 40
        text:
          type: string
          maxLength: 200
        rating:
          type:
            - integer
            - 'null'
          minimum: 1
          maximum: 5
        rate_speed:
          type:
            - integer
            - 'null'
          minimum: 1
          maximum: 5
        order_id:
          type:
            - string
            - 'null'
          maxLength: 64
        tracking_id:
          type:
            - string
            - 'null'
          maxLength: 64
      anyOf:
        - required:
            - order_id
          properties:
            order_id:
              type: string
              pattern: \S
        - required:
            - tracking_id
          properties:
            tracking_id:
              type: string
              pattern: \S
      description: Передайте непустой order_id или tracking_id. Если заполнены оба идентификатора, используется tracking_id. Если заданы
        обе оценки, используется rate_speed.
    Review:
      type: object
      properties:
        id:
          type: integer
        status:
          type: object
          properties:
            id:
              type: integer
            name:
              type: string
              enum:
                - published
                - moderation
            is_published:
              type: boolean
        name:
          type: [string, "null"]
        text:
          type: [string, "null"]
        rating:
          type: integer
        order:
          type: [object, "null"]
        timestamps:
          type: object
    ContractVersion:
      type: object
      required:
        - key
        - version
        - title
        - status
        - stability
        - description
        - headers
        - schemas
      properties:
        key:
          type: string
          example: operation-contract
        version:
          type: string
          example: operation-contract-v1
        title:
          type: string
        status:
          type: string
          example: current
        stability:
          type: string
          example: stable
        description:
          type: string
        headers:
          type: array
          items:
            type: string
        schemas:
          type: array
          items:
            type: string
    SchemaRegistryItem:
      type: object
      required:
        - key
        - title
        - version
        - contract
        - content_type
        - endpoint
      properties:
        key:
          type: string
          example: success-envelope.v1
        title:
          type: string
        version:
          type: string
        contract:
          type: string
        content_type:
          type: string
          example: application/json
        endpoint:
          type: string
    ClientApiHealth:
      type: object
      required:
        - version
        - status
        - client
        - token
        - quota
        - security
        - webhooks
        - contracts
        - time
      properties:
        version:
          type: string
          example: client-health-v1
        status:
          type: string
          enum:
            - ok
            - warning
            - blocked
        client:
          type: object
          additionalProperties: true
        token:
          type: [object, "null"]
          additionalProperties: true
        security:
          type: [object, "null"]
          additionalProperties: true
        quota:
          type: [object, "null"]
          additionalProperties: true
        webhooks:
          type: object
          additionalProperties: true
        contracts:
          type: object
          additionalProperties: true
        time:
          type: string
          format: date-time
    RouteCapabilities:
      type: object
      required:
        - version
        - route_id
        - status
        - actions
        - amounts
        - rate
        - fields
        - endpoints
        - snapshot
      properties:
        version:
          type: string
          example: route-capabilities-v1
        route_id:
          type: integer
        status:
          type: object
          additionalProperties: true
        actions:
          type: object
          additionalProperties:
            $ref: "#/components/schemas/RouteCapabilityAction"
        amounts:
          type: object
          additionalProperties: true
        rate:
          type: object
          required: [selector_fees]
          properties:
            selector_fees:
              allOf:
                - $ref: "#/components/schemas/ExchangeSelectorFees"
                - type: object
                  required: [title, text]
                  properties:
                    title: { type: [string, "null"] }
                    text: { type: [string, "null"] }
        fields:
          type: array
          items:
            $ref: "#/components/schemas/RouteCapabilityField"
        dynamic_fields:
          $ref: "#/components/schemas/ExchangeDynamicFields"
        requirements:
          $ref: '#/components/schemas/VerificationRequirements'
        files:
          type: object
          properties:
            supported_purposes:
              type: array
              items: { enum: [identity_verification, card_verification] }
            upload_intent_endpoint: { type: string }
            order_field_upload_endpoint: { type: [string, "null"] }
            receipts_endpoint: { type: [string, "null"] }
            receipts_allowed: { type: boolean }
        endpoints:
          type: object
          additionalProperties:
            type: string
          properties:
            status_summary: { type: string }
            payment_status: { type: string }
        snapshot:
          $ref: '#/components/schemas/RouteSnapshot'
        operation_contract:
          $ref: '#/components/schemas/OperationContract'
    WebhookNotification:
      $ref: "#/components/schemas/WebhookNotificationV2"
    WebhookEvent:
      description: "Запись события из центра доставки с данными жизненного цикла."
      type: object
      required:
        - id
        - type
        - status
        - payload
        - deliveries_count
      properties:
        id:
          type: string
          format: uuid
        type:
          type: string
          example: order.created
        resource:
          type: object
          additionalProperties: true
        status:
          type: string
        request_id:
          type: [string, "null"]
        correlation_id:
          type: [string, "null"]
        idempotency_key:
          type: [string, "null"]
        payload:
          type: object
          required: [payload_version]
          properties:
            payload_version: { const: v2 }
        deliveries_count:
          type: integer
        deliveries:
          type: array
          items:
            $ref: '#/components/schemas/WebhookDelivery'
        created_at:
          type: [string, "null"]
          format: date-time
    WebhookDelivery:
      type: object
      required:
        - id
        - status
        - attempt
        - endpoint
        - event
        - payload_version
        - signature_version
        - retry_blocked_reason
      properties:
        payload_version: { type: [string, "null"], enum: [v2, null] }
        signature_version: { type: [string, "null"], enum: [v2, null] }
        retry_blocked_reason: { type: [string, "null"], enum: [protocol_retired, null] }
        id:
          type: string
          format: uuid
        status:
          type: string
          enum:
            - queued
            - sending
            - succeeded
            - failed
        attempt:
          type: integer
        endpoint:
          type: [object, "null"]
          additionalProperties: true
        event:
          type: [object, "null"]
          additionalProperties: true
        request:
          type: object
          additionalProperties: true
        response:
          type: object
          description: "Диагностические метаданные. Тело ответа получателя скрыто."
          required: [status, body, duration_ms]
          properties:
            status:
              type: [integer, "null"]
            body:
              type: "null"
            duration_ms:
              type: [integer, "null"]
        attempts:
          type: array
          items:
            $ref: "#/components/schemas/WebhookDeliveryAttempt"
        error:
          type: object
          additionalProperties: true
        next_retry_at:
          type: [string, "null"]
          format: date-time
        delivered_at:
          type: [string, "null"]
          format: date-time
    WebhookDeliveryAttempt:
      type: object
      required: [attempt, status, response_status, error_code, duration_ms, started_at, finished_at, next_retry_at]
      properties:
        attempt:
          type: integer
        status:
          type: string
        response_status:
          type: [integer, "null"]
        error_code:
          type: [string, "null"]
        duration_ms:
          type: [integer, "null"]
        started_at:
          type: string
          format: date-time
        finished_at:
          type: [string, "null"]
          format: date-time
        next_retry_at:
          type: [string, "null"]
          format: date-time
    WebhookEventCatalogItem:
      type: object
      required:
        - event
        - title
      properties:
        event:
          type: string
          example: order.status_changed
        title:
          type: string
    WebhookEndpoint:
      type: object
      required:
        - id
        - name
        - url
        - events
        - status
        - signing_algorithm
      properties:
        payload_version:
          $ref: "#/components/schemas/WebhookPayloadVersion"
        id:
          type: string
          format: uuid
        name:
          type: string
        url:
          type: string
          format: uri
        events:
          type: array
          items:
            type: string
        status:
          type: string
          enum:
            - active
            - paused
            - disabled
        signing_algorithm:
          type: string
          const: hmac-sha256-v2
        secret_fingerprint:
          type: [string, "null"]
        failure_count:
          type: integer
        last_delivery_at:
          type: [string, "null"]
          format: date-time
        last_success_at:
          type: [string, "null"]
          format: date-time
        last_failure_at:
          type: [string, "null"]
          format: date-time
        created_at:
          type: [string, "null"]
          format: date-time
        updated_at:
          type: [string, "null"]
          format: date-time
    WebhookEndpointCreate:
      type: object
      required:
        - name
        - url
        - events
      properties:
        payload_version:
          $ref: "#/components/schemas/WebhookPayloadVersion"
        name:
          type: string
          maxLength: 80
        url:
          $ref: '#/components/schemas/WebhookDeliveryTargetUrl'
        events:
          type: array
          minItems: 1
          items:
            type: string
    WebhookEndpointUpdate:
      type: object
      properties:
        payload_version:
          $ref: "#/components/schemas/WebhookPayloadVersion"
          description: При передаче поля доступно только значение v2.
        name:
          type: string
          maxLength: 80
        url:
          $ref: '#/components/schemas/WebhookDeliveryTargetUrl'
        events:
          type: array
          minItems: 1
          items:
            type: string
        status:
          type: string
          enum:
            - active
            - paused
            - disabled
    WebhookDeliveryTargetUrl:
      type: string
      format: uri
      maxLength: 500
      description: >-
        HTTPS-адрес, который разрешается только в публичные IP. HTTP доступен
        при явном включении режима совместимости на установке. Укажите
        конечный адрес для прямой доставки без редиректов.
    WebhookTestRequest:
      type: object
      properties:
        endpoint_id:
          type: [string, "null"]
          format: uuid
        event_type:
          type: string
          description: "Выбирает подписку и образец. Отправленное событие всегда имеет тип api.test."
          example: api.test
        payload:
          type: object
          additionalProperties: true
    WebhookTestResult:
      type: object
      properties:
        event:
          type: object
          properties:
            id:
              type: string
              format: uuid
            type:
              type: string
              const: api.test
            status:
              type: string
            request_id:
              type: string
            correlation_id:
              type: string
        deliveries:
          type: array
          items:
            type: object
            required: [payload_version, signature_version, retry_blocked_reason]
            properties:
              payload_version:
                $ref: "#/components/schemas/WebhookPayloadVersion"
              signature_version: { const: v2 }
              retry_blocked_reason: { type: "null" }
              id:
                type: string
                format: uuid
              status:
                type: string
              endpoint_id:
                type: string
                format: uuid
