{
  "openapi": "3.0.3",
  "info": {
    "title": "SMSAny Customer API",
    "version": "1.0.0",
    "description": "Self-service API for registered SMSAny accounts. Uses the same prepaid wallet and account-owned orders as the website. API keys never authenticate browser sessions. API protocol is SMSAny-specific, a platform-native endpoint. Amounts are decimal strings; all timestamps are UTC. See docs/customer-api.md for permissions, polling, idempotency, and charging rules."
  },
  "servers": [
    {
      "url": "/",
      "description": "Same deployment origin; configure the actual HTTPS origin in your server application."
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "paths": {
    "/api/v1/catalog/services": {
      "get": {
        "operationId": "listCustomerServices",
        "tags": [
          "Customer"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "SMSAny result. Order creation and termination may still be processing; poll the order.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerCatalogItemPageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          },
          "405": {
            "$ref": "#/components/responses/Error"
          },
          "406": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          }
        },
        "summary": "List account Services"
      }
    },
    "/api/v1/catalog/countries": {
      "get": {
        "operationId": "listCustomerCountries",
        "tags": [
          "Customer"
        ],
        "parameters": [
          {
            "name": "service",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "Service code from the services catalog.",
            "x-description-zh": "服务列表返回的 code。"
          }
        ],
        "responses": {
          "200": {
            "description": "SMSAny result. Order creation and termination may still be processing; poll the order.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerCatalogItemPageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          },
          "405": {
            "$ref": "#/components/responses/Error"
          },
          "406": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          }
        },
        "summary": "List account Countries"
      }
    },
    "/api/v1/purchases": {
      "post": {
        "operationId": "createCustomerPurchase",
        "tags": [
          "Purchases"
        ],
        "parameters": [
          {
            "name": "routeId",
            "in": "query",
            "required": false,
            "description": "Exact routeId from lines. Omit service, country and line when supplied.",
            "x-description-zh": "线路列表返回的 routeId；填写时省略 service、country 和 line。",
            "schema": {
              "type": "string",
              "format": "uuid",
              "example": "00000000-0000-4000-8000-000000000001"
            }
          },
          {
            "name": "service",
            "in": "query",
            "required": false,
            "description": "Service code returned by the services catalog, for example telegram. Required when routeId is omitted; must be omitted when routeId is supplied. Empty optional values are treated as omitted.",
            "x-description-zh": "服务代码，例如 telegram，从服务列表获取。 不填 routeId 时必填；填写 routeId 时请勿填写。 留空按未填写处理。",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "description": "Service code returned by the services catalog, for example telegram. Required when routeId is omitted; must be omitted when routeId is supplied.",
              "example": "telegram",
              "x-description-zh": "服务代码，例如 telegram，从服务列表获取。 不填 routeId 时必填；填写 routeId 时请勿填写。"
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "description": "Two-letter country ISO code, for example US. Required when routeId is omitted; must be omitted when routeId is supplied. Empty optional values are treated as omitted.",
            "x-description-zh": "国家两位 ISO 代码，例如 US。 不填 routeId 时必填；填写 routeId 时请勿填写。 留空按未填写处理。",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z]{2}$",
              "description": "Two-letter country ISO code, for example US. Required when routeId is omitted; must be omitted when routeId is supplied.",
              "example": "US",
              "x-description-zh": "国家两位 ISO 代码，例如 US。 不填 routeId 时必填；填写 routeId 时请勿填写。"
            }
          },
          {
            "name": "line",
            "in": "query",
            "required": false,
            "description": "Public line code returned by the lines endpoint, for example line-01. Scoped to service and country. Omit or use any for automatic selection. Must be omitted with routeId. Empty optional values are treated as omitted.",
            "x-description-zh": "线路接口返回的 code，例如 line-01，原样填写。仅对应所选服务和国家；不填或 any 为自动选线。传 routeId 时不能填写。 留空按未填写处理。",
            "schema": {
              "type": "string",
              "maxLength": 25,
              "pattern": "^(any|line-(?:0[1-9]|[1-9][0-9]{1,19}))$",
              "example": "line-01"
            }
          },
          {
            "name": "maxPrice",
            "in": "query",
            "required": true,
            "description": "Maximum price per number in USD. Positive decimal string with up to four decimal places. Applies to fixed and automatic lines.",
            "x-description-zh": "每个号码的最高价格（USD），大于 0，最多四位小数；固定和自动线路均受限制。",
            "schema": {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]{0,11})(\\.[0-9]{1,4})?$",
              "maxLength": 17,
              "description": "Maximum price per number in USD. Positive decimal string with up to four decimal places. Applies to fixed and automatic lines.",
              "example": "0.50",
              "x-description-zh": "每个号码的最高价格（USD），大于 0，最多四位小数；固定和自动线路均受限制。"
            }
          },
          {
            "name": "count",
            "in": "query",
            "required": false,
            "description": "Number of orders to create, default 1, maximum 20 (the deployment may configure a lower limit). Each order acquires its number independently.",
            "x-description-zh": "购买数量，默认 1，最多 20（部署配置可能更低）；受理后各订单独立获取号码。",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20,
              "default": 1,
              "example": 1,
              "description": "Number of orders to create, default 1, maximum 20 (the deployment may configure a lower limit). Each order acquires its number independently.",
              "x-description-zh": "购买数量，默认 1，最多 20（部署配置可能更低）；受理后各订单独立获取号码。"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional retry token, not an order number. Generate once per intended purchase and reuse with identical parameters. Without it every request creates a separate purchase.",
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{16,128}$"
            },
            "x-description-zh": "选填防重复请求标识，不是订单号；重试前须保存并复用相同值和参数。不填时每次调用均为新购买。"
          }
        ],
        "responses": {
          "200": {
            "description": "At least one usable phone number acquired. Inspect every item status for partial failures.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              },
              "Idempotency-Key": {
                "description": "Retry token used for this purchase. Save it with the response.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerPurchaseResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "description": "No item succeeded, or a purchase conflict prevented acceptance. Accepted item results remain in data.items.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          },
          "405": {
            "$ref": "#/components/responses/Error"
          },
          "406": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          }
        },
        "summary": "Buy a number",
        "description": "Purchase numbers using URL Params. One shared acquisition window of up to 10 seconds applies to the entire batch. HTTP 200 includes at least one SUCCESS; HTTP 409 with data.items means all accepted items failed or remain unconfirmed. Errors before acceptance use the standard error response.",
        "x-description-zh": "通过 URL Params 购买，Body 留空。传 routeId，或传 service 和 country 并选填线路代码 line；line 不填为自动选线。所有线路均受每个号码的 maxPrice 限制。批量受理为原子操作，各订单独立获取号码。"
      }
    },
    "/api/v1/orders": {
      "get": {
        "operationId": "listCustomerOrders",
        "tags": [
          "Customer"
        ],
        "parameters": [
          {
            "name": "orderNumbers",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 819
            },
            "description": "One system order number, or up to 20 comma-separated order numbers. Every order must belong to your account. Unknown or unowned orders return 404.",
            "x-description-zh": "系统订单号，多个用英文逗号分隔，最多 20 个；须全部属于当前账户，不存在或无权限时返回 404。"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 512
            },
            "description": "Omit for the first page. For subsequent pages, pass the previous nextCursor unchanged; never construct or edit a cursor.",
            "x-description-zh": "首页省略，后续页原样传入上页 nextCursor，不要自行构造或修改游标。"
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20
            },
            "description": "Orders per page, default 20; deployment may configure a lower limit.",
            "x-description-zh": "每页订单数，默认20，部署可配置更低上限。"
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PURCHASING",
                "ACTIVE",
                "CANCEL_PENDING",
                "RESULT_UNKNOWN",
                "COMPLETED",
                "CANCELLED",
                "NUMBER_UNAVAILABLE",
                "EXPIRED",
                "FAILED"
              ]
            },
            "description": "Order status. Cannot combine orderNumbers with status, cursor or pageSize.",
            "x-description-zh": "订单状态；orderNumbers 不可与 status、cursor 或 pageSize 混用。"
          }
        ],
        "responses": {
          "200": {
            "description": "SMSAny result. Order creation and termination may still be processing; poll the order.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerOrderPageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          },
          "405": {
            "$ref": "#/components/responses/Error"
          },
          "406": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          }
        },
        "summary": "List account Orders",
        "description": "Read account orders. Pass orderNumbers for one or multiple complete orders, or omit it for a paginated list."
      }
    },
    "/api/v1/balance": {
      "get": {
        "operationId": "getCustomerBalance",
        "tags": [
          "Customer"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "SMSAny result. Order creation and termination may still be processing; poll the order.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerBalanceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          },
          "405": {
            "$ref": "#/components/responses/Error"
          },
          "406": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          }
        },
        "summary": "Get account Balance"
      }
    },
    "/api/v1/catalog/routes": {
      "get": {
        "operationId": "listCustomerRoutes",
        "tags": [
          "Customer"
        ],
        "parameters": [
          {
            "name": "service",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "Service code from the services catalog.",
            "x-description-zh": "服务列表返回的 code。"
          },
          {
            "name": "country",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z]{2}$"
            },
            "description": "Two-letter ISO country code.",
            "x-description-zh": "国家两位 ISO 代码。"
          }
        ],
        "responses": {
          "200": {
            "description": "SMSAny result. Order creation and termination may still be processing; poll the order.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerRoutePageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          },
          "405": {
            "$ref": "#/components/responses/Error"
          },
          "406": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          }
        },
        "summary": "List lines and current prices",
        "description": "Returns price, currency, available quantity and line code for each available line in the selected service and country."
      }
    },
    "/api/v1/messages": {
      "get": {
        "operationId": "listCustomerMessages",
        "tags": [
          "Customer"
        ],
        "parameters": [
          {
            "name": "orderNumbers",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 819
            },
            "description": "One system order number, or up to 20 comma-separated order numbers. Every order must belong to your account. Unknown or unowned orders return 404.",
            "x-description-zh": "系统订单号，多个用英文逗号分隔，最多 20 个；须全部属于当前账户，不存在或无权限时返回 404。"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 512
            },
            "description": "Omit for the first page. For subsequent pages, pass the previous nextCursor unchanged; never construct or edit a cursor.",
            "x-description-zh": "首页省略，后续页原样传入上页 nextCursor，不要自行构造或修改游标。"
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Requested items per page, from 1 to 100 and subject to the server limit. If omitted, the server-configured default is used (20 in the default configuration).",
            "x-description-zh": "每页条数，范围 1–100，并受服务端上限配置约束。省略时使用服务端默认值（默认配置为 20）。"
          }
        ],
        "responses": {
          "200": {
            "description": "SMSAny result. Order creation and termination may still be processing; poll the order.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerMessagePageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          },
          "405": {
            "$ref": "#/components/responses/Error"
          },
          "406": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          }
        },
        "summary": "List account Messages",
        "description": "Read SMS for orderNumbers. Every message includes orderNumber and phoneNumber. Start each poll without cursor, follow nextCursor until null, and deduplicate by messageId."
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "schemas": {
      "CustomerCatalogItem": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "code",
          "name",
          "minimumPrice",
          "currency",
          "availableQuantity",
          "observedAt"
        ],
        "properties": {
          "code": {
            "type": "string",
            "description": "Service code or country ISO code used directly in catalog and purchase parameters.",
            "x-description-zh": "服务代码或国家 ISO 代码，直接用于目录和购买参数。"
          },
          "name": {
            "type": "string",
            "description": "English display name of the service or country.",
            "x-description-zh": "服务或国家的英文显示名称。"
          },
          "minimumPrice": {
            "type": "string",
            "pattern": "^-?[0-9]+(?:\\.[0-9]{1,8})?$",
            "description": "Lowest observed price, not a reservation. Purchase enforces maxPrice.",
            "x-description-zh": "当前观察到的最低价格，不代表库存已预留；购买时按 maxPrice 校验。"
          },
          "currency": {
            "type": "string",
            "description": "Currency code for all amounts in this object (currently USD). Amounts are decimal strings; use decimal arithmetic.",
            "x-description-zh": "本对象金额的币种代码（当前为 USD）。金额以十进制字符串返回，请使用十进制运算。"
          },
          "availableQuantity": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Observed available quantity. This is not reserved inventory and does not guarantee a successful purchase.",
            "x-description-zh": "观察到的可用数量，不代表库存已预留，也不保证下单成功。"
          },
          "observedAt": {
            "type": "string",
            "format": "date-time",
            "description": "UTC time of the price/inventory observation, in ISO 8601 format. This is not the time of your request.",
            "x-description-zh": "价格或库存的观察时间，使用 ISO 8601 UTC 格式，并非本次请求时间。"
          }
        },
        "description": "Response data object.",
        "x-description-zh": "接口返回的数据对象。"
      },
      "CustomerRoute": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "routeId",
          "code",
          "name",
          "anyOperator",
          "price",
          "currency",
          "availableQuantity",
          "deliveryRatePercent",
          "observedAt"
        ],
        "properties": {
          "routeId": {
            "type": "string",
            "format": "uuid",
            "description": "Exact line identity; pass as routeId to purchase this line.",
            "x-description-zh": "具体线路标识，购买该线路时作为 routeId 传入。"
          },
          "code": {
            "type": "string",
            "description": "Display code only. Select an exact line using routeId.",
            "x-description-zh": "仅供展示的线路代码；选择具体线路请使用 routeId。",
            "example": "line-01"
          },
          "name": {
            "type": "string",
            "description": "English display name of the line.",
            "x-description-zh": "线路的英文显示名称。",
            "example": "Line 01"
          },
          "anyOperator": {
            "type": "boolean",
            "description": "true means allocation may use any supported operator; false means a specific operator line.",
            "x-description-zh": "true 表示任意运营商线路，可由支持的运营商分配；false 表示指定运营商线路。"
          },
          "price": {
            "type": "string",
            "pattern": "^-?[0-9]+(?:\\.[0-9]{1,8})?$",
            "description": "Current display price of this line in currency, as a decimal string. Purchase price is checked against maxPrice.",
            "x-description-zh": "该线路的当前展示价格，以 currency 为单位的十进制字符串。购买时会核验实时报价和 maxPrice。"
          },
          "currency": {
            "type": "string",
            "description": "Currency code for all amounts in this object (currently USD). Amounts are decimal strings; use decimal arithmetic.",
            "x-description-zh": "本对象金额的币种代码（当前为 USD）。金额以十进制字符串返回，请使用十进制运算。"
          },
          "availableQuantity": {
            "type": "integer",
            "minimum": 0,
            "description": "Observed available quantity. This is not reserved inventory and does not guarantee a successful purchase.",
            "x-description-zh": "观察到的可用数量，不代表库存已预留，也不保证下单成功。"
          },
          "deliveryRatePercent": {
            "type": "string",
            "pattern": "^-?[0-9]+(?:\\.[0-9]{1,8})?$",
            "nullable": true,
            "description": "Observed delivery rate as a percentage decimal string (for example, 85 means 85%). null means no rate is available; it is not a success guarantee.",
            "x-description-zh": "观察到的接码率，百分比十进制字符串（如 85 表示 85%）。null 表示暂无数据，不代表成功保证。"
          },
          "observedAt": {
            "type": "string",
            "format": "date-time",
            "description": "UTC time of the price/inventory observation, in ISO 8601 format. This is not the time of your request.",
            "x-description-zh": "价格或库存的观察时间，使用 ISO 8601 UTC 格式，并非本次请求时间。"
          }
        },
        "description": "Response data object.",
        "x-description-zh": "接口返回的数据对象。"
      },
      "CustomerOrder": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "orderNumber",
          "price",
          "currency",
          "status",
          "paymentState",
          "receivedMessageCount",
          "phoneNumber",
          "expiresAt",
          "createdAt",
          "updatedAt",
          "serviceCode",
          "serviceName",
          "countryCode",
          "countryName"
        ],
        "properties": {
          "orderNumber": {
            "type": "string",
            "description": "System-generated order number for this one phone number. Use orderNumbers in order and SMS queries.",
            "x-description-zh": "系统生成的订单号，一个号码对应一个订单；通过 orderNumbers 查询订单或短信。"
          },
          "price": {
            "type": "string",
            "pattern": "^-?[0-9]+(?:\\.[0-9]{1,8})?$",
            "description": "Order sale amount in currency units as a decimal string. Variable-price orders may be updated at allocation. Read paymentState for the financial outcome, not status alone.",
            "x-description-zh": "订单售价，以 currency 为单位的十进制字符串；浮动价格订单可在号码分配时更新。是否扣款应以 paymentState 为准，不能仅根据订单状态推断。"
          },
          "currency": {
            "type": "string",
            "description": "Currency code for all amounts in this object (currently USD). Amounts are decimal strings; use decimal arithmetic.",
            "x-description-zh": "本对象金额的币种代码（当前为 USD）。金额以十进制字符串返回，请使用十进制运算。"
          },
          "status": {
            "type": "string",
            "enum": [
              "PURCHASING",
              "ACTIVE",
              "CANCEL_PENDING",
              "RESULT_UNKNOWN",
              "COMPLETED",
              "CANCELLED",
              "NUMBER_UNAVAILABLE",
              "EXPIRED",
              "FAILED"
            ],
            "description": "Order lifecycle state. PURCHASING: acquiring a number. ACTIVE: waiting for or receiving SMS. CANCEL_PENDING: cancellation, completion or number-unavailable report is processing. RESULT_UNKNOWN: purchase result is being confirmed. Keep polling the same order for these states. COMPLETED: completed; CANCELLED: cancelled; NUMBER_UNAVAILABLE: number reported unusable and closed; EXPIRED: expired; FAILED: purchase failed. These last five are terminal; check paymentState for funds.",
            "x-description-zh": "订单生命周期状态。PURCHASING：正在获取号码；ACTIVE：等待或接收短信；CANCEL_PENDING：取消、结束或号码不可用申请处理中；RESULT_UNKNOWN：正在确认购买结果。这些状态请继续轮询同一订单。COMPLETED：已完成；CANCELLED：已取消；NUMBER_UNAVAILABLE：号码不可用并已结案；EXPIRED：已过期；FAILED：采购失败。后五项为终态，资金结果仍以 paymentState 为准。"
          },
          "paymentState": {
            "type": "string",
            "enum": [
              "HELD",
              "CAPTURED",
              "RELEASED"
            ],
            "description": "HELD: funds reserved, not yet charged. CAPTURED: funds charged; later messages do not charge again. RELEASED: reserved funds returned to available balance. An accepted cancellation request alone does not confirm release.",
            "x-description-zh": "HELD：金额已冻结，尚未扣款；CAPTURED：已扣款，后续短信不重复扣款；RELEASED：冻结金额已退回可用余额。取消申请受理不等于金额已经释放。"
          },
          "receivedMessageCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of retained messages received for this order. Read their content with the messages endpoint.",
            "x-description-zh": "订单已接收并保留的短信条数，具体内容请通过短信接口读取。"
          },
          "phoneNumber": {
            "type": "string",
            "nullable": true,
            "description": "Allocated phone number in order list and single-order queries; null when unavailable. Purchase responses do not read protected phone content.",
            "x-description-zh": "订单列表和单条查询返回已分配号码，未分配时为 null；购买响应不读取受保护号码。"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "Scheduled number expiry time in UTC after allocation; this is not a guaranteed usable-until time or a fixed 20-minute validity period. An order may end before this time, and expiresAt retains the recorded schedule rather than the actual end time. Use status to determine the current order state: if EXPIRED or another terminal state is returned, stop using the number even if expiresAt is still in the future. Check paymentState separately for funds. updatedAt is the last update time, not a dedicated end timestamp. During persistent acquisition, expiresAt may retain the original quote expiry and is not a stock-wait deadline; use acquisition and status. A local countdown does not confirm termination or release.",
            "x-description-zh": "获号后记录的号码计划到期时间，UTC；不保证号码一定可用到该时间，也不表示固定有效 20 分钟。订单可能提前结束，expiresAt 保留已记录的计划时间，不是实际结束时间。当前状态以 status 为准：返回 EXPIRED 或其他终态时，即使未到 expiresAt 也应停止使用号码；资金是否释放另看 paymentState。updatedAt 是最后更新时间，不是专门的结束时间。持续获取期间 expiresAt 可能保留原报价到期时间，不是等货截止时间，应查看 acquisition 和 status；本地倒计时结束不代表订单已结束或资金已释放。"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Order creation time in ISO 8601 UTC format.",
            "x-description-zh": "订单创建时间，ISO 8601 UTC 格式。"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Last update time in ISO 8601 UTC format.",
            "x-description-zh": "最近更新时间，ISO 8601 UTC 格式。"
          },
          "acquisition": {
            "$ref": "#/components/schemas/CustomerAcquisition"
          },
          "manualReviewRequired": {
            "type": "boolean",
            "description": "Automatic reconciliation requires manual review. Keep the same order and check paymentState; do not assume failure or a refund.",
            "x-description-zh": "自动核实已转人工处理。保留同一订单并查看 paymentState，不能据此判断失败或已退款。"
          },
          "purchaseFailureReason": {
            "type": "string",
            "description": "Confirmed purchase failure: no stock, price changed, or purchase failed. Null means no confirmed reason. Check status and paymentState.",
            "x-description-zh": "已确认的购买失败原因：库存不足、价格变化或购买失败。null 表示无确定原因，最终结果请结合 status 和 paymentState 判断。",
            "nullable": true,
            "enum": [
              "OUT_OF_STOCK",
              "PRICE_CONDITION_CHANGED",
              "PURCHASE_FAILED"
            ]
          },
          "serviceCode": {
            "type": "string",
            "description": "Public service code.",
            "x-description-zh": "服务代码。"
          },
          "serviceName": {
            "type": "string",
            "description": "Service display name.",
            "x-description-zh": "服务显示名称。"
          },
          "countryCode": {
            "type": "string",
            "description": "Two-letter ISO country code.",
            "x-description-zh": "国家两位 ISO 代码。"
          },
          "countryName": {
            "type": "string",
            "description": "Country display name.",
            "x-description-zh": "国家显示名称。"
          },
          "routeId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Exact saved line identity; null only when unavailable for historical data.",
            "x-description-zh": "订单保存的具体线路标识；历史数据无法确定时为 null。"
          }
        },
        "description": "Response data object.",
        "x-description-zh": "接口返回的数据对象。"
      },
      "CustomerMessage": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "messageId",
          "body",
          "verificationCode",
          "receivedAt",
          "orderNumber",
          "phoneNumber"
        ],
        "properties": {
          "body": {
            "type": "string",
            "description": "Full SMS text. Treat it as sensitive content; it may contain a verification code.",
            "x-description-zh": "完整短信正文，可能包含验证码，请按敏感内容处理。"
          },
          "verificationCode": {
            "type": "string",
            "nullable": true,
            "description": "Verification code extracted from the SMS text by platform rules, or null when no code is recognized. Preserve it as a string, including leading zeros; the full body remains available for checking.",
            "x-description-zh": "平台按规则从短信正文提取的验证码，未识别到时为 null。请保留字符串及前导零，可结合完整正文核对。"
          },
          "receivedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Message receipt time in ISO 8601 UTC format.",
            "x-description-zh": "短信接收时间，ISO 8601 UTC 格式。"
          },
          "messageId": {
            "type": "string",
            "format": "uuid",
            "description": "Message UUID. Deduplicate repeated polling results by this value.",
            "x-description-zh": "短信 UUID，轮询重复返回时按此值去重。"
          },
          "orderNumber": {
            "type": "string",
            "description": "System order number for this message.",
            "x-description-zh": "这条短信对应的系统订单号。"
          },
          "phoneNumber": {
            "type": "string",
            "description": "Full allocated phone number including country calling code.",
            "x-description-zh": "接收这条短信的完整手机号，包含国家区号。",
            "example": "+12025550123"
          }
        },
        "description": "Response data object.",
        "x-description-zh": "接口返回的数据对象。"
      },
      "CustomerBalance": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "available",
          "held",
          "currency",
          "updatedAt"
        ],
        "properties": {
          "available": {
            "type": "string",
            "pattern": "^-?[0-9]+(?:\\.[0-9]{1,8})?$",
            "description": "Available wallet balance in currency units as a decimal string. Shared by website and API purchases.",
            "x-description-zh": "钱包可用余额，以 currency 为单位的十进制字符串，网站和 API 购买共用。"
          },
          "held": {
            "type": "string",
            "pattern": "^-?[0-9]+(?:\\.[0-9]{1,8})?$",
            "description": "Currently reserved wallet funds in currency units as a decimal string. These funds are not available for a new purchase.",
            "x-description-zh": "当前冻结金额，以 currency 为单位的十进制字符串，不可用于新的购买。"
          },
          "currency": {
            "type": "string",
            "description": "Currency code for all amounts in this object (currently USD). Amounts are decimal strings; use decimal arithmetic.",
            "x-description-zh": "本对象金额的币种代码（当前为 USD）。金额以十进制字符串返回，请使用十进制运算。"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Last update time in ISO 8601 UTC format.",
            "x-description-zh": "最近更新时间，ISO 8601 UTC 格式。"
          }
        },
        "description": "Response data object.",
        "x-description-zh": "接口返回的数据对象。"
      },
      "ErrorResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "error"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "description": "Request trace identifier. Include it when contacting support; do not send your API key.",
            "x-description-zh": "请求追踪标识，联系客服时提供此值，不要提供 API 密钥。"
          },
          "error": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "description": "Machine-readable error code. Combine it with the HTTP status to decide whether to correct, retry or stop.",
                "x-description-zh": "机器可读错误码，结合 HTTP 状态判断修正参数、重试或停止。"
              },
              "message": {
                "type": "string",
                "description": "Human-readable error explanation. Do not match this text as a stable programmatic code.",
                "x-description-zh": "便于阅读的错误说明，不要依赖此文本作为固定的程序判断条件。"
              },
              "details": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                },
                "description": "Optional structured error details. The object keys depend on the error; tolerate missing details and unknown keys.",
                "x-description-zh": "可选的结构化错误详情，具体键随错误而异；请兼容缺失详情及未知键。"
              }
            },
            "description": "Error information. Use code for programmatic handling and message for human-readable context.",
            "x-description-zh": "错误信息；程序处理使用 code，message 用于阅读和排查。"
          },
          "data": {
            "$ref": "#/components/schemas/CustomerPurchaseResult"
          }
        },
        "description": "Result object.",
        "x-description-zh": "接口结果对象。"
      },
      "CustomerCatalogItemPage": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerCatalogItem"
            },
            "description": "Result items. An empty array means no matching records.",
            "x-description-zh": "结果列表，空数组表示没有匹配记录。"
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Reserved pagination field. This endpoint returns its available items without cursor pagination; null or omission requires no further page request.",
            "x-description-zh": "预留分页字段。此接口不接受 cursor 分页，直接返回可用条目；null 或省略时无需继续翻页。"
          }
        },
        "description": "List result containing items and optional pagination metadata.",
        "x-description-zh": "列表结果，包含 items 及可选分页信息。"
      },
      "CustomerRoutePage": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerRoute"
            },
            "description": "Result items. An empty array means no matching records.",
            "x-description-zh": "结果列表，空数组表示没有匹配记录。"
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Reserved pagination field. This endpoint returns its available items without cursor pagination; null or omission requires no further page request.",
            "x-description-zh": "预留分页字段。此接口不接受 cursor 分页，直接返回可用条目；null 或省略时无需继续翻页。"
          }
        },
        "description": "List result containing items and optional pagination metadata.",
        "x-description-zh": "列表结果，包含 items 及可选分页信息。"
      },
      "CustomerOrderPage": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerOrder"
            },
            "description": "Result items. An empty array means no matching records.",
            "x-description-zh": "结果列表，空数组表示没有匹配记录。"
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque continuation cursor. Pass it unchanged as cursor to fetch the next page; null or omission means no next page.",
            "x-description-zh": "不透明的下一页游标，原样作为 cursor 传入继续查询；null 或省略表示没有下一页。"
          }
        },
        "description": "List result containing items and optional pagination metadata.",
        "x-description-zh": "列表结果，包含 items 及可选分页信息。"
      },
      "CustomerMessagePage": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerMessage"
            },
            "description": "Messages in stable server-storage timestamp/id order, bounded across all requested orders.",
            "x-description-zh": "按服务器存储时间和 ID 稳定排序，所有请求订单共享一个分页上限。"
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Continue this scan with the same orderNumbers; null ends this scan. Restart without cursor for each fresh poll and deduplicate by messageId.",
            "x-description-zh": "使用相同 orderNumbers 继续本轮翻页；null 表示结束。每轮轮询重新不带游标读取，按 messageId 去重。"
          }
        },
        "description": "List result containing items and optional pagination metadata.",
        "x-description-zh": "列表结果，包含 items 及可选分页信息。"
      },
      "CustomerCatalogItemPageResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/CustomerCatalogItemPage"
          }
        },
        "description": "Result object.",
        "x-description-zh": "接口结果对象。"
      },
      "CustomerRoutePageResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/CustomerRoutePage"
          }
        },
        "description": "Result object.",
        "x-description-zh": "接口结果对象。"
      },
      "CustomerOrderPageResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/CustomerOrderPage"
          }
        },
        "description": "Result object.",
        "x-description-zh": "接口结果对象。"
      },
      "CustomerMessagePageResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/CustomerMessagePage"
          }
        },
        "description": "Result object.",
        "x-description-zh": "接口结果对象。"
      },
      "CustomerBalanceResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/CustomerBalance"
          }
        },
        "description": "Result object.",
        "x-description-zh": "接口结果对象。"
      },
      "CustomerAcquisition": {
        "type": "object",
        "nullable": true,
        "additionalProperties": false,
        "description": "Persisted acquisition progress for the same order; null after acquisition or for legacy orders.",
        "x-description-zh": "同一订单的持久化获取进度；获取结束或旧策略订单可为 null。",
        "required": [
          "state",
          "startedAt",
          "attemptCount",
          "cancelRequested"
        ],
        "properties": {
          "state": {
            "type": "string",
            "description": "WAITING_STOCK: waiting for stock; REQUESTING: purchase in flight; PAUSED: acquisition paused; CANCELLING: cancellation pending; RECONCILING: verifying an uncertain purchase. Do not create another order to retry.",
            "x-description-zh": "WAITING_STOCK：等待库存；REQUESTING：正在采购；PAUSED：暂停获取；CANCELLING：取消处理中；RECONCILING：核实采购结果。请查询同一订单，不要另建订单重试。",
            "enum": [
              "WAITING_STOCK",
              "REQUESTING",
              "PAUSED",
              "CANCELLING",
              "RECONCILING"
            ]
          },
          "startedAt": {
            "type": "string",
            "description": "Acquisition start time in UTC.",
            "x-description-zh": "开始获取时间，UTC。",
            "format": "date-time"
          },
          "attemptCount": {
            "type": "integer",
            "description": "Recorded acquisition attempt count, not a count of purchased numbers.",
            "x-description-zh": "已记录的获取尝试次数，不代表已购买号码数。",
            "minimum": 0
          },
          "nextAttemptAt": {
            "type": "string",
            "description": "Next scheduled attempt in UTC, or null when none is scheduled. Not a completion deadline.",
            "x-description-zh": "下次计划尝试时间，UTC；无计划时为 null，不是获取完成期限。",
            "format": "date-time",
            "nullable": true
          },
          "cancelRequested": {
            "type": "boolean",
            "description": "Whether cancellation has been requested. Does not confirm completion or release of funds.",
            "x-description-zh": "是否已申请取消，不代表取消完成或资金已释放。"
          }
        }
      },
      "CustomerPurchaseResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "items",
          "count"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerPurchasedNumber"
            },
            "description": "One compact outcome per number; successful numbers are retained when other items fail.",
            "x-description-zh": "每个号码独立返回结果，部分失败仍保留成功号码。"
          },
          "count": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20,
            "example": 1,
            "description": "Number of item results.",
            "x-description-zh": "本次返回的逐项结果数量。"
          }
        },
        "description": "Purchase outcomes within one shared acquisition window of up to 10 seconds.",
        "x-description-zh": "整批最多等待 10 秒获取号码，逐项返回结果。"
      },
      "CustomerPurchaseResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/CustomerPurchaseResult"
          },
          "error": {
            "$ref": "#/components/schemas/CustomerPurchaseFailure"
          },
          "requestId": {
            "type": "string",
            "description": "Support correlation identifier on an unsuccessful response.",
            "x-description-zh": "失败响应的排查标识。"
          }
        },
        "x-class-extra-annotation": "@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)"
      },
      "CustomerPurchaseFailure": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string",
            "description": "Machine-readable purchase failure code.",
            "x-description-zh": "购买失败原因代码。"
          },
          "message": {
            "type": "string",
            "description": "Explanation of the purchase result.",
            "x-description-zh": "购买结果说明。"
          }
        },
        "description": "Failure details for an unsuccessful or uncertain purchase result.",
        "x-description-zh": "未成功或结果待确认的购买错误详情。"
      },
      "CustomerPurchasedNumber": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "orderNumber",
          "serviceName",
          "countryName",
          "phoneNumber",
          "status"
        ],
        "properties": {
          "orderNumber": {
            "type": "string",
            "description": "System order number for this number.",
            "x-description-zh": "该号码对应的系统订单号。"
          },
          "serviceName": {
            "type": "string",
            "description": "Service name.",
            "x-description-zh": "服务名称。"
          },
          "countryName": {
            "type": "string",
            "description": "Country name.",
            "x-description-zh": "国家名称。"
          },
          "phoneNumber": {
            "type": "string",
            "nullable": true,
            "description": "Full phone number on SUCCESS; null otherwise.",
            "x-description-zh": "SUCCESS 时为完整手机号，其余为 null。"
          },
          "status": {
            "type": "string",
            "enum": [
              "SUCCESS",
              "FAILED",
              "RESULT_UNKNOWN"
            ],
            "description": "SUCCESS confirms a usable number. FAILED confirms failure. RESULT_UNKNOWN requires checking the same order before purchasing again.",
            "x-description-zh": "SUCCESS 为取得号码；FAILED 为明确失败；RESULT_UNKNOWN 为结果待确认，请先查询原订单。"
          },
          "error": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerPurchaseFailure"
              }
            ],
            "x-field-extra-annotation": "@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)",
            "description": "Present only for failed or unconfirmed items.",
            "x-description-zh": "失败或结果待确认时返回。"
          }
        }
      }
    },
    "responses": {
      "Error": {
        "description": "Inspect error.code and requestId.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Customer",
      "description": "Self-service API for the authenticated SMSAny account."
    },
    {
      "name": "Purchases",
      "description": "Direct purchases using the platform checkout."
    }
  ],
  "x-error-catalog": [
    {
      "group": "request",
      "code": "VALIDATION_FAILED",
      "statuses": [
        400
      ],
      "description": "Missing required input, invalid type/format or value outside limits. Check details.field and details.reason, such as malformed routeId, non-integer count or invalid country code.",
      "x-description-zh": "缺少必填项、类型或格式错误、超出范围。查看 details 中的 field 和 reason；例如 routeId 格式错误、count 非整数、country 不是两位代码。"
    },
    {
      "group": "request",
      "code": "INVALID_PURCHASE_REQUEST",
      "statuses": [
        400
      ],
      "description": "Supply routeId, or service and country together. maxPrice must be positive with at most four decimal places.",
      "x-description-zh": "填写 routeId，或同时填写 service、country；maxPrice 必须大于 0，最多四位小数。"
    },
    {
      "group": "request",
      "code": "PURCHASE_SELECTION_CONFLICT",
      "statuses": [
        400
      ],
      "description": "Do not combine routeId with nonempty service, country or line. Empty optional selectors are treated as omitted.",
      "x-description-zh": "routeId 不能与非空的 service、country、line 同时填写。选填的这三项留空按未填写处理。"
    },
    {
      "group": "request",
      "code": "INVALID_PURCHASE_COUNT",
      "statuses": [
        400
      ],
      "description": "count must be a positive integer, default 1, maximum 20, possibly lower in server configuration.",
      "x-description-zh": "count 须为正整数，默认 1，公开上限 20，实际还受服务端配置限制。"
    },
    {
      "group": "request",
      "code": "INVALID_PURCHASE_LINE",
      "statuses": [
        400
      ],
      "description": "Use the returned public line code, for example line-01, not 01. Omit or use any for automatic selection.",
      "x-description-zh": "line 使用线路接口返回的 code（例如 line-01），不接受 01；不填或 any 为自动选线。"
    },
    {
      "group": "request",
      "code": "IDEMPOTENCY_KEY_INVALID",
      "statuses": [
        400
      ],
      "description": "Optional Idempotency-Key must be 16–128 ASCII letters, digits or . _ : -.",
      "x-description-zh": "选填的 Idempotency-Key 必须是 16–128 位 ASCII 字母、数字或 . _ : -。"
    },
    {
      "group": "request",
      "code": "INVALID_ORDER_NUMBERS",
      "statuses": [
        400
      ],
      "description": "Use one or up to 20 comma-separated order numbers without empty entries or whitespace.",
      "x-description-zh": "orderNumbers 须为一个或多个非空订单号，用英文逗号分隔，最多 20 个；不能包含空项或空格。"
    },
    {
      "group": "request",
      "code": "INVALID_ORDER_FILTER",
      "statuses": [
        400
      ],
      "description": "For orders, do not combine orderNumbers with status, cursor or pageSize. Check the status value.",
      "x-description-zh": "查询订单时 orderNumbers 不能与 status、cursor、pageSize 混用；检查状态取值。"
    },
    {
      "group": "request",
      "code": "INVALID_PAGE_SIZE",
      "statuses": [
        400
      ],
      "description": "Orders allow at most 20 per page and messages at most 100, subject to lower server limits.",
      "x-description-zh": "订单列表每页最多 20 条，短信每页最多 100 条，均可能受更低的服务端配置限制。"
    },
    {
      "group": "request",
      "code": "INVALID_CURSOR",
      "statuses": [
        400
      ],
      "description": "Cursor is invalid or does not match the query. SMS cursors require the same account and order set. Omit cursor for a fresh scan.",
      "x-description-zh": "游标无效或与当前查询不匹配；短信须保持同一账户及同一组订单号。首次查询不传 cursor。"
    },
    {
      "group": "request",
      "code": "INVALID_REQUEST_ID",
      "statuses": [
        400
      ],
      "description": "Request identifier or checkout request is invalid. Use documented parameters; contact support with requestId if it persists.",
      "x-description-zh": "请求标识或内部购买请求格式无效；使用文档参数，仍出现时提供 requestId 联系支持。"
    },
    {
      "group": "request",
      "code": "INVALID_ORDER_REQUEST",
      "statuses": [
        400
      ],
      "description": "Request identifier or checkout request is invalid. Use documented parameters; contact support with requestId if it persists.",
      "x-description-zh": "请求标识或内部购买请求格式无效；使用文档参数，仍出现时提供 requestId 联系支持。"
    },
    {
      "group": "access",
      "code": "UNAUTHENTICATED",
      "statuses": [
        401
      ],
      "description": "X-API-Key is missing, repeated, malformed, expired, revoked or disabled. Send exactly one valid key.",
      "x-description-zh": "X-API-Key 缺失、重复、格式不正确、已过期、已撤销或已禁用；每次仅传一个有效密钥。"
    },
    {
      "group": "access",
      "code": "API_SCOPE_REQUIRED",
      "statuses": [
        403
      ],
      "description": "Key lacks the required scope. Check the key or create a replacement in your account.",
      "x-description-zh": "密钥缺少接口所需权限；在网站检查密钥或创建新密钥。"
    },
    {
      "group": "access",
      "code": "GRAY_ADMISSION_REQUIRED",
      "statuses": [
        403
      ],
      "description": "This account is not admitted for purchase operations; contact support.",
      "x-description-zh": "账户尚未获准执行购买操作，请联系支持。"
    },
    {
      "group": "access",
      "code": "API_SCOPE_INVALID",
      "statuses": [
        400
      ],
      "description": "Stored key scope is not recognized. Replace the key or contact support.",
      "x-description-zh": "密钥权限配置不可识别，请更换密钥或联系支持。"
    },
    {
      "group": "access",
      "code": "USER_NOT_FOUND",
      "statuses": [
        404
      ],
      "description": "The key owner account is missing or inactive. Check account status.",
      "x-description-zh": "密钥所属账户不存在或已失效；检查账户状态。"
    },
    {
      "group": "selection",
      "code": "CATALOG_SELECTION_NOT_FOUND",
      "statuses": [
        404
      ],
      "description": "Service code is unavailable, or the country is unavailable for that service. Refresh the catalog.",
      "x-description-zh": "服务代码无效，或该服务下国家不可用；刷新服务和国家列表。"
    },
    {
      "group": "selection",
      "code": "ORDER_NOT_FOUND",
      "statuses": [
        404
      ],
      "description": "At least one order is missing or not owned by the account. The entire query fails without returning other orders or messages.",
      "x-description-zh": "至少一个订单不存在或不属于当前账户；整次查询失败，不返回其他订单或短信。"
    },
    {
      "group": "selection",
      "code": "PURCHASE_SERVICE_UNAVAILABLE",
      "statuses": [
        409
      ],
      "description": "Selected service, country or line is unavailable. Refresh the catalog; a specified line is never silently replaced.",
      "x-description-zh": "所选服务、国家或线路当前不可售；刷新目录，指定线路不会自动替换为其他线路。"
    },
    {
      "group": "selection",
      "code": "PURCHASE_COUNTRY_UNAVAILABLE",
      "statuses": [
        409
      ],
      "description": "Selected service, country or line is unavailable. Refresh the catalog; a specified line is never silently replaced.",
      "x-description-zh": "所选服务、国家或线路当前不可售；刷新目录，指定线路不会自动替换为其他线路。"
    },
    {
      "group": "selection",
      "code": "PURCHASE_LINE_UNAVAILABLE",
      "statuses": [
        409
      ],
      "description": "Selected service, country or line is unavailable. Refresh the catalog; a specified line is never silently replaced.",
      "x-description-zh": "所选服务、国家或线路当前不可售；刷新目录，指定线路不会自动替换为其他线路。"
    },
    {
      "group": "purchase",
      "code": "MAX_PRICE_EXCEEDED",
      "statuses": [
        409
      ],
      "description": "Current per-number price exceeds maxPrice; purchase was not accepted. Applies to both fixed and automatic lines.",
      "x-description-zh": "当前单号价格超过 maxPrice，购买未受理；固定线路和自动选线均受此限制。"
    },
    {
      "group": "purchase",
      "code": "INSUFFICIENT_BALANCE",
      "statuses": [
        422
      ],
      "description": "Available balance cannot cover the required reservation for the purchase or entire batch. Top up or reduce count.",
      "x-description-zh": "可用余额不足以承担购买冻结金额（批量按整批检查），购买未受理；充值或减少数量。"
    },
    {
      "group": "purchase",
      "code": "API_ORDER_AMOUNT_LIMIT",
      "statuses": [
        409,
        422
      ],
      "description": "API per-order amount limit or account service price limit exceeded. maxPrice does not override these limits.",
      "x-description-zh": "超过 API 单号金额限制或账户服务限价；maxPrice 不会覆盖这些限制。"
    },
    {
      "group": "purchase",
      "code": "USER_PRICE_LIMIT_EXCEEDED",
      "statuses": [
        409,
        422
      ],
      "description": "API per-order amount limit or account service price limit exceeded. maxPrice does not override these limits.",
      "x-description-zh": "超过 API 单号金额限制或账户服务限价；maxPrice 不会覆盖这些限制。"
    },
    {
      "group": "purchase",
      "code": "API_ACTIVE_ORDER_LIMIT",
      "statuses": [
        409
      ],
      "description": "Purchase count would exceed the active-order allowance. Wait for orders to close or reduce count.",
      "x-description-zh": "本次购买数量将超过账户允许的进行中订单数；等待订单结束或减少数量。"
    },
    {
      "group": "purchase",
      "code": "PURCHASE_BUDGET_EXCEEDED",
      "statuses": [
        422
      ],
      "description": "Current procurement budget cannot fund the purchase. It was not accepted; retry later or contact support.",
      "x-description-zh": "当前采购预算不足以完成购买，购买未受理；稍后再试或联系支持。"
    },
    {
      "group": "purchase",
      "code": "IDEMPOTENCY_KEY_REUSED",
      "statuses": [
        409
      ],
      "description": "The retry key was used with different parameters. Check the original order; do not blindly use a new key for an uncertain result.",
      "x-description-zh": "同一请求键已用于不同参数；核对原订单，不要为未知结果盲目换键重复购买。"
    },
    {
      "group": "purchase",
      "code": "QUOTE_OUT_OF_STOCK",
      "statuses": [
        422
      ],
      "description": "Live stock check found no numbers; purchase was not accepted. Refresh available lines.",
      "x-description-zh": "实时检查缺货，购买未受理；刷新线路库存。"
    },
    {
      "group": "purchase",
      "code": "QUOTE_ROUTE_UNAVAILABLE",
      "statuses": [
        422
      ],
      "description": "Selected line or internal price snapshot is unavailable or expired. Refresh the lines before retrying.",
      "x-description-zh": "所选线路或内部价格快照不可用、已过期，购买未受理；刷新线路后再试。"
    },
    {
      "group": "purchase",
      "code": "QUOTE_NOT_EXECUTABLE",
      "statuses": [
        422
      ],
      "description": "Selected line or internal price snapshot is unavailable or expired. Refresh the lines before retrying.",
      "x-description-zh": "所选线路或内部价格快照不可用、已过期，购买未受理；刷新线路后再试。"
    },
    {
      "group": "purchase",
      "code": "QUOTE_PRICE_CHANGED",
      "statuses": [
        409
      ],
      "description": "Internal price snapshot changed or was consumed concurrently. Check the original order before purchasing again.",
      "x-description-zh": "内部价格快照已改变或被并发使用；先核对原订单，再决定是否重新购买。"
    },
    {
      "group": "purchase",
      "code": "QUOTE_CONCURRENTLY_CONSUMED",
      "statuses": [
        409
      ],
      "description": "Internal price snapshot changed or was consumed concurrently. Check the original order before purchasing again.",
      "x-description-zh": "内部价格快照已改变或被并发使用；先核对原订单，再决定是否重新购买。"
    },
    {
      "group": "purchase",
      "code": "WALLET_CONCURRENTLY_MODIFIED",
      "statuses": [
        409
      ],
      "description": "Wallet changed concurrently. Check orders and retry with the original parameters and saved retry key.",
      "x-description-zh": "钱包发生并发更新；核对订单后，按原请求和已保存的幂等键重试。"
    },
    {
      "group": "limits",
      "code": "API_RATE_LIMIT",
      "statuses": [
        429
      ],
      "description": "Account request rate, concurrent calls or purchase price-check rate exceeded. Wait for Retry-After. Account-level limits are shared across keys.",
      "x-description-zh": "账户请求频率、并发数或购买价格检查频率达到限制；按 Retry-After 等待。同账户多个密钥共用账户额度。"
    },
    {
      "group": "limits",
      "code": "API_CONCURRENCY_LIMIT",
      "statuses": [
        429
      ],
      "description": "Account request rate, concurrent calls or purchase price-check rate exceeded. Wait for Retry-After. Account-level limits are shared across keys.",
      "x-description-zh": "账户请求频率、并发数或购买价格检查频率达到限制；按 Retry-After 等待。同账户多个密钥共用账户额度。"
    },
    {
      "group": "limits",
      "code": "QUOTE_RATE_LIMIT",
      "statuses": [
        429
      ],
      "description": "Account request rate, concurrent calls or purchase price-check rate exceeded. Wait for Retry-After. Account-level limits are shared across keys.",
      "x-description-zh": "账户请求频率、并发数或购买价格检查频率达到限制；按 Retry-After 等待。同账户多个密钥共用账户额度。"
    },
    {
      "group": "limits",
      "code": "INVALID_PHONE_PROTECTION_INPUT",
      "statuses": [
        400
      ],
      "description": "Platform could not read the phone or SMS data. Do not change purchase parameters; contact support with requestId.",
      "x-description-zh": "平台无法读取该号码或短信数据；无需修改购买参数，请提供 requestId 联系支持。"
    },
    {
      "group": "limits",
      "code": "INVALID_MESSAGE_PROTECTION_INPUT",
      "statuses": [
        400
      ],
      "description": "Platform could not read the phone or SMS data. Do not change purchase parameters; contact support with requestId.",
      "x-description-zh": "平台无法读取该号码或短信数据；无需修改购买参数，请提供 requestId 联系支持。"
    },
    {
      "group": "protocol",
      "code": "NOT_FOUND",
      "statuses": [
        404
      ],
      "description": "Endpoint or resource path does not exist. Use a documented path.",
      "x-description-zh": "请求路径不存在，请使用文档中的接口路径。"
    },
    {
      "group": "protocol",
      "code": "METHOD_NOT_ALLOWED",
      "statuses": [
        405
      ],
      "description": "Wrong request method. Follow the Allow response header and documented GET or POST method.",
      "x-description-zh": "请求方式不正确，按 Allow 响应头和文档使用 GET 或 POST。"
    },
    {
      "group": "protocol",
      "code": "NOT_ACCEPTABLE",
      "statuses": [
        406
      ],
      "description": "Unsupported Accept header. Request application/json.",
      "x-description-zh": "Accept 请求头不支持，使用 application/json。"
    },
    {
      "group": "protocol",
      "code": "UNSUPPORTED_MEDIA_TYPE",
      "statuses": [
        415
      ],
      "description": "Unsupported request content type. Current API inputs use URL Params; leave Body empty.",
      "x-description-zh": "请求内容类型不支持；当前接口参数填 URL Params，Body 留空。"
    },
    {
      "group": "protocol",
      "code": "REQUEST_BODY_TOO_LARGE",
      "statuses": [
        413
      ],
      "description": "Request body exceeds the service limit. Current customer endpoints require no Body.",
      "x-description-zh": "请求体超过服务限制；当前客户接口无需 Body。"
    },
    {
      "group": "protocol",
      "code": "INTERNAL_ERROR",
      "statuses": [
        500
      ],
      "description": "Unexpected server error. Keep requestId and contact support. Purchase outcome may be unknown; check orders before resending.",
      "x-description-zh": "服务发生未预期错误。保存 requestId 并联系支持；购买结果可能未知，先查订单，避免直接重发。"
    },
    {
      "group": "purchase",
      "code": "PURCHASE_TIMEOUT",
      "statuses": [
        409
      ],
      "description": "No number was acquired in time. Check each order result. For confirmed cancelled orders, try again later or choose another line.",
      "x-description-zh": "未能及时获取号码。请查看各订单结果；已确认取消的订单可稍后重新购买或更换线路。"
    },
    {
      "group": "purchase",
      "code": "PURCHASE_RESULT_UNKNOWN",
      "statuses": [
        409
      ],
      "description": "The purchase result is being confirmed. Check the original order before making another purchase.",
      "x-description-zh": "购买结果确认中，请查询原订单，暂勿重复购买。"
    },
    {
      "group": "purchase",
      "code": "PURCHASE_FAILED",
      "statuses": [
        409
      ],
      "description": "No number was acquired. Check each order result before trying again or choosing another line.",
      "x-description-zh": "本次未能获取号码，请查看各订单结果后稍后重试或更换线路。"
    },
    {
      "group": "purchase",
      "code": "ORDER_NO_LONGER_ACTIVE",
      "statuses": [
        409
      ],
      "description": "The original order is no longer active. A retry does not create a replacement order.",
      "x-description-zh": "原订单已结束，重试不会另建订单。"
    },
    {
      "group": "purchase",
      "code": "OUT_OF_STOCK",
      "statuses": [
        409
      ],
      "description": "No number available on the selected line.",
      "x-description-zh": "所选线路暂无号码。"
    },
    {
      "group": "purchase",
      "code": "PRICE_CONDITION_CHANGED",
      "statuses": [
        409
      ],
      "description": "Live price does not satisfy the authorized maximum.",
      "x-description-zh": "实时价格不满足授权最高价。"
    },
    {
      "code": "SERVICE_TEMPORARILY_UNAVAILABLE",
      "statuses": [
        503
      ],
      "group": "limits",
      "description": "Service is temporarily unavailable, including when current stock or price cannot be verified. Wait for Retry-After before retrying. Reuse the original idempotency key and parameters for the same purchase. Include requestId when contacting support.",
      "x-description-zh": "服务暂时不可用，包括无法核实当前库存或价格的情况。请按 Retry-After 等待后重试；同一购买请求请复用原幂等键和参数。联系支持时提供 requestId。"
    }
  ]
}
