{
  "openapi": "3.1.0",
  "info": {
    "title": "只只HTTP 静态 API",
    "version": "1.0.0",
    "description": "账户统一 API 令牌通过唯一 api_key 查询参数认证，无需权限勾选。开放状态以控制台为准。采购及操作以账户、类型、业务编号幂等。Webhook 使用独立通知 Secret 验签。"
  },
  "servers": [
    {
      "url": "https://api.zzhttp.com/openapi/v1/static",
      "description": "生产环境静态住宅公开 API"
    }
  ],
  "security": [
    {
      "AccountAPIKey": []
    }
  ],
  "paths": {
    "/balance": {
      "get": {
        "operationId": "get__balance",
        "summary": "查询账户余额",
        "parameters": [],
        "responses": {
          "200": {
            "description": "成功",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "const": 200
                    },
                    "message": {
                      "type": "string"
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Balance"
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "requestId",
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "标准业务错误；500/503可能结果不确定，保留业务编号查询",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/offers": {
      "get": {
        "operationId": "get__offers",
        "summary": "查询客户商品和库存快照",
        "parameters": [
          {
            "in": "query",
            "name": "countryCode",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cityCode",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "ispType",
            "schema": {
              "type": "integer",
              "enum": [
                1,
                2
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "const": 200
                    },
                    "message": {
                      "type": "string"
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Offers"
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "requestId",
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "标准业务错误；500/503可能结果不确定，保留业务编号查询",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/quotes": {
      "post": {
        "operationId": "post__quotes",
        "summary": "报价不冻结资金或库存",
        "parameters": [],
        "responses": {
          "200": {
            "description": "成功",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "const": 200
                    },
                    "message": {
                      "type": "string"
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Quote"
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "requestId",
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "标准业务错误；500/503可能结果不确定，保留业务编号查询",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuoteInput"
              }
            }
          }
        }
      }
    },
    "/orders": {
      "post": {
        "operationId": "post__orders",
        "summary": "原子受理采购（需当前有效实名认证）",
        "parameters": [],
        "responses": {
          "202": {
            "description": "异步受理，请查询最终状态",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "const": 200
                    },
                    "message": {
                      "type": "string"
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Order"
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "requestId",
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "未完成当前有效实名认证：code=10601",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "标准业务错误；500/503可能结果不确定，保留业务编号查询",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderInput"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "get__orders",
        "summary": "按下游编号找回订单",
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "in": "query",
            "name": "pageSize",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "in": "query",
            "name": "clientOrderNo",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "source",
            "schema": {
              "type": "string",
              "enum": [
                "console",
                "admin",
                "api"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "const": 200
                    },
                    "message": {
                      "type": "string"
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/OrderPage"
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "requestId",
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "标准业务错误；500/503可能结果不确定，保留业务编号查询",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/orders/{orderNo}": {
      "get": {
        "operationId": "get__orders_orderNo",
        "summary": "查询订单和逐项结算",
        "parameters": [
          {
            "in": "path",
            "name": "orderNo",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "const": 200
                    },
                    "message": {
                      "type": "string"
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Order"
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "requestId",
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "标准业务错误；500/503可能结果不确定，保留业务编号查询",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/instances": {
      "get": {
        "operationId": "get__instances",
        "summary": "查询账户实例",
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "in": "query",
            "name": "pageSize",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "in": "query",
            "name": "countryCode",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cityCode",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "orderNo",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "const": 200
                    },
                    "message": {
                      "type": "string"
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/InstancePage"
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "requestId",
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "标准业务错误；500/503可能结果不确定，保留业务编号查询",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/instances/{instanceId}": {
      "get": {
        "operationId": "get__instances_instanceId",
        "summary": "查询实例",
        "parameters": [
          {
            "in": "path",
            "name": "instanceId",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "const": 200
                    },
                    "message": {
                      "type": "string"
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Instance"
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "requestId",
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "标准业务错误；500/503可能结果不确定，保留业务编号查询",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/instances/credentials": {
      "post": {
        "operationId": "post__instances_credentials",
        "summary": "读取实际节点凭据，禁止缓存和日志",
        "parameters": [],
        "responses": {
          "200": {
            "description": "成功",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "const": 200
                    },
                    "message": {
                      "type": "string"
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Credentials"
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "requestId",
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "标准业务错误；500/503可能结果不确定，保留业务编号查询",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InstanceIDs"
              }
            }
          }
        }
      }
    },
    "/instances/renew": {
      "post": {
        "operationId": "post__instances_renew",
        "summary": "受理批量续费",
        "parameters": [],
        "responses": {
          "202": {
            "description": "异步受理，请查询最终状态",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "const": 200
                    },
                    "message": {
                      "type": "string"
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Operation"
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "requestId",
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "标准业务错误；500/503可能结果不确定，保留业务编号查询",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenewInput"
              }
            }
          }
        }
      }
    },
    "/instances/update-credentials": {
      "post": {
        "operationId": "post__instances_update-credentials",
        "summary": "受理批量改密",
        "parameters": [],
        "responses": {
          "default": {
            "description": "标准业务错误；500/503可能结果不确定，保留业务编号查询",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "同步改密结果；需检查逐项状态，未知结果使用原业务编号查询或重试",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "const": 200
                    },
                    "message": {
                      "type": "string"
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Operation"
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "requestId",
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CredentialUpdateInput"
              }
            }
          }
        }
      }
    },
    "/operations": {
      "get": {
        "operationId": "get__operations",
        "summary": "按下游操作号查询",
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "in": "query",
            "name": "pageSize",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "in": "query",
            "name": "clientOperationNo",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "const": 200
                    },
                    "message": {
                      "type": "string"
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/OperationPage"
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "requestId",
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "标准业务错误；500/503可能结果不确定，保留业务编号查询",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/operations/{operationId}": {
      "get": {
        "operationId": "get__operations_operationId",
        "summary": "查询逐实例操作结果",
        "parameters": [
          {
            "in": "path",
            "name": "operationId",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "const": 200
                    },
                    "message": {
                      "type": "string"
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Operation"
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "requestId",
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "标准业务错误；500/503可能结果不确定，保留业务编号查询",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/countries": {
      "get": {
        "operationId": "get__countries",
        "summary": "查询静态国家目录",
        "parameters": [
          {
            "in": "query",
            "name": "ispType",
            "schema": {
              "type": "integer",
              "enum": [
                1,
                2
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "const": 200
                    },
                    "message": {
                      "type": "string"
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "required": [
                        "items"
                      ],
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "countryCode",
                              "countryName"
                            ],
                            "properties": {
                              "countryCode": {
                                "type": "string"
                              },
                              "countryName": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "requestId",
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "标准业务错误；500/503可能结果不确定，保留业务编号查询",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/cities": {
      "get": {
        "operationId": "get__cities",
        "summary": "查询指定国家的静态城市目录",
        "parameters": [
          {
            "in": "query",
            "name": "countryCode",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z]{3}$"
            },
            "description": "国家三字码，例如 USA"
          },
          {
            "in": "query",
            "name": "ispType",
            "schema": {
              "type": "integer",
              "enum": [
                1,
                2
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "const": 200
                    },
                    "message": {
                      "type": "string"
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "required": [
                        "items"
                      ],
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "countryCode",
                              "cityCode",
                              "cityName"
                            ],
                            "properties": {
                              "countryCode": {
                                "type": "string"
                              },
                              "cityCode": {
                                "type": "string"
                              },
                              "cityName": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "requestId",
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "标准业务错误；500/503可能结果不确定，保留业务编号查询",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "AccountAPIKey": {
        "type": "apiKey",
        "in": "query",
        "name": "api_key",
        "description": "账户设置中的统一 API 令牌，允许调用全部公开 API。"
      }
    },
    "schemas": {
      "PurchaseItem": {
        "type": "object",
        "properties": {
          "offerId": {
            "type": "integer",
            "minimum": 1,
            "format": "int64"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000
          }
        },
        "required": [
          "offerId",
          "quantity"
        ],
        "additionalProperties": false
      },
      "OrderInput": {
        "type": "object",
        "properties": {
          "clientOrderNo": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.-]{1,64}$"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseItem"
            },
            "minItems": 1,
            "maxItems": 100
          },
          "expectedTotalAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          }
        },
        "required": [
          "clientOrderNo",
          "items",
          "expectedTotalAmountCents"
        ],
        "additionalProperties": false
      },
      "InstanceIDs": {
        "type": "object",
        "properties": {
          "instanceIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1,
              "format": "int64"
            },
            "minItems": 1,
            "maxItems": 100
          }
        },
        "required": [
          "instanceIds"
        ],
        "additionalProperties": false
      },
      "PurchaseQuote": {
        "type": "object",
        "properties": {
          "kind": {
            "const": "purchase"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseItem"
            },
            "minItems": 1,
            "maxItems": 100
          }
        },
        "required": [
          "kind",
          "items"
        ],
        "additionalProperties": false
      },
      "RenewQuote": {
        "type": "object",
        "properties": {
          "kind": {
            "const": "renew"
          },
          "instanceIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1,
              "format": "int64"
            },
            "minItems": 1,
            "maxItems": 100
          },
          "durationDays": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3650
          }
        },
        "required": [
          "kind",
          "instanceIds",
          "durationDays"
        ],
        "additionalProperties": false
      },
      "QuoteInput": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/PurchaseQuote"
          },
          {
            "$ref": "#/components/schemas/RenewQuote"
          }
        ]
      },
      "RenewInput": {
        "type": "object",
        "properties": {
          "clientOperationNo": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.-]{1,64}$"
          },
          "instanceIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1,
              "format": "int64"
            },
            "minItems": 1,
            "maxItems": 100
          },
          "durationDays": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3650
          },
          "expectedTotalAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          }
        },
        "required": [
          "clientOperationNo",
          "instanceIds",
          "durationDays",
          "expectedTotalAmountCents"
        ],
        "additionalProperties": false
      },
      "RandomCredentials": {
        "type": "object",
        "properties": {
          "clientOperationNo": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.-]{1,64}$"
          },
          "instanceIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1,
              "format": "int64"
            },
            "minItems": 1,
            "maxItems": 100
          },
          "randomize": {
            "const": true
          }
        },
        "required": [
          "clientOperationNo",
          "instanceIds",
          "randomize"
        ],
        "additionalProperties": false
      },
      "CustomCredentials": {
        "type": "object",
        "properties": {
          "clientOperationNo": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.-]{1,64}$"
          },
          "instanceIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1,
              "format": "int64"
            },
            "minItems": 1,
            "maxItems": 100
          },
          "randomize": {
            "const": false
          },
          "username": {
            "type": "string"
          },
          "password": {
            "type": "string",
            "writeOnly": true
          }
        },
        "required": [
          "clientOperationNo",
          "instanceIds",
          "randomize",
          "username",
          "password"
        ],
        "additionalProperties": false
      },
      "CredentialUpdateInput": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/RandomCredentials"
          },
          {
            "$ref": "#/components/schemas/CustomCredentials"
          }
        ]
      },
      "SettlementSource": {
        "type": "object",
        "properties": {
          "reservedAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "capturedAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "releasedAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "ExternalSettlement": {
        "type": "object",
        "properties": {
          "paidAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "capturedAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "unsettledAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "refundDueAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "refundedAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "refundPendingAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "Settlement": {
        "type": "object",
        "properties": {
          "fundingSource": {
            "enum": [
              "wallet",
              "external",
              "none"
            ]
          },
          "external": {
            "$ref": "#/components/schemas/ExternalSettlement"
          },
          "reservedAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "frozenAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "capturedAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "releasedAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "gift": {
            "$ref": "#/components/schemas/SettlementSource"
          },
          "recharge": {
            "$ref": "#/components/schemas/SettlementSource"
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "Balance": {
        "type": "object",
        "properties": {
          "rechargeBalanceCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "giftBalanceCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "frozenAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "purchasableAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "currency": {
            "const": "CNY"
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "Offer": {
        "type": "object",
        "properties": {
          "offerId": {
            "type": "integer",
            "minimum": 1,
            "format": "int64"
          },
          "ispType": {
            "enum": [
              1,
              2
            ]
          },
          "countryCode": {
            "type": "string"
          },
          "cityCode": {
            "type": "string"
          },
          "durationDays": {
            "type": "integer",
            "minimum": 0,
            "format": "int64"
          },
          "unitPriceCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "currency": {
            "const": "CNY"
          },
          "pricingSource": {
            "enum": [
              "customer",
              "retail"
            ]
          },
          "availableCount": {
            "type": "integer",
            "minimum": 0,
            "format": "int64"
          },
          "inventorySyncedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "purchasable": {
            "type": "boolean"
          },
          "capabilities": {
            "type": "object"
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "Offers": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Offer"
            }
          },
          "inventorySyncedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "QuoteItem": {
        "type": "object",
        "properties": {
          "offerId": {
            "type": "integer",
            "minimum": 1,
            "format": "int64"
          },
          "instanceId": {
            "type": "integer",
            "minimum": 1,
            "format": "int64"
          },
          "quantity": {
            "type": "integer",
            "minimum": 0,
            "format": "int64"
          },
          "durationDays": {
            "type": "integer",
            "minimum": 0,
            "format": "int64"
          },
          "unitPriceCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "amountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "pricingSource": {
            "type": "string"
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "Quote": {
        "type": "object",
        "properties": {
          "kind": {
            "enum": [
              "purchase",
              "renew"
            ]
          },
          "currency": {
            "const": "CNY"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QuoteItem"
            }
          },
          "totalAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "quotedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "inventoryReserved": {
            "const": false
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "OrderItem": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "integer",
            "minimum": 1,
            "format": "int64"
          },
          "offerId": {
            "type": "integer",
            "minimum": 1,
            "format": "int64"
          },
          "status": {
            "type": "string",
            "enum": [
              "accepted",
              "processing",
              "succeeded",
              "partial",
              "failed",
              "manual_review"
            ]
          },
          "requestedQuantity": {
            "type": "integer",
            "minimum": 0,
            "format": "int64"
          },
          "deliveredQuantity": {
            "type": "integer",
            "minimum": 0,
            "format": "int64"
          },
          "durationDays": {
            "type": "integer",
            "minimum": 0,
            "format": "int64"
          },
          "unitPriceCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "totalAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "pricingSource": {
            "type": "string"
          },
          "frozenAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "capturedAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "releasedAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "instanceIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1,
              "format": "int64"
            }
          },
          "errorCode": {
            "type": "string"
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "Order": {
        "type": "object",
        "properties": {
          "orderNo": {
            "type": "string"
          },
          "clientOrderNo": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "accepted",
              "processing",
              "succeeded",
              "partial",
              "failed",
              "manual_review"
            ]
          },
          "totalAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "currency": {
            "const": "CNY"
          },
          "settlement": {
            "$ref": "#/components/schemas/Settlement"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderItem"
            }
          },
          "createdAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "queryUrl": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "console",
              "admin",
              "api"
            ],
            "description": "下单来源：用户控制台、后台管理、公开API"
          },
          "operationId": {
            "type": "integer",
            "minimum": 1,
            "format": "int64",
            "description": "关联收费操作ID，不包含后台回查命令；无关联时省略"
          },
          "clientOperationNo": {
            "type": "string",
            "description": "关联收费操作的客户业务号；无关联时省略"
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "OperationItem": {
        "type": "object",
        "properties": {
          "instanceId": {
            "type": "integer",
            "minimum": 1,
            "format": "int64"
          },
          "status": {
            "type": "string",
            "enum": [
              "accepted",
              "processing",
              "succeeded",
              "partial",
              "failed",
              "manual_review"
            ]
          },
          "amountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "frozenAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "capturedAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "releasedAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "errorCode": {
            "type": "string",
            "description": "未提交改密安全结束时为 CREDENTIAL_UPDATE_NOT_SUBMITTED；其他供货失败为 FULFILLMENT_FAILED；成功为空字符串"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "Operation": {
        "type": "object",
        "properties": {
          "operationId": {
            "type": "integer",
            "minimum": 1,
            "format": "int64"
          },
          "clientOperationNo": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "accepted",
              "processing",
              "succeeded",
              "partial",
              "failed",
              "manual_review"
            ]
          },
          "totalAmountCents": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "人民币整数分"
          },
          "currency": {
            "const": "CNY"
          },
          "settlement": {
            "$ref": "#/components/schemas/Settlement"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OperationItem"
            }
          },
          "createdAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "queryUrl": {
            "type": "string"
          },
          "orderNo": {
            "type": "string",
            "description": "关联收费订单号；无收费订单时省略"
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "Instance": {
        "type": "object",
        "properties": {
          "instanceId": {
            "type": "integer",
            "minimum": 1,
            "format": "int64"
          },
          "offerId": {
            "type": "integer",
            "minimum": 1,
            "format": "int64"
          },
          "status": {
            "type": "string"
          },
          "ip": {
            "type": "string"
          },
          "port": {
            "type": "integer",
            "minimum": 0,
            "format": "int64"
          },
          "protocols": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "countryCode": {
            "type": "string"
          },
          "cityCode": {
            "type": "string"
          },
          "ispType": {
            "type": "integer",
            "minimum": 0,
            "format": "int64"
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "activatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "capabilities": {
            "type": "object"
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "Credential": {
        "type": "object",
        "properties": {
          "instanceId": {
            "type": "integer",
            "minimum": 1,
            "format": "int64"
          },
          "ip": {
            "type": "string"
          },
          "port": {
            "type": "integer",
            "minimum": 0,
            "format": "int64"
          },
          "protocols": {
            "type": "string"
          },
          "username": {
            "type": "string"
          },
          "password": {
            "type": "string"
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "Credentials": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Credential"
            }
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "OrderPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Order"
            }
          },
          "page": {
            "type": "integer",
            "minimum": 0,
            "format": "int64"
          },
          "pageSize": {
            "type": "integer",
            "minimum": 0,
            "format": "int64"
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "format": "int64"
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "OperationPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Operation"
            }
          },
          "page": {
            "type": "integer",
            "minimum": 0,
            "format": "int64"
          },
          "pageSize": {
            "type": "integer",
            "minimum": 0,
            "format": "int64"
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "format": "int64"
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "InstancePage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Instance"
            }
          },
          "page": {
            "type": "integer",
            "minimum": 0,
            "format": "int64"
          },
          "pageSize": {
            "type": "integer",
            "minimum": 0,
            "format": "int64"
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "format": "int64"
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "Error": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "description": "统一数字业务码，详见静态 API 文档"
          },
          "message": {
            "type": "string"
          },
          "requestId": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message",
          "requestId"
        ],
        "additionalProperties": false
      },
      "WebhookEvent": {
        "type": "object",
        "properties": {
          "eventId": {
            "type": "string"
          },
          "type": {
            "enum": [
              "order.completed"
            ]
          },
          "occurredAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "data": {
            "type": "object"
          }
        },
        "required": [
          "eventId",
          "type",
          "occurredAt",
          "data"
        ],
        "additionalProperties": false
      }
    }
  },
  "webhooks": {
    "staticResourceChanged": {
      "post": {
        "summary": "静态订单结果通知；使用 eventId 去重，处理重复与乱序",
        "security": [],
        "parameters": [
          {
            "in": "header",
            "name": "X-ZZ-Event-Id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-ZZ-Timestamp",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-ZZ-Nonce",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-ZZ-Signature",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "已持久接收或重复事件，2xx确认成功"
          }
        }
      }
    }
  }
}
