{
  "openapi": "3.1.0",
  "info": {
    "title": "Svift Shop API",
    "version": "1.0.0",
    "description": "Server-to-server procurement API for websites, applications and Telegram bots. Every integration has one USD project account, owner-controlled credit (zero by default), procurement prices from the shared source cost and configurable category supply modifiers (10% API and 15% new shops by default; existing conditions are preserved), and durable unfunded purchase requests (HTTP 202). The integration accepts its retail payments independently. Project funding is available only in the owner cabinet. USD integer-string fields ending _usd_micros are authoritative; RUB _kopeks fields are indicative. Keep keys on the server. Available to registered users through their approved project and server API key. Documentation requires an authenticated account."
  },
  "servers": [
    {
      "url": "https://sviftstore.com/api/shop/v1"
    }
  ],
  "security": [
    {
      "ShopKey": []
    }
  ],
  "components": {
    "securitySchemes": {
      "ShopKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "svift_shop_<43 characters>"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "request_id": {
                "type": "string"
              }
            }
          }
        }
      },
      "Customer": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "telegram_id": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,18}$"
          },
          "username": {
            "type": "string"
          }
        },
        "required": [
          "telegram_id"
        ]
      },
      "Purchase": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ExternalPurchase"
          },
          {
            "$ref": "#/components/schemas/TelegramPurchase"
          }
        ],
        "description": "Выберите ровно один тип identity: customer_id либо telegram_id. Остальные параметры одинаковы."
      },
      "NotificationAck": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "lease_token": {
            "type": "string",
            "format": "uuid",
            "example": "12345678-1234-1234-1234-123456789abc",
            "description": "Идентификатор попытки из notifications/claim. Сохраняйте вместе с attempt_count: прежний lease_token не подтверждает доставку после ручного повтора."
          },
          "attempt_count": {
            "type": "integer",
            "minimum": 1
          },
          "telegram_message_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "ID доставленного сообщения для настоящего Telegram-чата. Обязателен для chat-событий Telegram-покупателя; для внешнего покупателя external_id не нужен и не сохраняется как фиктивная Telegram-квитанция.",
            "maximum": 2147483647
          }
        },
        "required": [
          "lease_token",
          "attempt_count"
        ]
      },
      "NotificationNack": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "lease_token": {
            "type": "string",
            "format": "uuid",
            "example": "12345678-1234-1234-1234-123456789abc",
            "description": "Идентификатор попытки из notifications/claim."
          },
          "attempt_count": {
            "type": "integer",
            "minimum": 1
          },
          "permanent": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "maxLength": 240
          }
        },
        "required": [
          "lease_token",
          "attempt_count"
        ]
      },
      "OrderMessage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "message": {
            "type": "string",
            "maxLength": 4096
          },
          "entities": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "attachment_ref": {
            "type": "string"
          },
          "request_key": {
            "type": "string",
            "minLength": 8,
            "maxLength": 80
          },
          "telegram_message_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        },
        "required": [
          "request_key"
        ]
      },
      "SupportMessage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "body": {
            "type": "string"
          },
          "entities": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "request_key": {
            "type": "string"
          },
          "request_id": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,18}$",
            "description": "ID действующего запроса из SupportStartRequest; защищает от отправки в другое обращение после закрытия."
          }
        },
        "required": [
          "body",
          "request_key"
        ]
      },
      "SupportRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "request_key": {
            "type": "string"
          }
        },
        "required": [
          "request_key"
        ]
      },
      "SupportAck": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "lease_token": {
            "type": "string",
            "minLength": 32,
            "maxLength": 32
          },
          "error_code": {
            "type": "string"
          }
        },
        "required": [
          "lease_token"
        ]
      },
      "ProjectIdentity": {
        "type": "object",
        "properties": {
          "project_account": {
            "type": "boolean",
            "description": "true — закупки списываются со счёта API-проекта.",
            "enum": [
              true
            ]
          },
          "bot_id": {
            "type": "integer",
            "format": "int64"
          },
          "partner_id": {
            "type": "integer",
            "format": "int64"
          },
          "bot_code": {
            "type": "string"
          },
          "partner_code": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          },
          "approval_state": {
            "type": "string"
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          }
        },
        "required": [
          "project_account",
          "bot_id",
          "partner_id",
          "active",
          "approval_state",
          "currency"
        ]
      },
      "QuantityConfig": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "min": {
            "type": "integer"
          },
          "max": {
            "type": "integer"
          },
          "step": {
            "type": "integer"
          },
          "default": {
            "type": "integer"
          },
          "unit": {
            "type": "string"
          },
          "template": {
            "type": "string"
          },
          "unit_price": {
            "type": "string",
            "description": "Цена единицы в рублях, десятичная строка до шести знаков."
          }
        },
        "required": [
          "enabled"
        ]
      },
      "CatalogOffer": {
        "type": "object",
        "properties": {
          "product_id": {
            "type": "integer",
            "format": "int64"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "price_kopeks": {
            "type": "integer",
            "description": "Закупочная цена в целых копейках.",
            "format": "int64"
          },
          "quantity_config": {
            "$ref": "#/components/schemas/QuantityConfig"
          },
          "delivery_type": {
            "type": "string",
            "enum": [
              "manual",
              "automatic"
            ]
          },
          "manual_instruction": {
            "type": "string",
            "description": "Инструкция для user_input ручного товара."
          },
          "photo_ref": {
            "type": "string"
          },
          "position": {
            "type": "integer"
          },
          "active": {
            "type": "boolean"
          },
          "product_active": {
            "type": "boolean"
          },
          "price_usd_micros": {
            "type": "string",
            "pattern": "^-?[0-9]+$",
            "description": "Authoritative USD unit price for Shop API, in millionths. Fixed unit price; with quantity_config multiply by the selected quantity. RUB price_kopeks is an indicative quote."
          },
          "fx_rub_per_usd": {
            "type": "string",
            "description": "Reference RUB per USD for the displayed RUB quote."
          },
          "source_currency": {
            "type": "string",
            "description": "Исходная валюта закупки, например USD или CNY."
          },
          "source_price": {
            "type": "string",
            "pattern": "^[0-9]+(?:\\.[0-9]+)?$",
            "description": "Цена поставки единицы в исходной валюте с применённым модификатором."
          },
          "supply_factor": {
            "type": "string",
            "description": "Применённый модификатор поставки. 1.10 означает +10%."
          }
        },
        "required": [
          "product_id",
          "title",
          "price_kopeks",
          "quantity_config",
          "delivery_type",
          "price_usd_micros",
          "fx_rub_per_usd"
        ]
      },
      "CatalogSection": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "parent_id": {
            "type": "integer",
            "format": "int64"
          },
          "code": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "manual_instruction": {
            "type": "string"
          },
          "photo_ref": {
            "type": "string"
          },
          "position": {
            "type": "integer"
          },
          "active": {
            "type": "boolean"
          },
          "child_bots_available": {
            "type": "boolean"
          },
          "offers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CatalogOffer"
            }
          }
        },
        "required": [
          "id",
          "code",
          "title",
          "offers"
        ]
      },
      "PurchaseResult": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "manual",
              "automatic"
            ]
          },
          "purchase_id": {
            "type": "integer",
            "description": "ID финансовой покупки.",
            "format": "int64"
          },
          "order_id": {
            "type": "integer",
            "description": "ID ручного заказа, отличается от purchase_id.",
            "format": "int64"
          },
          "codes": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "Данные автоматической выдачи. Не включать в журнал."
            }
          },
          "balance_after_usd_micros": {
            "type": "string",
            "pattern": "^-?[0-9]+$",
            "description": "Immutable USD balance after this purchase."
          },
          "total_usd_micros": {
            "type": "string",
            "pattern": "^-?[0-9]+$",
            "description": "Immutable USD debit for this purchase."
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          }
        },
        "required": [
          "type",
          "purchase_id",
          "currency",
          "total_usd_micros",
          "balance_after_usd_micros"
        ]
      },
      "AccountOperation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "topup",
              "purchase",
              "refund",
              "adjustment"
            ]
          },
          "amount_kopeks": {
            "type": "string"
          },
          "balance_after_kopeks": {
            "type": "string"
          },
          "purchase_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "amount_usd_micros": {
            "type": "string",
            "pattern": "^-?[0-9]+$",
            "description": "Immutable operation amount in millionths of USD."
          },
          "balance_after_usd_micros": {
            "type": "string",
            "pattern": "^-?[0-9]+$",
            "description": "USD balance immediately after this operation."
          }
        }
      },
      "AccountPurchase": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "product": {
            "type": "string"
          },
          "quantity": {
            "type": "integer"
          },
          "total_kopeks": {
            "type": "string"
          },
          "refunded_kopeks": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "total_usd_micros": {
            "type": "string",
            "pattern": "^-?[0-9]+$",
            "description": "Immutable purchase total in millionths of USD."
          },
          "refunded_usd_micros": {
            "type": "string",
            "pattern": "^-?[0-9]+$",
            "description": "Cumulative refund in millionths of USD."
          }
        }
      },
      "CustomerView": {
        "type": "object",
        "properties": {
          "blocked": {
            "type": "boolean"
          },
          "telegram_id": {
            "type": "string"
          },
          "username": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "customer_id": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,18}$"
          }
        },
        "required": [
          "blocked",
          "telegram_id",
          "username",
          "customer_id"
        ]
      },
      "PurchaseHistoryItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "product_name": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "format": "int64"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "product_name",
          "quantity",
          "status"
        ]
      },
      "PurchaseHistoryPage": {
        "type": "object",
        "properties": {
          "items": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PurchaseHistoryItem"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "total": {
            "type": "integer",
            "format": "int64"
          },
          "success_count": {
            "type": "integer",
            "format": "int64"
          },
          "failed_count": {
            "type": "integer",
            "format": "int64"
          },
          "pending_count": {
            "type": "integer",
            "format": "int64"
          },
          "refunded_count": {
            "type": "integer",
            "format": "int64"
          },
          "cancelled_count": {
            "type": "integer",
            "format": "int64"
          }
        },
        "required": [
          "items",
          "total",
          "success_count",
          "failed_count",
          "pending_count",
          "refunded_count",
          "cancelled_count"
        ]
      },
      "OrderView": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "order_ref": {
            "type": "string"
          },
          "product_name": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "format": "int64"
          },
          "quantity_unit": {
            "type": "string"
          },
          "total_price": {
            "type": "string",
            "description": "Денежная сумма в рублях, десятичная строка."
          },
          "user_input": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "processed_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "order_ref",
          "product_name",
          "quantity",
          "quantity_unit",
          "total_price",
          "user_input",
          "status",
          "created_at"
        ]
      },
      "OrderChatMessage": {
        "type": "object",
        "properties": {
          "entities": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/EmojiEntity"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "sender_type": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "attachment_ref": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "entities",
          "id",
          "sender_type",
          "message",
          "created_at"
        ]
      },
      "OrderChatPage": {
        "type": "object",
        "properties": {
          "items": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/OrderChatMessage"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "older_before": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "newer_after": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "items",
          "older_before",
          "newer_after"
        ]
      },
      "PurchaseDetailView": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "product_name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "format": "int64"
          },
          "total_price": {
            "type": "string",
            "description": "Денежная сумма в рублях, десятичная строка."
          },
          "price_per_unit": {
            "type": "string",
            "description": "Денежная сумма в рублях, десятичная строка."
          },
          "quantity_unit": {
            "type": "string"
          },
          "purchased_at": {
            "type": "string",
            "format": "date-time"
          },
          "codes": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "total_usd_micros": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "Original USD purchase debit in millionths. Present for purchases settled from a USD project account; total_price and price_per_unit retain their historical RUB units."
          }
        },
        "required": [
          "id",
          "product_name",
          "status",
          "quantity",
          "total_price",
          "price_per_unit",
          "quantity_unit",
          "purchased_at",
          "codes"
        ]
      },
      "NotificationView": {
        "type": "object",
        "properties": {
          "lease_token": {
            "type": "string"
          },
          "entities": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/EmojiEntity"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "order_id": {
            "type": "integer",
            "format": "int64"
          },
          "event_type": {
            "type": "string"
          },
          "attempt_count": {
            "type": "integer",
            "format": "int64"
          },
          "message_text": {
            "type": "string"
          },
          "attachment_ref": {
            "type": "string"
          },
          "chat_message_id": {
            "type": "integer",
            "format": "int64"
          },
          "customer_id": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,18}$",
            "description": "Непрозрачный идентификатор. Храните строкой: может превышать точность JavaScript Number."
          }
        },
        "required": [
          "lease_token",
          "entities",
          "id",
          "order_id",
          "event_type",
          "attempt_count",
          "customer_id"
        ]
      },
      "EmojiEntity": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "offset": {
            "type": "integer",
            "format": "int64"
          },
          "length": {
            "type": "integer",
            "format": "int64"
          },
          "custom_emoji_id": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "offset",
          "length",
          "custom_emoji_id"
        ]
      },
      "CreatedChatMessage": {
        "type": "object",
        "properties": {
          "entities": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/EmojiEntity"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "order_id": {
            "type": "integer",
            "format": "int64"
          },
          "sender_type": {
            "type": "string"
          },
          "sender_telegram_id": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "admin_message_id": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "admin_chat_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "user_message_id": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          },
          "user_chat_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "attachment_ref": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "attachment_mime": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "entities",
          "id",
          "order_id",
          "sender_type",
          "sender_telegram_id",
          "message",
          "admin_message_id",
          "admin_chat_id",
          "user_message_id",
          "user_chat_id",
          "attachment_ref",
          "attachment_mime",
          "created_at"
        ]
      },
      "SupportResponseCustomer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "store_id": {
            "type": "string"
          },
          "store_name": {
            "type": "string"
          },
          "auth_user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "wallet_user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "telegram_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "type": "string"
          },
          "username": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "avatar_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "registered_at": {
            "type": "string",
            "format": "date-time"
          },
          "balance": {
            "type": "string"
          },
          "restriction": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SupportResponseRestriction"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "store_id",
          "store_name",
          "auth_user_id",
          "wallet_user_id",
          "telegram_id",
          "name",
          "username",
          "email",
          "avatar_url",
          "registered_at",
          "balance",
          "restriction"
        ]
      },
      "SupportResponseRestriction": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string"
          },
          "until": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "kind",
          "until"
        ]
      },
      "SupportResponseConversation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "customer": {
            "$ref": "#/components/schemas/SupportResponseCustomer"
          },
          "status": {
            "type": "string"
          },
          "awaiting_since": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_message_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_message_id": {
            "type": "string"
          },
          "last_customer_message_id": {
            "type": "string"
          },
          "unread": {
            "type": "integer"
          },
          "version": {
            "type": "string"
          },
          "preview": {
            "type": "string"
          },
          "preview_entities": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/SupportResponseCustomEmojiEntity"
            }
          },
          "match_message_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "request": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SupportResponseRequest"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "customer",
          "status",
          "awaiting_since",
          "last_message_at",
          "last_message_id",
          "last_customer_message_id",
          "unread",
          "version",
          "preview",
          "match_message_id",
          "request"
        ]
      },
      "SupportResponseRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "conversation_id": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "closed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "closed_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "conversation_id",
          "created_at",
          "closed_at",
          "closed_by"
        ]
      },
      "SupportResponseMessage": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "conversation_id": {
            "type": "string"
          },
          "sender": {
            "type": "string"
          },
          "staff_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "staff_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "owner_account_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "body": {
            "type": "string"
          },
          "entities": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/SupportResponseCustomEmojiEntity"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "attachment": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SupportResponseAttachment"
              },
              {
                "type": "null"
              }
            ]
          },
          "delivery_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "request_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "system_event": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "conversation_id",
          "sender",
          "staff_id",
          "staff_name",
          "body",
          "created_at",
          "attachment",
          "delivery_status",
          "request_id",
          "system_event"
        ]
      },
      "SupportResponseAttachment": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "mime": {
            "type": "string"
          },
          "size": {
            "type": "integer"
          }
        },
        "required": [
          "name",
          "mime",
          "size"
        ]
      },
      "SupportResponseMessagePage": {
        "type": "object",
        "properties": {
          "items": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/SupportResponseMessage"
            }
          },
          "has_older": {
            "type": "boolean"
          },
          "has_newer": {
            "type": "boolean"
          },
          "delivery_updates": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/SupportResponseDeliveryUpdate"
            }
          }
        },
        "required": [
          "items",
          "has_older",
          "has_newer",
          "delivery_updates"
        ]
      },
      "SupportResponseDeliveryUpdate": {
        "type": "object",
        "properties": {
          "message_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "message_id",
          "status"
        ]
      },
      "SupportResponseDelivery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "lease_token": {
            "type": "string"
          },
          "telegram_id": {
            "type": "string",
            "description": "Историческое имя identity получателя. Для внешнего клиента это строковый customer_id, а не настоящий Telegram chat_id. Доставляйте через свой канал."
          },
          "conversation_id": {
            "type": "string"
          },
          "message": {
            "$ref": "#/components/schemas/SupportResponseMessage"
          },
          "attempts": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "lease_token",
          "telegram_id",
          "conversation_id",
          "message",
          "attempts"
        ]
      },
      "SupportResponseCustomEmojiEntity": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "offset": {
            "type": "integer"
          },
          "length": {
            "type": "integer"
          },
          "custom_emoji_id": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "offset",
          "length",
          "custom_emoji_id"
        ]
      },
      "ExternalCustomerInput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "external_id"
        ],
        "properties": {
          "external_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Ваш стабильный ID клиента, например website:user-42. От 1 до 128 байт UTF-8, без управляющих символов и пробелов по краям. Только для Shop API project_balance."
          }
        },
        "example": {
          "external_id": "website:user-42"
        }
      },
      "ExternalCustomer": {
        "type": "object",
        "required": [
          "customer_id",
          "external_id",
          "blocked"
        ],
        "properties": {
          "customer_id": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,18}$",
            "description": "Непрозрачный идентификатор. Храните строкой: может превышать точность JavaScript Number."
          },
          "external_id": {
            "type": "string"
          },
          "blocked": {
            "type": "boolean"
          }
        },
        "example": {
          "customer_id": "7000000000000000001",
          "external_id": "website:user-42",
          "blocked": false
        }
      },
      "QueuedPurchaseResult": {
        "type": "object",
        "required": [
          "type",
          "request_id"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "awaiting_funds"
            ]
          },
          "request_id": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,18}$",
            "description": "Непрозрачный идентификатор. Храните строкой: может превышать точность JavaScript Number."
          },
          "purchase_id": {
            "type": "integer",
            "enum": [
              0
            ],
            "description": "До финансирования оплаченной покупки нет; purchase_id равен нулю. Не используйте его как ID заказа."
          }
        },
        "example": {
          "type": "awaiting_funds",
          "request_id": "123",
          "purchase_id": 0
        }
      },
      "ShopPurchaseRequest": {
        "type": "object",
        "required": [
          "id",
          "request_key",
          "customer_id",
          "product_id",
          "quantity",
          "required_total_kopeks",
          "state",
          "purchase_id",
          "error_code",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,18}$",
            "description": "Непрозрачный идентификатор. Храните строкой: может превышать точность JavaScript Number."
          },
          "request_key": {
            "type": "string",
            "description": "8–80 байт UTF-8; исходный ключ покупки."
          },
          "customer_id": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,18}$",
            "description": "Непрозрачный идентификатор. Храните строкой: может превышать точность JavaScript Number."
          },
          "product_id": {
            "type": "integer",
            "minimum": 1
          },
          "product_name": {
            "type": "string",
            "description": "Текущее название товара; не часть финансового снимка."
          },
          "category_name": {
            "type": "string",
            "description": "Текущая категория товара."
          },
          "quantity": {
            "type": "integer",
            "minimum": 1
          },
          "required_total_kopeks": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "state": {
            "type": "string",
            "enum": [
              "awaiting_funds",
              "needs_confirmation",
              "blocked",
              "fulfilled",
              "cancelled"
            ]
          },
          "purchase_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "error_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expected_price_usd_micros": {
            "type": "string",
            "pattern": "^-?[0-9]+$",
            "description": "Confirm the authoritative USD quote: unit amount for fixed SKUs, selected total for enabled quantity_config. FX alone does not invalidate USD confirmation."
          },
          "required_total_usd_micros": {
            "type": "string",
            "pattern": "^-?[0-9]+$",
            "description": "Confirmed USD amount required to process this pending purchase."
          }
        }
      },
      "ExternalPurchase": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "product_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "ID товара из каталога этого проекта."
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000,
            "description": "Количество по min/max/step. Без quantity_config — от1до100."
          },
          "user_input": {
            "type": "string",
            "maxLength": 4096,
            "description": "Для ручной выдачи обязателен. Данные по manual_instruction; максимум4096байт UTF-8."
          },
          "customer_profile": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "first_name": {
                "type": "string",
                "maxLength": 256
              },
              "last_name": {
                "type": "string",
                "maxLength": 256
              },
              "username": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 32
              }
            },
            "required": []
          },
          "request_key": {
            "type": "string",
            "minLength": 8,
            "maxLength": 80,
            "description": "Сохраните до запроса. При повторе — те же параметры и ключ; для новой покупки — новый ключ."
          },
          "customer_id": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,18}$",
            "description": "Непрозрачный идентификатор. Храните строкой: может превышать точность JavaScript Number."
          },
          "expected_price_usd_micros": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,18}$",
            "description": "Confirm the authoritative USD quote: unit amount for fixed SKUs, selected total for enabled quantity_config. FX alone does not invalidate USD confirmation."
          }
        },
        "required": [
          "customer_id",
          "product_id",
          "quantity",
          "request_key",
          "expected_price_usd_micros"
        ]
      },
      "TelegramPurchase": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "telegram_id": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,18}$",
            "description": "Telegram ID из проверенного update Вашего бота; передаётся строкой."
          },
          "product_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "ID товара из каталога этого проекта."
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000,
            "description": "Количество по min/max/step. Без quantity_config — от1до100."
          },
          "user_input": {
            "type": "string",
            "maxLength": 4096,
            "description": "Для ручной выдачи обязателен. Данные по manual_instruction; максимум4096байт UTF-8."
          },
          "customer_profile": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "first_name": {
                "type": "string",
                "maxLength": 256
              },
              "last_name": {
                "type": "string",
                "maxLength": 256
              },
              "username": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 32
              }
            },
            "required": []
          },
          "request_key": {
            "type": "string",
            "minLength": 8,
            "maxLength": 80,
            "description": "Сохраните до запроса. При повторе — те же параметры и ключ; для новой покупки — новый ключ."
          },
          "expected_price_usd_micros": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,18}$",
            "description": "Confirm the authoritative USD quote: unit amount for fixed SKUs, selected total for enabled quantity_config. FX alone does not invalidate USD confirmation."
          }
        },
        "required": [
          "telegram_id",
          "product_id",
          "quantity",
          "request_key",
          "expected_price_usd_micros"
        ]
      }
    }
  },
  "paths": {
    "/catalog": {
      "get": {
        "operationId": "Catalog",
        "summary": "Catalog",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Категории и закупочные предложения проекта.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sections": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/CatalogSection"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "sections": [
                      {
                        "id": 1,
                        "code": "games",
                        "title": "Игры",
                        "active": true,
                        "position": 0,
                        "child_bots_available": true,
                        "offers": [
                          {
                            "product_id": 123,
                            "title": "Пример товара",
                            "price_kopeks": 1000,
                            "quantity_config": {
                              "enabled": false
                            },
                            "delivery_type": "manual",
                            "manual_instruction": "Укажите данные для выполнения",
                            "active": true,
                            "product_active": true,
                            "position": 0,
                            "price_usd_micros": "125000",
                            "fx_rub_per_usd": "80"
                          }
                        ]
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customers/ensure": {
      "post": {
        "operationId": "EnsureCustomer",
        "summary": "EnsureCustomer",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Стабильный покупатель текущего проекта: external_id для любого приложения либо проверенный Telegram ID.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/ExternalCustomer"
                        },
                        {
                          "$ref": "#/components/schemas/CustomerView"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ExternalCustomerInput"
                  },
                  {
                    "$ref": "#/components/schemas/Customer"
                  }
                ]
              },
              "example": {
                "external_id": "website:user-42"
              }
            }
          }
        }
      }
    },
    "/self": {
      "get": {
        "operationId": "Self",
        "summary": "Self",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Информация об авторизованном проекте.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ProjectIdentity"
                    }
                  }
                },
                "example": {
                  "data": {
                    "project_account": true,
                    "currency": "USD",
                    "bot_id": 111,
                    "partner_id": 1,
                    "bot_code": "API_EXAMPLE",
                    "partner_code": "EXAMPLE",
                    "active": true,
                    "approval_state": "approved"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/purchases": {
      "post": {
        "operationId": "Purchase",
        "summary": "Purchase",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Сохранённый результат покупки. Повтор попытки возвращает исходный результат.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/PurchaseResult"
                    }
                  }
                },
                "example": {
                  "data": {
                    "type": "manual",
                    "purchase_id": 123,
                    "order_id": 456,
                    "currency": "USD",
                    "total_usd_micros": "125000",
                    "balance_after_usd_micros": "875000"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "202": {
            "description": "Заявка сохранена, но ещё не оплачена. Нет списания, заказа исполнителю и резервирования кодов. Читайте purchase-requests до fulfilled; не сообщайте покупателю о выдаче.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/QueuedPurchaseResult"
                    }
                  },
                  "required": [
                    "data"
                  ]
                },
                "example": {
                  "data": {
                    "type": "awaiting_funds",
                    "request_id": "123",
                    "purchase_id": 0
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Purchase"
              },
              "example": {
                "product_id": 123,
                "quantity": 1,
                "user_input": "Данные по инструкции товара",
                "request_key": "example-order-0001",
                "customer_id": "7000000000000000001",
                "expected_price_usd_micros": "125000"
              }
            }
          }
        }
      }
    },
    "/customers/{telegramID}": {
      "get": {
        "operationId": "GetCustomer",
        "summary": "GetCustomer",
        "parameters": [
          {
            "in": "path",
            "name": "telegramID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Покупатель текущего проекта. Для внешней identity возвращает customer_id/external_id, а не Telegram-профиль.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/ExternalCustomer"
                        },
                        {
                          "$ref": "#/components/schemas/CustomerView"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data"
                  ]
                },
                "example": {
                  "data": {
                    "customer_id": "123456789",
                    "telegram_id": "123456789",
                    "username": "example_customer",
                    "blocked": false
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{telegramID}/purchases": {
      "get": {
        "operationId": "PurchaseHistory",
        "summary": "PurchaseHistory",
        "parameters": [
          {
            "in": "path",
            "name": "telegramID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Страница истории покупок. page начинается с нуля; items может быть пустым.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/PurchaseHistoryPage"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{telegramID}/purchases/{purchaseID}": {
      "get": {
        "operationId": "PurchaseDetail",
        "summary": "PurchaseDetail",
        "parameters": [
          {
            "in": "path",
            "name": "telegramID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "path",
            "name": "purchaseID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Сохранённая покупка. Для ручного заказа результат выполнения проверяется отдельно.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/PurchaseDetailView"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{telegramID}/orders/{orderID}": {
      "get": {
        "operationId": "GetOrder",
        "summary": "GetOrder",
        "parameters": [
          {
            "in": "path",
            "name": "telegramID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "path",
            "name": "orderID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Покупательские сведения о ручном заказе.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/OrderView"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{telegramID}/orders/{orderID}/messages": {
      "get": {
        "operationId": "ListChat",
        "summary": "ListChat",
        "parameters": [
          {
            "in": "path",
            "name": "telegramID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "path",
            "name": "orderID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "query",
            "name": "before",
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            },
            "description": "Сообщения до этого ID. не передавайте вместе с after."
          },
          {
            "in": "query",
            "name": "after",
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            },
            "description": "Сообщения после этого ID. не передавайте вместе с before."
          },
          {
            "in": "query",
            "name": "limit",
            "description": "Размер страницы от 1 до 50; по умолчанию 50. Всегда возвращается объект страницы.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Страница сообщений с курсорами, по умолчанию 50 сообщений. before и after вместе не передаются.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/OrderChatPage"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "PostChat",
        "summary": "PostChat",
        "parameters": [
          {
            "in": "path",
            "name": "telegramID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "path",
            "name": "orderID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Сохранённое сообщение заказа. Повтор использует тот же request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CreatedChatMessage"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderMessage"
              }
            }
          }
        }
      }
    },
    "/customers/{telegramID}/orders/{orderID}/attachments": {
      "post": {
        "operationId": "UploadAttachment",
        "summary": "UploadAttachment",
        "parameters": [
          {
            "in": "path",
            "name": "telegramID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "path",
            "name": "orderID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Сохранённое вложение; передайте attachment_ref при отправке сообщения.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "attachment_ref": {
                          "type": "string"
                        },
                        "attachment_mime": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "image/jpeg": {
              "schema": {
                "type": "string",
                "format": "binary",
                "description": "JPEG до5МиБ, бинарное тело запроса."
              }
            }
          }
        }
      }
    },
    "/customers/{telegramID}/orders/{orderID}/messages/{messageID}/file": {
      "get": {
        "operationId": "GetChatFile",
        "summary": "GetChatFile",
        "parameters": [
          {
            "in": "path",
            "name": "telegramID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "path",
            "name": "orderID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "path",
            "name": "messageID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Private binary file, authenticated request required; never put a key into the URL.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/notifications/claim": {
      "post": {
        "operationId": "ClaimNotifications",
        "summary": "ClaimNotifications",
        "parameters": [],
        "responses": {
          "200": {
            "description": "До десяти событий текущей попытки доставки.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotificationView"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                },
                "example": {
                  "data": [
                    {
                      "lease_token": "12345678-1234-1234-1234-123456789abc",
                      "entities": [],
                      "id": 1,
                      "order_id": 42,
                      "event_type": "manual_order_completed",
                      "customer_id": "123456789",
                      "attempt_count": 1
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/notifications/{notificationID}/ack": {
      "post": {
        "operationId": "AckNotification",
        "summary": "AckNotification",
        "parameters": [
          {
            "in": "path",
            "name": "notificationID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Результат доставки сохранён.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "ok": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "ok"
                      ]
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NotificationAck"
              }
            }
          }
        }
      }
    },
    "/notifications/{notificationID}/nack": {
      "post": {
        "operationId": "NackNotification",
        "summary": "NackNotification",
        "parameters": [
          {
            "in": "path",
            "name": "notificationID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Результат доставки сохранён.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "ok": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "ok"
                      ]
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NotificationNack"
              }
            }
          }
        }
      }
    },
    "/notifications/{notificationID}/attachment": {
      "get": {
        "operationId": "GetNotificationAttachment",
        "summary": "GetNotificationAttachment",
        "parameters": [
          {
            "in": "path",
            "name": "notificationID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Private binary file, authenticated request required; never put a key into the URL.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{telegramID}/support/avatar": {
      "post": {
        "operationId": "SupportAvatar",
        "summary": "SupportAvatar",
        "parameters": [
          {
            "in": "path",
            "name": "telegramID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response; most commerce methods wrap the result in data. Support methods return their response object directly.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "saved": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "saved"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "image/jpeg": {
              "schema": {
                "type": "string",
                "format": "binary",
                "description": "Изображение аватара в бинарном теле запроса."
              }
            }
          }
        }
      }
    },
    "/customers/{telegramID}/support/capabilities": {
      "get": {
        "operationId": "SupportCapabilities",
        "summary": "SupportCapabilities",
        "parameters": [
          {
            "in": "path",
            "name": "telegramID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response; most commerce methods wrap the result in data. Support methods return their response object directly.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "requests": {
                      "type": "boolean"
                    },
                    "attachments": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "requests",
                    "attachments"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{telegramID}/support/conversation": {
      "post": {
        "operationId": "SupportOpen",
        "summary": "SupportOpen",
        "parameters": [
          {
            "in": "path",
            "name": "telegramID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response; most commerce methods wrap the result in data. Support methods return their response object directly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportResponseConversation"
                }
              }
            }
          },
          "201": {
            "description": "Created or idempotent support response"
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{telegramID}/support/conversations/{conversationID}/requests": {
      "post": {
        "operationId": "SupportStartRequest",
        "summary": "SupportStartRequest",
        "parameters": [
          {
            "in": "path",
            "name": "telegramID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "path",
            "name": "conversationID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Created or idempotent support response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportResponseRequest"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupportRequest"
              }
            }
          }
        }
      }
    },
    "/customers/{telegramID}/support/conversations/{conversationID}/requests/{requestID}/close": {
      "post": {
        "operationId": "SupportClose",
        "summary": "SupportClose",
        "parameters": [
          {
            "in": "path",
            "name": "telegramID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "path",
            "name": "conversationID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "path",
            "name": "requestID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response; most commerce methods wrap the result in data. Support methods return their response object directly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportResponseConversation"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{telegramID}/support/conversations/{conversationID}": {
      "get": {
        "operationId": "SupportConversation",
        "summary": "SupportConversation",
        "parameters": [
          {
            "in": "path",
            "name": "telegramID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "path",
            "name": "conversationID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response; most commerce methods wrap the result in data. Support methods return their response object directly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportResponseConversation"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{telegramID}/support/conversations/{conversationID}/messages": {
      "get": {
        "operationId": "SupportMessages",
        "summary": "SupportMessages",
        "parameters": [
          {
            "in": "path",
            "name": "telegramID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "path",
            "name": "conversationID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "query",
            "name": "before",
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "query",
            "name": "after",
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "query",
            "name": "around",
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response; most commerce methods wrap the result in data. Support methods return their response object directly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportResponseMessagePage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "SupportPostMessage",
        "summary": "SupportPostMessage",
        "parameters": [
          {
            "in": "path",
            "name": "telegramID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "path",
            "name": "conversationID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Created or idempotent support response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportResponseMessage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupportMessage"
              }
            }
          }
        }
      }
    },
    "/customers/{telegramID}/support/conversations/{conversationID}/attachments": {
      "post": {
        "operationId": "SupportAttachment",
        "summary": "SupportAttachment",
        "parameters": [
          {
            "in": "path",
            "name": "telegramID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "path",
            "name": "conversationID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Вложение и сообщение созданы.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportResponseMessage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "description": "Файл вложения.",
                    "format": "binary"
                  },
                  "body": {
                    "type": "string",
                    "description": "Подпись сообщения."
                  },
                  "request_key": {
                    "type": "string",
                    "description": "Постоянный ключ сообщения."
                  },
                  "request_id": {
                    "type": "string",
                    "pattern": "^[1-9][0-9]{0,18}$",
                    "description": "ID действующего запроса из SupportStartRequest. Передавайте, чтобы сообщение осталось связано с тем же обращением при повторе."
                  }
                },
                "required": [
                  "file",
                  "request_key"
                ]
              }
            }
          }
        },
        "description": "Отправьте файл обращения как multipart/form-data. Boundary в заголовке должен совпадать с телом. При использовании FormData или multipart-библиотеки заголовок Content-Type устанавливает HTTP-клиент."
      }
    },
    "/customers/{telegramID}/support/conversations/{conversationID}/messages/{messageID}/file": {
      "get": {
        "operationId": "SupportFile",
        "summary": "SupportFile",
        "parameters": [
          {
            "in": "path",
            "name": "telegramID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "path",
            "name": "conversationID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "path",
            "name": "messageID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Private binary file, authenticated request required; never put a key into the URL.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/support-deliveries/claim": {
      "post": {
        "operationId": "SupportDeliveryClaim",
        "summary": "SupportDeliveryClaim",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful response; most commerce methods wrap the result in data. Support methods return their response object directly.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SupportResponseDelivery"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        }
      }
    },
    "/support-deliveries/{deliveryID}/ack": {
      "post": {
        "operationId": "SupportDeliveryAck",
        "summary": "SupportDeliveryAck",
        "parameters": [
          {
            "in": "path",
            "name": "deliveryID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response; most commerce methods wrap the result in data. Support methods return their response object directly.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupportAck"
              }
            }
          }
        }
      }
    },
    "/support-deliveries/{deliveryID}/nack": {
      "post": {
        "operationId": "SupportDeliveryNack",
        "summary": "SupportDeliveryNack",
        "parameters": [
          {
            "in": "path",
            "name": "deliveryID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response; most commerce methods wrap the result in data. Support methods return their response object directly.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupportAck"
              }
            }
          }
        }
      }
    },
    "/support-deliveries/{deliveryID}/file": {
      "get": {
        "operationId": "SupportDeliveryFile",
        "summary": "SupportDeliveryFile",
        "parameters": [
          {
            "in": "path",
            "name": "deliveryID",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$"
            }
          },
          {
            "in": "header",
            "name": "X-Support-Lease",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 32,
              "maxLength": 32
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Private binary file, authenticated request required; never put a key into the URL.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/account": {
      "get": {
        "operationId": "getProjectAccount",
        "summary": "Read the authenticated Shop API project balance, credit, debt and history",
        "parameters": [
          {
            "name": "before_operation",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]*$"
            }
          },
          {
            "name": "before_purchase",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]*$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Project balance and paginated ledger. All kopeks values are decimal strings; next_operations and next_purchases are cursors.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "balance_kopeks": {
                          "type": "string",
                          "pattern": "^-?[0-9]+$"
                        },
                        "available_kopeks": {
                          "type": "string",
                          "pattern": "^-?[0-9]+$"
                        },
                        "credit_limit_kopeks": {
                          "type": "string",
                          "pattern": "^-?[0-9]+$"
                        },
                        "debt_kopeks": {
                          "type": "string",
                          "pattern": "^-?[0-9]+$"
                        },
                        "topups_kopeks": {
                          "type": "string",
                          "pattern": "^-?[0-9]+$"
                        },
                        "spent_kopeks": {
                          "type": "string",
                          "pattern": "^-?[0-9]+$"
                        },
                        "refunds_kopeks": {
                          "type": "string",
                          "pattern": "^-?[0-9]+$"
                        },
                        "billing_mode": {
                          "type": "string",
                          "enum": [
                            "project_balance"
                          ]
                        },
                        "orders": {
                          "type": "integer"
                        },
                        "pending_orders": {
                          "type": "integer"
                        },
                        "operations": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/AccountOperation"
                          }
                        },
                        "purchases": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/AccountPurchase"
                          }
                        },
                        "next_operations": {
                          "type": "string"
                        },
                        "next_purchases": {
                          "type": "string"
                        },
                        "adjustments_kopeks": {
                          "type": "string",
                          "pattern": "^-?[0-9]+$",
                          "description": "Сумма подписанных ручных корректировок владельца платформы."
                        },
                        "waiting_requests": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Число заявок, ожидающих средств."
                        },
                        "currency": {
                          "type": "string",
                          "enum": [
                            "USD"
                          ]
                        },
                        "balance_usd_micros": {
                          "type": "string",
                          "pattern": "^-?[0-9]+$",
                          "description": "Account balance in millionths of USD. Authoritative when currency=USD."
                        },
                        "credit_limit_usd_micros": {
                          "type": "string",
                          "pattern": "^-?[0-9]+$",
                          "description": "Account credit_limit in millionths of USD. Authoritative when currency=USD."
                        },
                        "available_usd_micros": {
                          "type": "string",
                          "pattern": "^-?[0-9]+$",
                          "description": "Account available in millionths of USD. Authoritative when currency=USD."
                        },
                        "debt_usd_micros": {
                          "type": "string",
                          "pattern": "^-?[0-9]+$",
                          "description": "Account debt in millionths of USD. Authoritative when currency=USD."
                        },
                        "topups_usd_micros": {
                          "type": "string",
                          "pattern": "^-?[0-9]+$",
                          "description": "Account topups in millionths of USD. Authoritative when currency=USD."
                        },
                        "spent_usd_micros": {
                          "type": "string",
                          "pattern": "^-?[0-9]+$",
                          "description": "Account spent in millionths of USD. Authoritative when currency=USD."
                        },
                        "refunds_usd_micros": {
                          "type": "string",
                          "pattern": "^-?[0-9]+$",
                          "description": "Account refunds in millionths of USD. Authoritative when currency=USD."
                        },
                        "adjustments_usd_micros": {
                          "type": "string",
                          "pattern": "^-?[0-9]+$",
                          "description": "Account adjustments in millionths of USD. Authoritative when currency=USD."
                        },
                        "fx_rub_per_usd": {
                          "type": "string",
                          "description": "Reference RUB conversion, not an account revaluation."
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "currency": "USD",
                    "billing_mode": "project_balance",
                    "fx_rub_per_usd": "80",
                    "balance_usd_micros": "0",
                    "available_usd_micros": "0",
                    "credit_limit_usd_micros": "0",
                    "debt_usd_micros": "0",
                    "topups_usd_micros": "0",
                    "spent_usd_micros": "0",
                    "refunds_usd_micros": "0",
                    "adjustments_usd_micros": "0",
                    "balance_kopeks": "0",
                    "available_kopeks": "0",
                    "credit_limit_kopeks": "0",
                    "debt_kopeks": "0",
                    "topups_kopeks": "0",
                    "spent_kopeks": "0",
                    "refunds_kopeks": "0",
                    "adjustments_kopeks": "0",
                    "orders": 0,
                    "pending_orders": 0,
                    "waiting_requests": 0,
                    "operations": [],
                    "purchases": [],
                    "next_operations": "",
                    "next_purchases": ""
                  }
                }
              }
            }
          },
          "503": {
            "description": "API временно недоступен.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/purchase-requests": {
      "get": {
        "operationId": "ListPurchaseRequests",
        "summary": "Заявки до оплаты",
        "description": "До 30 заявок проекта, новые сначала. Доступно ключу только для чтения. Принятые заявки сохраняются после ротации ключа; для остановки используйте отмену заявки или паузу проекта.",
        "parameters": [
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$",
              "description": "Непрозрачный идентификатор. Храните строкой: может превышать точность JavaScript Number."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Заявки в пределах текущего проекта.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "requests",
                        "next"
                      ],
                      "properties": {
                        "requests": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/ShopPurchaseRequest"
                          }
                        },
                        "next": {
                          "type": "string",
                          "description": "before для следующей страницы либо пустая строка."
                        }
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/purchase-requests/{requestID}": {
      "get": {
        "operationId": "GetPurchaseRequest",
        "summary": "Состояние сохранённой заявки",
        "parameters": [
          {
            "name": "requestID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$",
              "description": "Непрозрачный идентификатор. Храните строкой: может превышать точность JavaScript Number."
            },
            "description": "request_id из 202 либо id из списка заявок."
          }
        ],
        "responses": {
          "200": {
            "description": "fulfilled содержит purchase_id. Получите результат исходной покупки тем же request_key либо через детали покупки покупателя.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ShopPurchaseRequest"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/purchase-requests/{requestID}/cancel": {
      "post": {
        "operationId": "CancelPurchaseRequest",
        "summary": "Отменить неоплаченную заявку",
        "description": "Повторная отмена безопасна. Уже оплаченная заявка возвращает 409 REQUEST_ALREADY_FUNDED: нужен возврат оплаченного заказа. Ключ только для чтения не может отменять.",
        "parameters": [
          {
            "name": "requestID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$",
              "description": "Непрозрачный идентификатор. Храните строкой: может превышать точность JavaScript Number."
            },
            "description": "request_id из 202 либо id из списка заявок."
          }
        ],
        "responses": {
          "200": {
            "description": "Заявка отменена и не возобновится.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "state"
                      ],
                      "properties": {
                        "state": {
                          "type": "string",
                          "enum": [
                            "cancelled"
                          ]
                        }
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or expired key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Unapproved project, read-only key or browser request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this store/customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Price/request conflict or sales paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; use Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Неожиданная ошибка сервера. Сохраните request_id; при повторе покупки оставьте прежний request_key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable; purchase retry must keep the same request key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  }
}
