{
  "openapi": "3.0.3",
  "info": {
    "title": "GIGABIT Partner API",
    "version": "1.0.0",
    "description": "移动代理集成 API：端口订购与续租、访问管理和结算。\n\n耗时操作返回 HTTP 202 和服务器生成的 id。通过 GET /operations/{id} 查询状态及结果。查询状态不会创建新操作。"
  },
  "servers": [
    {
      "url": "https://api.gigabit.ltd/api/partner/v1"
    }
  ],
  "security": [
    {
      "PartnerToken": []
    }
  ],
  "tags": [
    {
      "name": "operations",
      "description": "操作"
    },
    {
      "name": "funds",
      "description": "余额与结算"
    },
    {
      "name": "orders",
      "description": "目录与订单"
    },
    {
      "name": "access",
      "description": "连接凭据与 IP 轮换"
    },
    {
      "name": "profile",
      "description": "合作伙伴资料"
    }
  ],
  "paths": {
    "/orders/{id}/rotation-token": {
      "post": {
        "operationId": "rotation-token",
        "tags": [
          "access"
        ],
        "summary": "重置 IP 轮换令牌",
        "description": "创建新的 IP 轮换令牌并返回可直接使用的 URL。旧令牌及包含该令牌的所有 URL 会立即失效。代理密码和定时器保持不变。\n\n响应会立即返回，无需后台操作。新 URL 也可从端口的 rotation_url 字段获取。",
        "responses": {
          "200": {
            "description": "响应示例",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "rotation_token": {
                          "type": "string"
                        },
                        "rotation_url": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                },
                "examples": {
                  "0": {
                    "summary": "新链接",
                    "value": {
                      "success": true,
                      "data": {
                        "rotation_token": "0123456789abcdef0123456789abcdef",
                        "rotation_url": "https://api.gigabit.ltd/change_ip?token=0123456789abcdef0123456789abcdef"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "秒"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "端口列表中 id 字段对应的订单 ID。"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              },
              "examples": {
                "0": {
                  "summary": "新链接",
                  "value": {}
                }
              }
            }
          }
        }
      }
    },
    "/balance": {
      "get": {
        "operationId": "balance",
        "tags": [
          "funds"
        ],
        "summary": "余额",
        "description": "当前余额、信用额度、可用资金、折扣和合作伙伴价格。\n\n",
        "responses": {
          "200": {
            "description": "响应示例",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "currency": {
                          "type": "string"
                        },
                        "balance_cents": {
                          "type": "integer"
                        },
                        "reserved_cents": {
                          "type": "integer"
                        },
                        "credit_limit_cents": {
                          "type": "integer"
                        },
                        "debt_cents": {
                          "type": "integer"
                        },
                        "available_cents": {
                          "type": "integer"
                        },
                        "withdrawable_cents": {
                          "type": "integer"
                        },
                        "discount_percent": {
                          "type": "integer"
                        },
                        "prefix": {
                          "type": "string"
                        },
                        "api_token_hint": {
                          "type": "string"
                        },
                        "monthly_net_cents": {
                          "type": "integer"
                        },
                        "payment_method": {
                          "type": "string"
                        },
                        "connection_domains": {
                          "type": "object",
                          "properties": {
                            "host": {
                              "type": "string"
                            },
                            "api": {
                              "type": "string"
                            }
                          }
                        },
                        "paid_in_cents": {
                          "type": "integer"
                        },
                        "prices": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "currency": {
                                "type": "string"
                              },
                              "base_net_cents": {
                                "type": "integer"
                              },
                              "net_cents": {
                                "type": "integer"
                              },
                              "vat_cents": {
                                "type": "integer"
                              },
                              "total_cents": {
                                "type": "integer"
                              },
                              "tax_at_topup": {
                                "type": "boolean"
                              },
                              "discount_percent": {
                                "type": "integer"
                              },
                              "months": {
                                "type": "integer"
                              },
                              "days": {
                                "type": "integer"
                              },
                              "pricing_version": {
                                "type": "integer"
                              },
                              "tax": {
                                "type": "object",
                                "properties": {
                                  "mode": {
                                    "type": "string"
                                  },
                                  "rate_percent": {
                                    "type": "integer"
                                  },
                                  "vat_code": {
                                    "type": "string"
                                  },
                                  "reverse_charge": {
                                    "type": "boolean"
                                  }
                                }
                              }
                            }
                          }
                        },
                        "topup_tax": {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string"
                            },
                            "rate_percent": {
                              "type": "integer"
                            },
                            "vat_code": {
                              "type": "string"
                            },
                            "reverse_charge": {
                              "type": "boolean"
                            }
                          }
                        },
                        "can_order_new_ports": {
                          "type": "boolean"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                },
                "examples": {
                  "0": {
                    "summary": "余额",
                    "value": {
                      "success": true,
                      "data": {
                        "currency": "EUR",
                        "balance_cents": 10000,
                        "reserved_cents": 0,
                        "credit_limit_cents": 10000,
                        "debt_cents": 0,
                        "available_cents": 20000,
                        "withdrawable_cents": 10000,
                        "discount_percent": 10,
                        "prefix": "astra",
                        "api_token_hint": "demo12",
                        "monthly_net_cents": 4500,
                        "payment_method": "card",
                        "connection_domains": {
                          "host": "",
                          "api": ""
                        },
                        "paid_in_cents": 10000,
                        "prices": [
                          {
                            "currency": "EUR",
                            "base_net_cents": 4500,
                            "net_cents": 4050,
                            "vat_cents": 0,
                            "total_cents": 4050,
                            "tax_at_topup": true,
                            "discount_percent": 10,
                            "months": 1,
                            "days": 30,
                            "pricing_version": 1,
                            "tax": {
                              "mode": "vat",
                              "rate_percent": 23,
                              "vat_code": "23",
                              "reverse_charge": false
                            }
                          }
                        ],
                        "topup_tax": {
                          "mode": "vat",
                          "rate_percent": 23,
                          "vat_code": "23",
                          "reverse_charge": false
                        },
                        "can_order_new_ports": true
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "秒"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/catalog": {
      "get": {
        "operationId": "catalog",
        "tags": [
          "orders"
        ],
        "summary": "可用端口",
        "description": "按运营商和地点分组的可用端口编号。\n\n每个端口均提供 supports_wireguard 字段，便于您在购买前选择支持 WireGuard 的调制解调器。",
        "responses": {
          "200": {
            "description": "响应示例",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "operator": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                }
                              },
                              "location": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                }
                              },
                              "ports": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "number": {
                                      "type": "integer"
                                    },
                                    "supports_wireguard": {
                                      "type": "boolean"
                                    }
                                  }
                                }
                              },
                              "available": {
                                "type": "integer"
                              }
                            }
                          }
                        },
                        "prices": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "currency": {
                                "type": "string"
                              },
                              "base_net_cents": {
                                "type": "integer"
                              },
                              "net_cents": {
                                "type": "integer"
                              },
                              "vat_cents": {
                                "type": "integer"
                              },
                              "total_cents": {
                                "type": "integer"
                              },
                              "tax_at_topup": {
                                "type": "boolean"
                              },
                              "discount_percent": {
                                "type": "integer"
                              },
                              "months": {
                                "type": "integer"
                              },
                              "days": {
                                "type": "integer"
                              },
                              "pricing_version": {
                                "type": "integer"
                              },
                              "tax": {
                                "type": "object",
                                "properties": {
                                  "mode": {
                                    "type": "string"
                                  },
                                  "rate_percent": {
                                    "type": "integer"
                                  },
                                  "vat_code": {
                                    "type": "string"
                                  },
                                  "reverse_charge": {
                                    "type": "boolean"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                },
                "examples": {
                  "0": {
                    "summary": "可用情况",
                    "value": {
                      "success": true,
                      "data": {
                        "items": [
                          {
                            "operator": {
                              "id": "operator-orange",
                              "name": "Orange"
                            },
                            "location": {
                              "id": "location-warsaw",
                              "name": "Warsaw"
                            },
                            "ports": [
                              {
                                "id": "b1c2d3e4f5a60123456789abcdef0123",
                                "number": 10001,
                                "supports_wireguard": true
                              },
                              {
                                "id": "b2c3d4e5f6a70123456789abcdef0123",
                                "number": 10002,
                                "supports_wireguard": true
                              }
                            ],
                            "available": 2
                          }
                        ],
                        "prices": [
                          {
                            "currency": "EUR",
                            "base_net_cents": 4500,
                            "net_cents": 4050,
                            "vat_cents": 0,
                            "total_cents": 4050,
                            "tax_at_topup": true,
                            "discount_percent": 10,
                            "months": 1,
                            "days": 30,
                            "pricing_version": 1,
                            "tax": {
                              "mode": "vat",
                              "rate_percent": 23,
                              "vat_code": "23",
                              "reverse_charge": false
                            }
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "秒"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/orders": {
      "post": {
        "operationId": "create-order",
        "tags": [
          "orders"
        ],
        "summary": "订购端口",
        "description": "使用目录中的端口编号或 ID 订购一个可用端口，租期为 30 天。费用从余额中扣除。\n\n耗时操作返回 HTTP 202 和服务器生成的 id。通过 GET /operations/{id} 查询状态及结果。查询状态不会创建新操作。",
        "responses": {
          "202": {
            "description": "响应示例",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "state": {
                              "type": "string"
                            },
                            "error": {
                              "type": "string",
                              "nullable": true
                            },
                            "result": {
                              "type": "object",
                              "nullable": true
                            },
                            "created_at": {
                              "type": "string"
                            },
                            "status_url": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": [
                        "success",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "state": {
                              "type": "string"
                            },
                            "error": {
                              "type": "string",
                              "nullable": true
                            },
                            "result": {
                              "type": "object",
                              "nullable": true
                            },
                            "created_at": {
                              "type": "string"
                            },
                            "status_url": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": [
                        "success",
                        "data"
                      ]
                    }
                  ]
                },
                "examples": {
                  "0": {
                    "summary": "按编号",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "op_0123456789abcdef0123456789abcdef",
                        "state": "queued",
                        "error": null,
                        "result": null,
                        "created_at": "2026-11-10T12:00:00+00:00",
                        "status_url": "/api/partner/v1/operations/op_0123456789abcdef0123456789abcdef"
                      }
                    }
                  },
                  "1": {
                    "summary": "按 ID",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "op_0123456789abcdef0123456789abcdef",
                        "state": "queued",
                        "error": null,
                        "result": null,
                        "created_at": "2026-11-10T12:00:00+00:00",
                        "status_url": "/api/partner/v1/operations/op_0123456789abcdef0123456789abcdef"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "秒"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "port_number": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 65535,
                    "description": "目录中的端口编号。port_number 与 port_id 必须且只能填写其中一个。"
                  },
                  "port_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "description": "目录中的端口 ID，可替代 port_number。"
                  }
                },
                "additionalProperties": false,
                "oneOf": [
                  {
                    "required": [
                      "port_number"
                    ]
                  },
                  {
                    "required": [
                      "port_id"
                    ]
                  }
                ]
              },
              "examples": {
                "0": {
                  "summary": "按编号",
                  "value": {
                    "port_number": 10001
                  }
                },
                "1": {
                  "summary": "按 ID",
                  "value": {
                    "port_id": "b1c2d3e4f5a60123456789abcdef0123"
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "orders",
        "tags": [
          "orders"
        ],
        "summary": "端口列表",
        "description": "账户当前端口：租用到期时间、连接信息、IP 和自动 IP 轮换设置。\n\n如需更换 IP，请向端口详情返回的完整 rotation_url 发送 GET 请求。无需 Authorization 请求头，因为 URL 已包含端口令牌。",
        "responses": {
          "200": {
            "description": "响应示例",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "port_id": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": "integer"
                                  },
                                  "host": {
                                    "type": "string"
                                  },
                                  "username": {
                                    "type": "string"
                                  },
                                  "proxy_password": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string"
                                  },
                                  "expires": {
                                    "type": "string"
                                  },
                                  "operator": {
                                    "type": "string"
                                  },
                                  "cityName": {
                                    "type": "string"
                                  },
                                  "ip": {
                                    "type": "string"
                                  },
                                  "speed": {
                                    "type": "object",
                                    "required": [
                                      "mbps",
                                      "checked_at"
                                    ],
                                    "properties": {
                                      "mbps": {
                                        "type": "number",
                                        "nullable": true,
                                        "minimum": 0,
                                        "exclusiveMinimum": true
                                      },
                                      "checked_at": {
                                        "type": "string",
                                        "format": "date-time",
                                        "nullable": true
                                      }
                                    }
                                  },
                                  "rotation_url": {
                                    "type": "string"
                                  },
                                  "rotation": {
                                    "type": "boolean"
                                  },
                                  "rotation_seconds": {
                                    "type": "integer"
                                  },
                                  "connection_options": {
                                    "type": "object",
                                    "properties": {
                                      "udp": {
                                        "type": "object",
                                        "properties": {
                                          "host": {
                                            "type": "string"
                                          }
                                        }
                                      },
                                      "custom": {
                                        "type": "object",
                                        "properties": {
                                          "host": {
                                            "type": "string"
                                          },
                                          "rotation_url": {
                                            "type": "string"
                                          }
                                        }
                                      }
                                    }
                                  },
                                  "supports_wireguard": {
                                    "type": "boolean"
                                  }
                                }
                              }
                            }
                          }
                        }
                      },
                      "required": [
                        "success",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "port_id": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": "integer"
                                  },
                                  "host": {
                                    "type": "string"
                                  },
                                  "username": {
                                    "type": "string"
                                  },
                                  "proxy_password": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string"
                                  },
                                  "expires": {
                                    "type": "string"
                                  },
                                  "operator": {
                                    "type": "string"
                                  },
                                  "cityName": {
                                    "type": "string"
                                  },
                                  "ip": {
                                    "type": "string"
                                  },
                                  "speed": {
                                    "type": "object",
                                    "required": [
                                      "mbps",
                                      "checked_at"
                                    ],
                                    "properties": {
                                      "mbps": {
                                        "type": "number",
                                        "nullable": true,
                                        "minimum": 0,
                                        "exclusiveMinimum": true
                                      },
                                      "checked_at": {
                                        "type": "string",
                                        "format": "date-time",
                                        "nullable": true
                                      }
                                    }
                                  },
                                  "rotation_url": {
                                    "type": "string"
                                  },
                                  "rotation": {
                                    "type": "boolean"
                                  },
                                  "rotation_seconds": {
                                    "type": "integer"
                                  },
                                  "connection_options": {
                                    "type": "object",
                                    "properties": {
                                      "udp": {
                                        "type": "object",
                                        "properties": {
                                          "host": {
                                            "type": "string"
                                          }
                                        }
                                      },
                                      "custom": {
                                        "type": "object",
                                        "properties": {
                                          "host": {
                                            "type": "string"
                                          },
                                          "rotation_url": {
                                            "type": "string"
                                          }
                                        }
                                      }
                                    }
                                  },
                                  "supports_wireguard": {
                                    "type": "boolean"
                                  },
                                  "wireguard": {
                                    "type": "object",
                                    "nullable": true,
                                    "required": [
                                      "state",
                                      "enabled",
                                      "pause_reason",
                                      "config",
                                      "revision",
                                      "filename",
                                      "qr_data_url"
                                    ],
                                    "properties": {
                                      "state": {
                                        "type": "string",
                                        "enum": [
                                          "active",
                                          "paused"
                                        ]
                                      },
                                      "enabled": {
                                        "type": "boolean"
                                      },
                                      "pause_reason": {
                                        "type": "string",
                                        "nullable": true
                                      },
                                      "config": {
                                        "type": "string",
                                        "nullable": true
                                      },
                                      "revision": {
                                        "type": "string",
                                        "nullable": true
                                      },
                                      "filename": {
                                        "type": "string",
                                        "nullable": true
                                      },
                                      "qr_data_url": {
                                        "type": "string",
                                        "nullable": true
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      },
                      "required": [
                        "success",
                        "data"
                      ]
                    }
                  ]
                },
                "examples": {
                  "0": {
                    "summary": "端口",
                    "value": {
                      "success": true,
                      "data": {
                        "items": [
                          {
                            "id": "a1b2c3d4e5f60123456789abcdef0123",
                            "port_id": "b1c2d3e4f5a60123456789abcdef0123",
                            "number": 10001,
                            "host": "l1.gigabit.ltd",
                            "username": "astra_a1b2c3d4e5f",
                            "proxy_password": "EXAMPLE_ONLY_22_CHARS_x",
                            "status": "active",
                            "expires": "2026-12-09T22:59:59+00:00",
                            "operator": "Orange",
                            "cityName": "Warsaw",
                            "ip": "198.51.100.42",
                            "speed": {
                              "mbps": 28.43,
                              "checked_at": "2026-11-11T12:00:00+00:00"
                            },
                            "rotation_url": "https://api.gigabit.ltd/change_ip?token=EXAMPLE_ROTATION_TOKEN_REPLACE_ME",
                            "rotation": true,
                            "rotation_seconds": 120,
                            "connection_options": {
                              "udp": {
                                "host": "203.0.113.10"
                              },
                              "custom": {
                                "host": "proxy.example.com",
                                "rotation_url": "https://api.example.com/change_ip?token=EXAMPLE_ROTATION_TOKEN_REPLACE_ME"
                              }
                            },
                            "supports_wireguard": true
                          }
                        ]
                      }
                    }
                  },
                  "1": {
                    "summary": "包含 WireGuard",
                    "value": {
                      "success": true,
                      "data": {
                        "items": [
                          {
                            "id": "a1b2c3d4e5f60123456789abcdef0123",
                            "port_id": "b1c2d3e4f5a60123456789abcdef0123",
                            "number": 10001,
                            "host": "l1.gigabit.ltd",
                            "username": "astra_a1b2c3d4e5f",
                            "proxy_password": "EXAMPLE_ONLY_22_CHARS_x",
                            "status": "active",
                            "expires": "2026-12-09T22:59:59+00:00",
                            "operator": "Orange",
                            "cityName": "Warsaw",
                            "ip": "198.51.100.42",
                            "speed": {
                              "mbps": 28.43,
                              "checked_at": "2026-11-11T12:00:00+00:00"
                            },
                            "rotation_url": "https://api.gigabit.ltd/change_ip?token=EXAMPLE_ROTATION_TOKEN_REPLACE_ME",
                            "rotation": true,
                            "rotation_seconds": 120,
                            "connection_options": {
                              "udp": {
                                "host": "203.0.113.10"
                              },
                              "custom": {
                                "host": "proxy.example.com",
                                "rotation_url": "https://api.example.com/change_ip?token=EXAMPLE_ROTATION_TOKEN_REPLACE_ME"
                              }
                            },
                            "supports_wireguard": true,
                            "wireguard": {
                              "state": "active",
                              "enabled": true,
                              "pause_reason": null,
                              "config": "[Interface]\nPrivateKey = EXAMPLE_PRIVATE_KEY\nAddress = 10.77.0.2/32\nDNS = 1.1.1.1\n\n[Peer]\nPublicKey = EXAMPLE_SERVER_KEY\nPresharedKey = EXAMPLE_PRESHARED_KEY\nEndpoint = vpn.example.com:51820\nAllowedIPs = 0.0.0.0/0, ::/0\nPersistentKeepalive = 25\n",
                              "revision": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                              "filename": "gigabit-wireguard-10001.conf",
                              "qr_data_url": "data:image/png;base64,EXAMPLE_PNG_BASE64"
                            }
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "秒"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "include",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "wireguard"
              ],
              "description": "添加 include=wireguard 可获取每个受支持端口的现有配置和二维码。"
            }
          }
        ]
      }
    },
    "/operations/{id}": {
      "get": {
        "operationId": "operation-status",
        "tags": [
          "operations"
        ],
        "summary": "操作状态",
        "description": "返回账户内操作的状态与结果。可快速查询，无需重复执行操作。\n\n",
        "responses": {
          "200": {
            "description": "响应示例",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "state": {
                              "type": "string"
                            },
                            "error": {
                              "type": "string",
                              "nullable": true
                            },
                            "result": {
                              "type": "object",
                              "nullable": true
                            },
                            "created_at": {
                              "type": "string"
                            },
                            "status_url": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": [
                        "success",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "state": {
                              "type": "string"
                            },
                            "error": {
                              "type": "string",
                              "nullable": true
                            },
                            "result": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "state": {
                                  "type": "string"
                                },
                                "error": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "order_ids": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "amount_cents": {
                                  "type": "integer"
                                },
                                "currency": {
                                  "type": "string"
                                },
                                "price": {
                                  "type": "object",
                                  "properties": {
                                    "currency": {
                                      "type": "string"
                                    },
                                    "base_net_cents": {
                                      "type": "integer"
                                    },
                                    "net_cents": {
                                      "type": "integer"
                                    },
                                    "vat_cents": {
                                      "type": "integer"
                                    },
                                    "total_cents": {
                                      "type": "integer"
                                    },
                                    "tax_at_topup": {
                                      "type": "boolean"
                                    },
                                    "discount_percent": {
                                      "type": "integer"
                                    },
                                    "months": {
                                      "type": "integer"
                                    },
                                    "days": {
                                      "type": "integer"
                                    },
                                    "pricing_version": {
                                      "type": "integer"
                                    },
                                    "tax": {
                                      "type": "object",
                                      "properties": {
                                        "mode": {
                                          "type": "string"
                                        },
                                        "rate_percent": {
                                          "type": "integer"
                                        },
                                        "vat_code": {
                                          "type": "string"
                                        },
                                        "reverse_charge": {
                                          "type": "boolean"
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            },
                            "created_at": {
                              "type": "string"
                            },
                            "status_url": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": [
                        "success",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "state": {
                              "type": "string"
                            },
                            "error": {
                              "type": "string"
                            },
                            "result": {
                              "type": "object",
                              "nullable": true
                            },
                            "created_at": {
                              "type": "string"
                            },
                            "status_url": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": [
                        "success",
                        "data"
                      ]
                    }
                  ]
                },
                "examples": {
                  "0": {
                    "summary": "等待中",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "op_0123456789abcdef0123456789abcdef",
                        "state": "queued",
                        "error": null,
                        "result": null,
                        "created_at": "2026-11-10T12:00:00+00:00",
                        "status_url": "/api/partner/v1/operations/op_0123456789abcdef0123456789abcdef"
                      }
                    }
                  },
                  "1": {
                    "summary": "已完成",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "op_0123456789abcdef0123456789abcdef",
                        "state": "ready",
                        "error": null,
                        "result": {
                          "id": "partner_0123456789abcdef0123456789abcdef",
                          "state": "ready",
                          "error": null,
                          "order_ids": [
                            "a1b2c3d4e5f60123456789abcdef0123"
                          ],
                          "amount_cents": 4050,
                          "currency": "EUR",
                          "price": {
                            "currency": "EUR",
                            "base_net_cents": 4500,
                            "net_cents": 4050,
                            "vat_cents": 0,
                            "total_cents": 4050,
                            "tax_at_topup": true,
                            "discount_percent": 10,
                            "months": 1,
                            "days": 30,
                            "pricing_version": 1,
                            "tax": {
                              "mode": "vat",
                              "rate_percent": 23,
                              "vat_code": "23",
                              "reverse_charge": false
                            }
                          }
                        },
                        "created_at": "2026-11-10T12:00:00+00:00",
                        "status_url": "/api/partner/v1/operations/op_0123456789abcdef0123456789abcdef"
                      }
                    }
                  },
                  "2": {
                    "summary": "失败",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "op_0123456789abcdef0123456789abcdef",
                        "state": "failed",
                        "error": "insufficient_partner_balance",
                        "result": null,
                        "created_at": "2026-11-10T12:00:00+00:00",
                        "status_url": "/api/partner/v1/operations/op_0123456789abcdef0123456789abcdef"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "秒"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "HTTP 202 响应中返回的操作 ID。"
            }
          }
        ]
      }
    },
    "/orders/{id}": {
      "get": {
        "operationId": "order",
        "tags": [
          "orders"
        ],
        "summary": "端口详情",
        "description": "查询属于此账户的订单详情。无权访问或不存在的订单返回 404。\n\n租用到期后，WireGuard 会暂停，配置在 24 小时端口保留期（due）内保留。续租会恢复相同配置，但手动暂停的访问除外。只有 enabled=true 才会解除手动暂停。取消租用并释放端口后，旧配置会被删除。手动暂停 WireGuard 不影响 HTTP(S) 或 SOCKS5。",
        "responses": {
          "200": {
            "description": "响应示例",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "port_id": {
                          "type": "string"
                        },
                        "number": {
                          "type": "integer"
                        },
                        "host": {
                          "type": "string"
                        },
                        "username": {
                          "type": "string"
                        },
                        "proxy_password": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "expires": {
                          "type": "string"
                        },
                        "operator": {
                          "type": "string"
                        },
                        "cityName": {
                          "type": "string"
                        },
                        "ip": {
                          "type": "string"
                        },
                        "speed": {
                          "type": "object",
                          "required": [
                            "mbps",
                            "checked_at"
                          ],
                          "properties": {
                            "mbps": {
                              "type": "number",
                              "nullable": true,
                              "minimum": 0,
                              "exclusiveMinimum": true
                            },
                            "checked_at": {
                              "type": "string",
                              "format": "date-time",
                              "nullable": true
                            }
                          }
                        },
                        "rotation_url": {
                          "type": "string"
                        },
                        "rotation": {
                          "type": "boolean"
                        },
                        "rotation_seconds": {
                          "type": "integer"
                        },
                        "connection_options": {
                          "type": "object",
                          "properties": {
                            "udp": {
                              "type": "object",
                              "properties": {
                                "host": {
                                  "type": "string"
                                }
                              }
                            },
                            "custom": {
                              "type": "object",
                              "properties": {
                                "host": {
                                  "type": "string"
                                },
                                "rotation_url": {
                                  "type": "string"
                                }
                              }
                            }
                          }
                        },
                        "supports_wireguard": {
                          "type": "boolean"
                        },
                        "wireguard": {
                          "type": "object",
                          "nullable": true,
                          "required": [
                            "state",
                            "enabled",
                            "pause_reason",
                            "config",
                            "revision",
                            "filename",
                            "qr_data_url"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "active",
                                "paused"
                              ]
                            },
                            "enabled": {
                              "type": "boolean"
                            },
                            "pause_reason": {
                              "type": "string",
                              "nullable": true
                            },
                            "config": {
                              "type": "string",
                              "nullable": true
                            },
                            "revision": {
                              "type": "string",
                              "nullable": true
                            },
                            "filename": {
                              "type": "string",
                              "nullable": true
                            },
                            "qr_data_url": {
                              "type": "string",
                              "nullable": true
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                },
                "examples": {
                  "0": {
                    "summary": "端口",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "a1b2c3d4e5f60123456789abcdef0123",
                        "port_id": "b1c2d3e4f5a60123456789abcdef0123",
                        "number": 10001,
                        "host": "l1.gigabit.ltd",
                        "username": "astra_a1b2c3d4e5f",
                        "proxy_password": "EXAMPLE_ONLY_22_CHARS_x",
                        "status": "active",
                        "expires": "2026-12-09T22:59:59+00:00",
                        "operator": "Orange",
                        "cityName": "Warsaw",
                        "ip": "198.51.100.42",
                        "speed": {
                          "mbps": 28.43,
                          "checked_at": "2026-11-11T12:00:00+00:00"
                        },
                        "rotation_url": "https://api.gigabit.ltd/change_ip?token=EXAMPLE_ROTATION_TOKEN_REPLACE_ME",
                        "rotation": true,
                        "rotation_seconds": 120,
                        "connection_options": {
                          "udp": {
                            "host": "203.0.113.10"
                          },
                          "custom": {
                            "host": "proxy.example.com",
                            "rotation_url": "https://api.example.com/change_ip?token=EXAMPLE_ROTATION_TOKEN_REPLACE_ME"
                          }
                        },
                        "supports_wireguard": true,
                        "wireguard": {
                          "state": "active",
                          "enabled": true,
                          "pause_reason": null,
                          "config": "[Interface]\nPrivateKey = EXAMPLE_PRIVATE_KEY\nAddress = 10.77.0.2/32\nDNS = 1.1.1.1\n\n[Peer]\nPublicKey = EXAMPLE_SERVER_KEY\nPresharedKey = EXAMPLE_PRESHARED_KEY\nEndpoint = vpn.example.com:51820\nAllowedIPs = 0.0.0.0/0, ::/0\nPersistentKeepalive = 25\n",
                          "revision": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                          "filename": "gigabit-wireguard-10001.conf",
                          "qr_data_url": "data:image/png;base64,EXAMPLE_PNG_BASE64"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "秒"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "端口列表中的订单 ID（id）或端口 ID（port_id）。"
            }
          }
        ]
      }
    },
    "/orders/{id}/renew": {
      "post": {
        "operationId": "renew",
        "tags": [
          "orders"
        ],
        "summary": "端口续租",
        "description": "从余额付款，将一个端口的租期延长 30 天。只需在 URL 中指定端口编号或 ID。\n\n耗时操作返回 HTTP 202 和服务器生成的 id。通过 GET /operations/{id} 查询状态及结果。查询状态不会创建新操作。",
        "responses": {
          "202": {
            "description": "响应示例",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "state": {
                              "type": "string"
                            },
                            "error": {
                              "type": "string",
                              "nullable": true
                            },
                            "result": {
                              "type": "object",
                              "nullable": true
                            },
                            "created_at": {
                              "type": "string"
                            },
                            "status_url": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": [
                        "success",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "state": {
                              "type": "string"
                            },
                            "error": {
                              "type": "string",
                              "nullable": true
                            },
                            "result": {
                              "type": "object",
                              "nullable": true
                            },
                            "created_at": {
                              "type": "string"
                            },
                            "status_url": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": [
                        "success",
                        "data"
                      ]
                    }
                  ]
                },
                "examples": {
                  "0": {
                    "summary": "按编号",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "op_0123456789abcdef0123456789abcdef",
                        "state": "queued",
                        "error": null,
                        "result": null,
                        "created_at": "2026-11-10T12:00:00+00:00",
                        "status_url": "/api/partner/v1/operations/op_0123456789abcdef0123456789abcdef"
                      }
                    }
                  },
                  "1": {
                    "summary": "按 ID",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "op_0123456789abcdef0123456789abcdef",
                        "state": "queued",
                        "error": null,
                        "result": null,
                        "created_at": "2026-11-10T12:00:00+00:00",
                        "status_url": "/api/partner/v1/operations/op_0123456789abcdef0123456789abcdef"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "秒"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "端口编号或端口 ID。也接受 GET /orders 返回的订单 id。"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              },
              "examples": {
                "0": {
                  "summary": "按编号",
                  "value": {}
                },
                "1": {
                  "summary": "按 ID",
                  "value": {}
                }
              }
            }
          }
        }
      }
    },
    "/orders/{id}/password": {
      "post": {
        "operationId": "password",
        "tags": [
          "access"
        ],
        "summary": "按 ID 修改连接凭据",
        "description": "服务器生成新密码。设置 change_login=true 时，还会使用当前合作伙伴前缀生成新登录名。仅适用于有效租用。\n\n新凭据生效后可在 result 中获取。operation_superseded 表示更新的命令已修改凭据。",
        "responses": {
          "202": {
            "description": "响应示例",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "state": {
                              "type": "string"
                            },
                            "error": {
                              "type": "string",
                              "nullable": true
                            },
                            "result": {
                              "type": "object",
                              "nullable": true
                            },
                            "created_at": {
                              "type": "string"
                            },
                            "status_url": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": [
                        "success",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "state": {
                              "type": "string"
                            },
                            "error": {
                              "type": "string",
                              "nullable": true
                            },
                            "result": {
                              "type": "object",
                              "nullable": true
                            },
                            "created_at": {
                              "type": "string"
                            },
                            "status_url": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": [
                        "success",
                        "data"
                      ]
                    }
                  ]
                },
                "examples": {
                  "0": {
                    "summary": "登录名和密码",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "op_0123456789abcdef0123456789abcdef",
                        "state": "queued",
                        "error": null,
                        "result": null,
                        "created_at": "2026-11-10T12:00:00+00:00",
                        "status_url": "/api/partner/v1/operations/op_0123456789abcdef0123456789abcdef"
                      }
                    }
                  },
                  "1": {
                    "summary": "仅密码",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "op_0123456789abcdef0123456789abcdef",
                        "state": "queued",
                        "error": null,
                        "result": null,
                        "created_at": "2026-11-10T12:00:00+00:00",
                        "status_url": "/api/partner/v1/operations/op_0123456789abcdef0123456789abcdef"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "秒"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "端口列表中的订单 ID（id）或端口 ID（port_id）。"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "change_login": {
                    "type": "boolean",
                    "default": false,
                    "description": "true：使用当前前缀生成新登录名和新密码。false：仅更改密码。旧版共享凭据即使未设置此标记，也会转换为独立的登录名和密码。"
                  }
                },
                "additionalProperties": false
              },
              "examples": {
                "0": {
                  "summary": "登录名和密码",
                  "value": {
                    "change_login": true
                  }
                },
                "1": {
                  "summary": "仅密码",
                  "value": {
                    "change_login": false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/orders/{id}/rotation": {
      "get": {
        "operationId": "rotation-get",
        "tags": [
          "access"
        ],
        "summary": "IP 轮换定时器",
        "description": "当前定时器状态。rotation=true 时包含 rotation_seconds；停用时仅返回 rotation=false。\n\n",
        "responses": {
          "200": {
            "description": "响应示例",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "rotation": {
                              "type": "boolean"
                            },
                            "rotation_seconds": {
                              "type": "integer"
                            }
                          }
                        }
                      },
                      "required": [
                        "success",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "rotation": {
                              "type": "boolean"
                            }
                          }
                        }
                      },
                      "required": [
                        "success",
                        "data"
                      ]
                    }
                  ]
                },
                "examples": {
                  "0": {
                    "summary": "已启用",
                    "value": {
                      "success": true,
                      "data": {
                        "rotation": true,
                        "rotation_seconds": 120
                      }
                    }
                  },
                  "1": {
                    "summary": "已停用",
                    "value": {
                      "success": true,
                      "data": {
                        "rotation": false
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "秒"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "端口列表中的订单 ID（id）或端口 ID（port_id）。"
            }
          }
        ]
      },
      "put": {
        "operationId": "rotation-set",
        "tags": [
          "access"
        ],
        "summary": "定时器设置",
        "description": "设置 rotation=true 和 rotation_seconds 可启用定时器，间隔为 20 至 86400 秒的整数。小于 20 时返回 rotation_interval_too_short。如需停用，仅发送 rotation=false。\n\n在定时器设置确认生效前，操作状态保持 processing。",
        "responses": {
          "202": {
            "description": "响应示例",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "state": {
                              "type": "string"
                            },
                            "error": {
                              "type": "string",
                              "nullable": true
                            },
                            "result": {
                              "type": "object",
                              "nullable": true
                            },
                            "created_at": {
                              "type": "string"
                            },
                            "status_url": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": [
                        "success",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "state": {
                              "type": "string"
                            },
                            "error": {
                              "type": "string",
                              "nullable": true
                            },
                            "result": {
                              "type": "object",
                              "nullable": true
                            },
                            "created_at": {
                              "type": "string"
                            },
                            "status_url": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": [
                        "success",
                        "data"
                      ]
                    }
                  ]
                },
                "examples": {
                  "0": {
                    "summary": "每 120 秒",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "op_0123456789abcdef0123456789abcdef",
                        "state": "queued",
                        "error": null,
                        "result": null,
                        "created_at": "2026-11-10T12:00:00+00:00",
                        "status_url": "/api/partner/v1/operations/op_0123456789abcdef0123456789abcdef"
                      }
                    }
                  },
                  "1": {
                    "summary": "停用",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "op_0123456789abcdef0123456789abcdef",
                        "state": "queued",
                        "error": null,
                        "result": null,
                        "created_at": "2026-11-10T12:00:00+00:00",
                        "status_url": "/api/partner/v1/operations/op_0123456789abcdef0123456789abcdef"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "秒"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "端口列表中的订单 ID（id）或端口 ID（port_id）。"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rotation": {
                    "type": "boolean",
                    "description": "true 启用定时器；false 停用定时器。"
                  },
                  "rotation_seconds": {
                    "type": "integer",
                    "minimum": 20,
                    "maximum": 86400,
                    "description": "rotation=true 时必填。rotation=false 时请省略此字段。"
                  }
                },
                "additionalProperties": false,
                "required": [
                  "rotation"
                ],
                "oneOf": [
                  {
                    "properties": {
                      "rotation": {
                        "enum": [
                          true
                        ]
                      }
                    },
                    "required": [
                      "rotation_seconds"
                    ]
                  },
                  {
                    "properties": {
                      "rotation": {
                        "enum": [
                          false
                        ]
                      }
                    },
                    "not": {
                      "required": [
                        "rotation_seconds"
                      ]
                    }
                  }
                ]
              },
              "examples": {
                "0": {
                  "summary": "每 120 秒",
                  "value": {
                    "rotation": true,
                    "rotation_seconds": 120
                  }
                },
                "1": {
                  "summary": "停用",
                  "value": {
                    "rotation": false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/topups": {
      "post": {
        "operationId": "topup",
        "tags": [
          "funds"
        ],
        "summary": "账户充值",
        "description": "创建 Stripe 支付链接。amount_cents 为以欧分表示的余额入账金额；total_cents 为包含适用增值税的应付总额。\n\n",
        "responses": {
          "202": {
            "description": "响应示例",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string"
                        },
                        "error": {
                          "type": "string",
                          "nullable": true
                        },
                        "result": {
                          "type": "object",
                          "nullable": true
                        },
                        "created_at": {
                          "type": "string"
                        },
                        "status_url": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                },
                "examples": {
                  "0": {
                    "summary": "银行卡 / Stripe",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "op_0123456789abcdef0123456789abcdef",
                        "state": "queued",
                        "error": null,
                        "result": null,
                        "created_at": "2026-11-10T12:00:00+00:00",
                        "status_url": "/api/partner/v1/operations/op_0123456789abcdef0123456789abcdef"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "秒"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount_cents": {
                    "type": "integer",
                    "minimum": 100,
                    "maximum": 10000000,
                    "description": "1–100,000 欧元，以欧分整数表示。"
                  }
                },
                "additionalProperties": false,
                "required": [
                  "amount_cents"
                ]
              },
              "examples": {
                "0": {
                  "summary": "银行卡 / Stripe",
                  "value": {
                    "amount_cents": 10000
                  }
                }
              }
            }
          }
        }
      }
    },
    "/topups/{id}": {
      "get": {
        "operationId": "topup-status",
        "tags": [
          "funds"
        ],
        "summary": "充值状态",
        "description": "返回账户充值状态。paid 表示金额已计入余额。仅从 Stripe 返回不代表付款成功。\n\n状态：creating、pending、paid、expired、failed。",
        "responses": {
          "200": {
            "description": "响应示例",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string"
                        },
                        "url": {
                          "type": "string"
                        },
                        "amount_cents": {
                          "type": "integer"
                        },
                        "vat_cents": {
                          "type": "integer"
                        },
                        "total_cents": {
                          "type": "integer"
                        },
                        "currency": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                },
                "examples": {
                  "0": {
                    "summary": "Stripe",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "ptop_0123456789abcdef0123456789abcdef",
                        "state": "pending",
                        "url": "https://checkout.stripe.com/c/pay/EXAMPLE_SESSION",
                        "amount_cents": 10000,
                        "vat_cents": 2300,
                        "total_cents": 12300,
                        "currency": "EUR"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "秒"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "POST /topups 返回的充值 ID。"
            }
          }
        ]
      }
    },
    "/transactions": {
      "get": {
        "operationId": "transactions",
        "tags": [
          "funds"
        ],
        "summary": "交易历史",
        "description": "按从新到旧的顺序列出交易，包括来源、备注、金额及每笔交易后的余额。购买时的技术性资金预留默认隐藏。\n\n",
        "responses": {
          "200": {
            "description": "响应示例",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "created_at": {
                                "type": "string"
                              },
                              "currency": {
                                "type": "string"
                              },
                              "operation": {
                                "type": "string"
                              },
                              "amount_cents": {
                                "type": "integer"
                              },
                              "reserved_delta_cents": {
                                "type": "integer"
                              },
                              "source": {
                                "type": "string"
                              },
                              "comment": {
                                "type": "string"
                              },
                              "reference": {
                                "type": "string"
                              },
                              "balance_after_cents": {
                                "type": "integer"
                              },
                              "reserved_after_cents": {
                                "type": "integer"
                              },
                              "sequence": {
                                "type": "integer"
                              }
                            }
                          }
                        },
                        "total": {
                          "type": "integer"
                        },
                        "offset": {
                          "type": "integer"
                        },
                        "limit": {
                          "type": "integer"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                },
                "examples": {
                  "0": {
                    "summary": "第一页",
                    "value": {
                      "success": true,
                      "data": {
                        "items": [
                          {
                            "id": "ptop_0123456789abcdef0123456789abcdef:credit",
                            "created_at": "2026-11-09T12:05:00+00:00",
                            "currency": "EUR",
                            "operation": "topup",
                            "amount_cents": 10000,
                            "reserved_delta_cents": 0,
                            "source": "stripe",
                            "comment": "",
                            "reference": "ptop_0123456789abcdef0123456789abcdef",
                            "balance_after_cents": 10000,
                            "reserved_after_cents": 0,
                            "sequence": 1
                          }
                        ],
                        "total": 1,
                        "offset": 0,
                        "limit": 30
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "秒"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0,
              "description": "跳过的记录数。"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 30,
              "description": "每页记录数：1–100。"
            }
          },
          {
            "name": "include_reservations",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ],
              "description": "设为 1 时包含 purchase_reserve 和 purchase_release。"
            }
          }
        ]
      }
    },
    "/withdrawals": {
      "post": {
        "operationId": "withdrawal",
        "tags": [
          "funds"
        ],
        "summary": "提款申请",
        "description": "创建申请并预留金额，等待审核。withdrawable_cents 表示可退款金额，不包含信用额度和不可退的补偿金额。\n\n申请处理后，result.state=requested 表示等待审核决定。在付款确认或申请被拒绝前，操作状态保持 processing。",
        "responses": {
          "202": {
            "description": "响应示例",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string"
                        },
                        "error": {
                          "type": "string",
                          "nullable": true
                        },
                        "result": {
                          "type": "object",
                          "nullable": true
                        },
                        "created_at": {
                          "type": "string"
                        },
                        "status_url": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                },
                "examples": {
                  "0": {
                    "summary": "申请",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "op_0123456789abcdef0123456789abcdef",
                        "state": "queued",
                        "error": null,
                        "result": null,
                        "created_at": "2026-11-10T12:00:00+00:00",
                        "status_url": "/api/partner/v1/operations/op_0123456789abcdef0123456789abcdef"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "秒"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount_cents": {
                    "type": "integer",
                    "minimum": 100,
                    "maximum": 100000000,
                    "description": "以欧分表示的金额，不得超过可提款金额。"
                  },
                  "comment": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000,
                    "description": "收款信息或说明。去除首尾空白后不能为空。"
                  }
                },
                "additionalProperties": false,
                "required": [
                  "amount_cents",
                  "comment"
                ]
              },
              "examples": {
                "0": {
                  "summary": "申请",
                  "value": {
                    "amount_cents": 5000,
                    "comment": "Please contact me to confirm payment details."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/profile": {
      "put": {
        "operationId": "profile",
        "tags": [
          "profile"
        ],
        "summary": "登录名前缀",
        "description": "前缀是端口登录名的开头，例如品牌名称。登录名格式为 prefix_random：当 prefix=astra 时，新端口会获得类似 astra_a1b2c3d4e5f 的登录名。每个端口的随机后缀独立生成。\n\n修改前缀不会改变现有登录名。新端口以及通过 change_login=true 更改登录名时使用当前前缀。前缀必须唯一；已被占用时返回 409 partner_prefix_taken。",
        "responses": {
          "200": {
            "description": "响应示例",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "prefix": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                },
                "examples": {
                  "0": {
                    "summary": "前缀",
                    "value": {
                      "success": true,
                      "data": {
                        "prefix": "astra"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "秒"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prefix": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 24,
                    "pattern": "^[a-z][a-z0-9-]{1,23}$",
                    "description": "2–24 个字符：拉丁字母、数字和连字符，必须以字母开头。统一转换为小写。proxy 和 gigabit 为保留名称。"
                  }
                },
                "additionalProperties": false,
                "required": [
                  "prefix"
                ]
              },
              "examples": {
                "0": {
                  "summary": "前缀",
                  "value": {
                    "prefix": "astra"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/orders/{id}/wireguard": {
      "get": {
        "operationId": "wireguard-get",
        "tags": [
          "access"
        ],
        "summary": "获取 WireGuard 配置",
        "description": "返回现有配置和二维码，暂停时也可获取。不会创建配置或启用访问。配置不存在或已删除时返回 wireguard_not_created（404）。\n\n租用到期后，WireGuard 会暂停，配置在 24 小时端口保留期（due）内保留。续租会恢复相同配置，但手动暂停的访问除外。只有 enabled=true 才会解除手动暂停。取消租用并释放端口后，旧配置会被删除。手动暂停 WireGuard 不影响 HTTP(S) 或 SOCKS5。",
        "responses": {
          "200": {
            "description": "响应示例",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "nullable": true,
                      "required": [
                        "state",
                        "enabled",
                        "pause_reason",
                        "config",
                        "revision",
                        "filename",
                        "qr_data_url"
                      ],
                      "properties": {
                        "state": {
                          "type": "string",
                          "enum": [
                            "active",
                            "paused"
                          ]
                        },
                        "enabled": {
                          "type": "boolean"
                        },
                        "pause_reason": {
                          "type": "string",
                          "nullable": true
                        },
                        "config": {
                          "type": "string",
                          "nullable": true
                        },
                        "revision": {
                          "type": "string",
                          "nullable": true
                        },
                        "filename": {
                          "type": "string",
                          "nullable": true
                        },
                        "qr_data_url": {
                          "type": "string",
                          "nullable": true
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                },
                "examples": {
                  "0": {
                    "summary": "获取 WireGuard 配置",
                    "value": {
                      "success": true,
                      "data": {
                        "state": "active",
                        "enabled": true,
                        "pause_reason": null,
                        "config": "[Interface]\nPrivateKey = EXAMPLE_PRIVATE_KEY\nAddress = 10.77.0.2/32\nDNS = 1.1.1.1\n\n[Peer]\nPublicKey = EXAMPLE_SERVER_KEY\nPresharedKey = EXAMPLE_PRESHARED_KEY\nEndpoint = vpn.example.com:51820\nAllowedIPs = 0.0.0.0/0, ::/0\nPersistentKeepalive = 25\n",
                        "revision": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "filename": "gigabit-wireguard-10001.conf",
                        "qr_data_url": "data:image/png;base64,EXAMPLE_PNG_BASE64"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "秒"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "订单 ID 或公开的 port_id。"
            }
          }
        ]
      },
      "post": {
        "operationId": "wireguard-create",
        "tags": [
          "access"
        ],
        "summary": "创建 WireGuard 配置",
        "description": "为有效租用创建配置，或保留已有配置。重复请求不会更改密钥或解除手动暂停。等待 ready 后，使用 GET 获取配置。明确删除后再次创建，会生成新配置。\n\n租用到期后，WireGuard 会暂停，配置在 24 小时端口保留期（due）内保留。续租会恢复相同配置，但手动暂停的访问除外。只有 enabled=true 才会解除手动暂停。取消租用并释放端口后，旧配置会被删除。手动暂停 WireGuard 不影响 HTTP(S) 或 SOCKS5。",
        "responses": {
          "202": {
            "description": "响应示例",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string"
                        },
                        "error": {
                          "type": "string",
                          "nullable": true
                        },
                        "result": {
                          "type": "object",
                          "nullable": true
                        },
                        "created_at": {
                          "type": "string"
                        },
                        "status_url": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                },
                "examples": {
                  "0": {
                    "summary": "创建 WireGuard 配置",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "op_0123456789abcdef0123456789abcdef",
                        "state": "queued",
                        "error": null,
                        "result": null,
                        "created_at": "2026-11-10T12:00:00+00:00",
                        "status_url": "/api/partner/v1/operations/op_0123456789abcdef0123456789abcdef"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "秒"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "订单 ID 或公开的 port_id。"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              },
              "examples": {
                "0": {
                  "summary": "创建 WireGuard 配置",
                  "value": {}
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "wireguard-state",
        "tags": [
          "access"
        ],
        "summary": "暂停或恢复",
        "description": "enabled=false 仅暂停 WireGuard 并保留密钥。enabled=true 恢复访问，需要有效且已付款的租用。ready 表示服务器已应用更改。\n\n租用到期后，WireGuard 会暂停，配置在 24 小时端口保留期（due）内保留。续租会恢复相同配置，但手动暂停的访问除外。只有 enabled=true 才会解除手动暂停。取消租用并释放端口后，旧配置会被删除。手动暂停 WireGuard 不影响 HTTP(S) 或 SOCKS5。",
        "responses": {
          "202": {
            "description": "响应示例",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "state": {
                              "type": "string"
                            },
                            "error": {
                              "type": "string",
                              "nullable": true
                            },
                            "result": {
                              "type": "object",
                              "nullable": true
                            },
                            "created_at": {
                              "type": "string"
                            },
                            "status_url": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": [
                        "success",
                        "data"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "state": {
                              "type": "string"
                            },
                            "error": {
                              "type": "string",
                              "nullable": true
                            },
                            "result": {
                              "type": "object",
                              "nullable": true
                            },
                            "created_at": {
                              "type": "string"
                            },
                            "status_url": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": [
                        "success",
                        "data"
                      ]
                    }
                  ]
                },
                "examples": {
                  "0": {
                    "summary": "暂停或恢复",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "op_0123456789abcdef0123456789abcdef",
                        "state": "queued",
                        "error": null,
                        "result": null,
                        "created_at": "2026-11-10T12:00:00+00:00",
                        "status_url": "/api/partner/v1/operations/op_0123456789abcdef0123456789abcdef"
                      }
                    }
                  },
                  "1": {
                    "summary": "恢复",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "op_0123456789abcdef0123456789abcdef",
                        "state": "queued",
                        "error": null,
                        "result": null,
                        "created_at": "2026-11-10T12:00:00+00:00",
                        "status_url": "/api/partner/v1/operations/op_0123456789abcdef0123456789abcdef"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "秒"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "订单 ID 或公开的 port_id。"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean",
                    "description": "false 暂停；true 恢复。"
                  }
                },
                "additionalProperties": false,
                "required": [
                  "enabled"
                ]
              },
              "examples": {
                "0": {
                  "summary": "暂停或恢复",
                  "value": {
                    "enabled": false
                  }
                },
                "1": {
                  "summary": "恢复",
                  "value": {
                    "enabled": true
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "wireguard-delete",
        "tags": [
          "access"
        ],
        "summary": "删除 WireGuard 配置",
        "description": "撤销访问并删除 WireGuard 配置，旧配置随即失效。端口及其 HTTP(S)/SOCKS5 服务保留。重复删除是安全的；续租不会重建已删除的配置。\n\n租用到期后，WireGuard 会暂停，配置在 24 小时端口保留期（due）内保留。续租会恢复相同配置，但手动暂停的访问除外。只有 enabled=true 才会解除手动暂停。取消租用并释放端口后，旧配置会被删除。手动暂停 WireGuard 不影响 HTTP(S) 或 SOCKS5。",
        "responses": {
          "202": {
            "description": "响应示例",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string"
                        },
                        "error": {
                          "type": "string",
                          "nullable": true
                        },
                        "result": {
                          "type": "object",
                          "nullable": true
                        },
                        "created_at": {
                          "type": "string"
                        },
                        "status_url": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                },
                "examples": {
                  "0": {
                    "summary": "删除 WireGuard 配置",
                    "value": {
                      "success": true,
                      "data": {
                        "id": "op_0123456789abcdef0123456789abcdef",
                        "state": "queued",
                        "error": null,
                        "result": null,
                        "created_at": "2026-11-10T12:00:00+00:00",
                        "status_url": "/api/partner/v1/operations/op_0123456789abcdef0123456789abcdef"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "秒"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "订单 ID 或公开的 port_id。"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              },
              "examples": {
                "0": {
                  "summary": "删除 WireGuard 配置",
                  "value": {}
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "PartnerToken": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "gbp_…"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "success",
          "error"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "error": {
            "type": "string"
          },
          "retry_after": {
            "type": "integer"
          }
        }
      }
    }
  }
}
