{
  "openapi": "3.1.0",
  "info": {
    "title": "Node4 API",
    "version": "1.0.0",
    "description": "Programmatic access to your Node4 account: proxies, usage, purchasing, rotating and residential gateways, sub-users, billing, alert settings, the IP whitelist and webhooks.\n\nAuthenticate with an API key created in the dashboard under Settings. Send it as `Authorization: Bearer <key>` or `X-API-Key: <key>`. Keys begin `n4k_`. Keep keys on your server: the API does not send CORS headers, so it is not callable from a web page.\n\nEvery key carries an explicit permission list, and every endpoint states the permission it needs.\n\nRate limit: 60 requests per minute per key. Every authenticated response carries `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset` (seconds until the window resets) and `RateLimit-Policy`, plus the older `X-RateLimit-*` headers (`X-RateLimit-Reset` is a Unix timestamp). A 429 carries `Retry-After` in seconds.\n\nPurchasing: `POST /orders` and `POST /topups` require an `Idempotency-Key` header. A key is kept for 24 hours: repeating the same request with the same key returns the original response (with `Idempotent-Replayed: true`) and never charges twice; the same key with a different body returns 422; a request still being processed under that key returns 409 `idempotency_in_flight`, so wait and retry with the same key.\n\nSuccessful responses use the envelope `{ \"success\": true, \"data\": ... }`; errors are `{ \"error\": \"...\" }`, with a machine-readable `code` on purchasing endpoints.",
    "contact": {
      "name": "Node4 support",
      "url": "https://node4.io/support",
      "email": "hello@node4.io"
    }
  },
  "servers": [
    {
      "url": "https://node4.io/api/v1",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    },
    {
      "apiKeyHeader": []
    }
  ],
  "tags": [
    {
      "name": "Proxies",
      "description": "List, export, health-check, refresh and replace the proxies on your account."
    },
    {
      "name": "Usage",
      "description": "Bandwidth and request history: totals, per proxy, hourly and daily."
    },
    {
      "name": "Account",
      "description": "Status, subscription, profile, order history, notifications, auto top-up and usage alert settings."
    },
    {
      "name": "Geo",
      "description": "Location coverage: the countries, states and cities exits are available in."
    },
    {
      "name": "IP whitelist",
      "description": "Addresses allowed to use IP-authenticated proxies."
    },
    {
      "name": "Credentials",
      "description": "Proxy credentials (sub-accounts): named username/password logins with their own connection guideline and their own bandwidth cap, enforced per UTC calendar month. Made for agencies delegating access per client or project. Reselling access needs written authorization from Node4."
    },
    {
      "name": "Webhooks",
      "description": "Register HTTPS endpoints that receive signed event deliveries. The events and their payloads are listed under `webhooks` in this document."
    },
    {
      "name": "Support (restricted)",
      "description": "Ticket administration. Unlike every other endpoint here, these are NOT self-scoped: they require admin permissions and operate across accounts. An ordinary customer key cannot call them."
    },
    {
      "name": "Purchasing",
      "description": "The plan catalog, buying plans and add-ons with a saved card or Bitcoin, and order status."
    },
    {
      "name": "Gateways",
      "description": "Rotating and residential gateways: endpoints, ready-to-use proxy strings and live connection counts."
    },
    {
      "name": "Sub-users",
      "description": "Separate logins per client or project, each with its own monthly bandwidth cap and usage."
    },
    {
      "name": "Billing",
      "description": "Account credit, invoices and invoice PDFs."
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Authorization: Bearer n4k_..."
      },
      "apiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    }
  },
  "paths": {
    "/proxies": {
      "get": {
        "operationId": "listProxies",
        "tags": [
          "Proxies"
        ],
        "summary": "List every proxy on the account",
        "description": "Requires the `read:proxies` permission on the API key. Includes suspended and expired proxies, so `total` and `active` can differ. An integration that only saw active rows could not tell why capacity had dropped. Each row carries `ports` (HTTP and SOCKS5, same host and credential) and `protocols`.",
        "parameters": [
          {
            "name": "includePasswords",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": true
            },
            "description": "`false` leaves passwords out of the response: the `password` field in JSON, the password column in txt and csv. Use it when the list is stored, logged or displayed. Anything other than true, false, 1 or 0 is a 400. The API key is still secret material: it can read the passwords back at any time, so keep it out of client-side code and logs either way."
          }
        ],
        "responses": {
          "200": {
            "description": "The account's proxies.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer"
                        },
                        "active": {
                          "type": "integer"
                        },
                        "proxies": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "integer"
                              },
                              "type": {
                                "type": "string",
                                "description": "free, shared, premium_datacenter, residential, rotating_shared or rotating_unmetered."
                              },
                              "protocol": {
                                "type": "string",
                                "enum": [
                                  "http",
                                  "socks5"
                                ],
                                "description": "Protocol of the stored endpoint (`port`). Unchanged for compatibility; `ports` and `protocols` give every listener."
                              },
                              "host": {
                                "type": "string"
                              },
                              "port": {
                                "type": "integer",
                                "description": "Port of the stored endpoint, for `protocol`. For a static proxy this is the HTTP port, 4443."
                              },
                              "ports": {
                                "type": "object",
                                "description": "Every port this proxy answers on, with the same host and credential. Static proxies (shared and dedicated datacenter) use 4443 for HTTP(S) and 1443 for SOCKS5; gateway products use their gateway's ports. `socks5` is null when the product has no SOCKS5 listener: the free tier is HTTP(S) only.",
                                "properties": {
                                  "http": {
                                    "type": "integer"
                                  },
                                  "socks5": {
                                    "type": "integer",
                                    "nullable": true
                                  }
                                },
                                "required": [
                                  "http",
                                  "socks5"
                                ]
                              },
                              "protocols": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "enum": [
                                    "http",
                                    "socks5"
                                  ]
                                },
                                "description": "Either [\"http\"] or [\"http\", \"socks5\"], matching `ports`."
                              },
                              "username": {
                                "type": "string",
                                "description": "Empty for free-tier proxies, which use the account credential."
                              },
                              "password": {
                                "type": "string",
                                "description": "Omitted when the request sets `includePasswords=false`."
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "active",
                                  "suspended",
                                  "expired"
                                ]
                              },
                              "country": {
                                "type": "string",
                                "nullable": true
                              },
                              "city": {
                                "type": "string",
                                "nullable": true
                              },
                              "expiresAt": {
                                "type": "string",
                                "format": "date-time",
                                "nullable": true
                              },
                              "createdAt": {
                                "type": "string",
                                "format": "date-time"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/proxies/list": {
      "get": {
        "operationId": "exportProxies",
        "tags": [
          "Proxies"
        ],
        "summary": "Active proxies in a compact form",
        "description": "Requires the `read:proxies` permission on the API key. Active proxies only. Intended for feeding automation directly. The default `txt` output (no `fields`, no `separator`) is stable byte-for-byte: `host:port:username:password`, one per line.",
        "parameters": [
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "txt",
                "text",
                "csv"
              ],
              "default": "json"
            },
            "description": "`txt` returns `text/plain`, one proxy per line (default `host:port:username:password`). `csv` returns `text/csv` with a header row."
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated column list and order for `txt` and `csv`, from: host, port, username, password, protocol, type, country, socks5_port. Tools disagree about `host:port:user:pass` ordering; set it explicitly rather than reordering by hand. Unknown fields are a 400. `socks5_port` is empty for a proxy with no SOCKS5 listener (the free tier). Defaults: `host,port,username,password` for txt, `host,port,username,password,protocol,type,country` for csv. With `includePasswords=false` the defaults drop `password`, and naming `password` is a 400."
          },
          {
            "name": "separator",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                ":",
                ",",
                ";",
                "|",
                " ",
                "\t"
              ],
              "default": ":"
            },
            "description": "Delimiter between txt columns (URL-encode it, e.g. `%7C` for `|`). txt only — csv is comma-separated by definition. Anything outside the enum is a 400."
          },
          {
            "name": "includePasswords",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": true
            },
            "description": "`false` leaves passwords out of the response: the `password` field in JSON, the password column in txt and csv. Use it when the list is stored, logged or displayed. Anything other than true, false, 1 or 0 is a 400. The API key is still secret material: it can read the passwords back at any time, so keep it out of client-side code and logs either way."
          }
        ],
        "responses": {
          "200": {
            "description": "Active proxies, as JSON, plain text or CSV depending on `format`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "host": {
                            "type": "string"
                          },
                          "port": {
                            "type": "integer"
                          },
                          "username": {
                            "type": "string"
                          },
                          "password": {
                            "type": "string",
                            "description": "Omitted when `includePasswords=false`."
                          },
                          "protocol": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "country": {
                            "type": "string",
                            "nullable": true
                          },
                          "ports": {
                            "type": "object",
                            "description": "Every port this proxy answers on, with the same host and credential. Static proxies (shared and dedicated datacenter) use 4443 for HTTP(S) and 1443 for SOCKS5; gateway products use their gateway's ports. `socks5` is null when the product has no SOCKS5 listener: the free tier is HTTP(S) only.",
                            "properties": {
                              "http": {
                                "type": "integer"
                              },
                              "socks5": {
                                "type": "integer",
                                "nullable": true
                              }
                            },
                            "required": [
                              "http",
                              "socks5"
                            ]
                          },
                          "protocols": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "http",
                                "socks5"
                              ]
                            },
                            "description": "Either [\"http\"] or [\"http\", \"socks5\"], matching `ports`."
                          }
                        }
                      }
                    }
                  }
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string",
                  "example": "46.173.64.10:4443:user:pass"
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string",
                  "example": "host,port,username,password,protocol,type,country\n46.173.64.10,4443,user,pass,http,shared,US"
                }
              }
            }
          },
          "400": {
            "description": "Unknown field name, a separator outside the allowed set, an option applied to a format it cannot affect, an invalid `includePasswords`, or `password` named in `fields` with `includePasswords=false`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/proxies/health": {
      "get": {
        "operationId": "getProxyHealth",
        "tags": [
          "Proxies"
        ],
        "summary": "Health of every active proxy on the account",
        "description": "Requires the `read:proxies` permission on the API key. The same per-proxy health the dashboard shows: whether each endpoint's underlying address is passing health checks, and whether an automatic replacement is pending. No credentials are returned.",
        "responses": {
          "200": {
            "description": "Per-proxy health rows.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer"
                        },
                        "healthy": {
                          "type": "integer"
                        },
                        "proxies": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "proxyId": {
                                "type": "integer"
                              },
                              "host": {
                                "type": "string"
                              },
                              "port": {
                                "type": "integer"
                              },
                              "protocol": {
                                "type": "string"
                              },
                              "proxyType": {
                                "type": "string"
                              },
                              "country": {
                                "type": "string",
                                "nullable": true
                              },
                              "city": {
                                "type": "string",
                                "nullable": true
                              },
                              "isHealthy": {
                                "type": "boolean"
                              },
                              "lastHealthCheck": {
                                "type": "string",
                                "format": "date-time",
                                "nullable": true
                              },
                              "replacementPending": {
                                "type": "boolean"
                              },
                              "retryInfo": {
                                "type": "object",
                                "nullable": true
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/status": {
      "get": {
        "operationId": "getStatus",
        "tags": [
          "Account"
        ],
        "summary": "Preflight: can this account make proxy requests right now?",
        "description": "Requires the `read:proxies` permission on the API key. Answers, for the key's account, whether proxy requests will currently be served — and if not, exactly why, using the same checks, ordering and reason tokens as the live proxy auth path (`plan_bandwidth_exceeded`, `no_active_proxies`, `user_inactive`). Call it before opening a ticket titled \"why isn't my proxy working\". Per-request denials (a wrong password, an unwhitelisted source IP, an expired individual credential) cannot be predicted account-wide and are not covered. A suspended or closed account is refused at authentication (403) before reaching this endpoint.",
        "responses": {
          "200": {
            "description": "The account's proxy-serving status.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "ok": {
                          "type": "boolean"
                        },
                        "reason": {
                          "type": "string",
                          "enum": [
                            "ok",
                            "plan_bandwidth_exceeded",
                            "no_active_proxies",
                            "user_inactive"
                          ]
                        },
                        "message": {
                          "type": "string",
                          "description": "One human-readable sentence."
                        },
                        "subscription": {
                          "type": "object",
                          "properties": {
                            "active": {
                              "type": "boolean",
                              "description": "False = served on the free tier's allowance."
                            },
                            "status": {
                              "type": "string",
                              "nullable": true
                            }
                          }
                        },
                        "bandwidth": {
                          "type": "object",
                          "properties": {
                            "limited": {
                              "type": "boolean"
                            },
                            "usedMb": {
                              "type": "number",
                              "nullable": true
                            },
                            "limitMb": {
                              "type": "number",
                              "nullable": true,
                              "description": "Includes purchased top-ups."
                            },
                            "remainingMb": {
                              "type": "number",
                              "nullable": true
                            }
                          }
                        },
                        "proxies": {
                          "type": "object",
                          "properties": {
                            "active": {
                              "type": "integer"
                            }
                          }
                        }
                      },
                      "required": [
                        "ok",
                        "reason",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/proxies/refresh": {
      "post": {
        "operationId": "refreshProxies",
        "tags": [
          "Proxies"
        ],
        "summary": "Replace a proxy's IP address",
        "description": "Requires the `write:proxies` permission on the API key. Swaps the exit IP for a fresh one from the pool. Subject to a per-period refresh allowance, returned in the response.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "proxyId": {
                    "type": "integer"
                  }
                },
                "required": [
                  "proxyId"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The proxy's new address and credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "proxyId": {
                          "type": "integer"
                        },
                        "oldIp": {
                          "type": "string"
                        },
                        "newIp": {
                          "type": "string"
                        },
                        "newPort": {
                          "type": "integer"
                        },
                        "newUsername": {
                          "type": "string"
                        },
                        "newPassword": {
                          "type": "string"
                        },
                        "refreshesUsed": {
                          "type": "integer"
                        },
                        "refreshLimit": {
                          "type": "integer"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed proxyId.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "No such proxy on this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "No replacement address available in the pool right now.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/usage": {
      "get": {
        "operationId": "getUsage",
        "tags": [
          "Usage"
        ],
        "summary": "Bandwidth totals and recent request logs",
        "description": "Requires the `read:usage` permission on the API key. Upload, download and request totals for the current calendar month and for the life of the account, plus the most recent usage log entries (`limit`, default 50, at most 200).",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            },
            "description": "Number of recent log entries. Clamped to 200."
          }
        ],
        "responses": {
          "200": {
            "description": "Monthly and all-time bandwidth, plus recent logs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "bandwidth": {
                          "type": "object",
                          "description": "Current calendar month."
                        },
                        "allTimeBandwidth": {
                          "type": "object",
                          "description": "Despite the name, the last retentionDays days (usage logs are pruned after that); period is \"retention_window\"."
                        },
                        "recentLogs": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "integer"
                              },
                              "proxyId": {
                                "type": "integer",
                                "description": "0 when no single proxy carried it (see accountLogin)."
                              },
                              "requestCount": {
                                "type": "integer"
                              },
                              "bandwidthUpBytes": {
                                "type": "integer"
                              },
                              "bandwidthDownBytes": {
                                "type": "integer"
                              },
                              "periodStart": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "periodEnd": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "createdAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "accountLogin": {
                                "type": "boolean",
                                "description": "True when `proxyId` 0: traffic sent with your account username and password (or from a whitelisted IP), not one proxy's. The same flag as GET /usage/by-proxy."
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/usage/bandwidth": {
      "get": {
        "operationId": "getBandwidthUsage",
        "tags": [
          "Usage"
        ],
        "summary": "Bandwidth time series",
        "description": "Requires the `read:usage` permission on the API key. Hourly bandwidth and request counts over the last `days` days (default 7, at most 90).",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 90,
              "default": 7
            },
            "description": "Length of the window, in days. Clamped to 90."
          }
        ],
        "responses": {
          "200": {
            "description": "Hourly snapshots over the window.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "period": {
                          "type": "object"
                        },
                        "snapshots": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/usage/analytics": {
      "get": {
        "operationId": "getUsageAnalytics",
        "tags": [
          "Usage"
        ],
        "summary": "Monthly usage totals",
        "description": "Requires the `read:usage` permission on the API key. Upload, download and request totals per calendar month for the last `months` months (default 6, at most 12), oldest first.",
        "parameters": [
          {
            "name": "months",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 6
            },
            "description": "How many months back to include."
          }
        ],
        "responses": {
          "200": {
            "description": "Per-month totals.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "monthly": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/usage/by-proxy": {
      "get": {
        "operationId": "getUsageByProxy",
        "tags": [
          "Usage"
        ],
        "summary": "Lifetime usage broken down per proxy",
        "description": "Requires the `read:usage` permission on the API key. One row per proxy that has carried traffic, identified by host and port. A row with `proxyId` 0 and a null host is traffic sent with your account username and password or from a whitelisted IP, which no single proxy carries; it is included so the rows sum to the account's total. That row has `accountLogin` true; every other row has it false.",
        "responses": {
          "200": {
            "description": "Per-proxy totals.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer"
                        },
                        "proxies": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "proxyId": {
                                "type": "integer"
                              },
                              "host": {
                                "type": "string",
                                "nullable": true
                              },
                              "port": {
                                "type": "integer",
                                "nullable": true
                              },
                              "type": {
                                "type": "string",
                                "nullable": true
                              },
                              "status": {
                                "type": "string",
                                "nullable": true
                              },
                              "uploadBytes": {
                                "type": "integer"
                              },
                              "downloadBytes": {
                                "type": "integer"
                              },
                              "totalBytes": {
                                "type": "integer"
                              },
                              "requests": {
                                "type": "integer"
                              },
                              "accountLogin": {
                                "type": "boolean",
                                "description": "True on the row of traffic sent with your account username and password (or a whitelisted IP), not one proxy's."
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/usage/hourly": {
      "get": {
        "operationId": "getHourlyUsage",
        "tags": [
          "Usage"
        ],
        "summary": "Hourly bandwidth series",
        "description": "Requires the `read:usage` permission on the API key. One entry per hour that carried traffic; an absent hour means zero.",
        "parameters": [
          {
            "name": "hours",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 168,
              "default": 24
            },
            "description": "Length of the window in hours. Clamped to 168 (7 days)."
          }
        ],
        "responses": {
          "200": {
            "description": "The hourly series.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "period": {
                          "type": "object"
                        },
                        "series": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "hour": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "bandwidthBytes": {
                                "type": "integer"
                              },
                              "requests": {
                                "type": "integer"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/usage/daily": {
      "get": {
        "operationId": "getDailyUsage",
        "tags": [
          "Usage"
        ],
        "summary": "Daily bandwidth series",
        "description": "Requires the `read:usage` permission on the API key. One entry per UTC day that carried traffic; an absent day means zero.",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 90,
              "default": 30
            },
            "description": "Length of the window in days. Clamped to 90."
          }
        ],
        "responses": {
          "200": {
            "description": "The daily series.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "period": {
                          "type": "object"
                        },
                        "series": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "day": {
                                "type": "string",
                                "example": "2026-09-01"
                              },
                              "bandwidthBytes": {
                                "type": "integer"
                              },
                              "requests": {
                                "type": "integer"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/geo/countries": {
      "get": {
        "operationId": "listCountries",
        "tags": [
          "Geo"
        ],
        "summary": "Countries with residential coverage",
        "description": "Requires the `read:proxies` permission on the API key. The coverage data behind the residential targeting picker. Advisory supplier data: it drives location choices, it does not grant access. Targeting itself is set in the proxy username string, not through this API.",
        "responses": {
          "200": {
            "description": "Countries, alphabetical.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "countries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "code": {
                                "type": "string",
                                "description": "ISO 3166-1 alpha-2, lowercase."
                              },
                              "name": {
                                "type": "string"
                              },
                              "cityCount": {
                                "type": "integer"
                              },
                              "availableIps": {
                                "type": "integer",
                                "description": "0 for country-only coverage means unknown, not zero."
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/geo/countries/{country}/states": {
      "get": {
        "operationId": "listStates",
        "tags": [
          "Geo"
        ],
        "summary": "States/regions with coverage in a country",
        "description": "Requires the `read:proxies` permission on the API key. Empty for countries with country-only coverage.",
        "parameters": [
          {
            "name": "country",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 2
            },
            "description": "ISO 3166-1 alpha-2."
          }
        ],
        "responses": {
          "200": {
            "description": "States, alphabetical.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": "string"
                        },
                        "states": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Not a two-letter country code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/geo/countries/{country}/cities": {
      "get": {
        "operationId": "listCities",
        "tags": [
          "Geo"
        ],
        "summary": "Cities with coverage in a country",
        "description": "Requires the `read:proxies` permission on the API key. Ordered by pool size, so the most usable exits come first.",
        "parameters": [
          {
            "name": "country",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 2
            },
            "description": "ISO 3166-1 alpha-2."
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 16
            },
            "description": "Narrow to one state/region code."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cities, largest pool first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string",
                          "nullable": true
                        },
                        "cities": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Not a two-letter country code, or a malformed state.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/auto-topup": {
      "get": {
        "operationId": "getAutoTopup",
        "tags": [
          "Account"
        ],
        "summary": "Auto top-up settings (read only)",
        "description": "Requires the `read:subscription` permission on the API key. The account's automatic bandwidth top-up configuration and whether it can currently work (an eligible metered plan, and a usable saved card). Read only by design: enabling auto top-up arms unattended charges, so configuration is done in the dashboard, and no card identifiers are returned here.",
        "responses": {
          "200": {
            "description": "Auto top-up state.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "enabled": {
                          "type": "boolean"
                        },
                        "thresholdPercent": {
                          "type": "integer"
                        },
                        "addonId": {
                          "type": "string",
                          "nullable": true
                        },
                        "maxChargesPerPeriod": {
                          "type": "integer"
                        },
                        "consecutiveFailures": {
                          "type": "integer"
                        },
                        "disabledReason": {
                          "type": "string",
                          "nullable": true
                        },
                        "lastSucceededAt": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true
                        },
                        "planEligible": {
                          "type": "boolean"
                        },
                        "planIneligibleMessage": {
                          "type": "string",
                          "nullable": true
                        },
                        "hasUsableCard": {
                          "type": "boolean"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateAutoTopup",
        "tags": [
          "Account"
        ],
        "summary": "Change auto top-up settings",
        "description": "Requires the `write:subscription` permission on the API key. Switches automatic bandwidth top-up on or off and sets its threshold, pack and per-period charge cap, with the same rules as the dashboard: switching off always works; switching on needs an eligible metered plan and a usable saved card. Out-of-range thresholdPercent and maxChargesPerPeriod are clamped to the bounds the dashboard shows; the response carries the stored values. Switching on sets the card to the account's default saved card (replacing any card picked in the dashboard), and that card must be usable; cards cannot be chosen or read over the API.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "enabled"
                ],
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "thresholdPercent": {
                    "type": "integer",
                    "description": "Top up when this % of the allowance is used."
                  },
                  "addonId": {
                    "type": "string",
                    "maxLength": 32,
                    "description": "Top-up pack id offered for the account's plan."
                  },
                  "maxChargesPerPeriod": {
                    "type": "integer",
                    "description": "At most this many automatic charges per billing period."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored auto top-up settings.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "enabled": {
                          "type": "boolean"
                        },
                        "thresholdPercent": {
                          "type": "integer"
                        },
                        "addonId": {
                          "type": "string",
                          "nullable": true
                        },
                        "maxChargesPerPeriod": {
                          "type": "integer"
                        },
                        "consecutiveFailures": {
                          "type": "integer"
                        },
                        "disabledReason": {
                          "type": "string",
                          "nullable": true
                        },
                        "lastSucceededAt": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed body, an unknown field, or a pack this plan does not offer.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Cannot switch on: no eligible metered plan, or no usable default saved card.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/subscription": {
      "get": {
        "operationId": "getSubscription",
        "tags": [
          "Account"
        ],
        "summary": "Current plan and subscription state",
        "description": "Requires the `read:subscription` permission on the API key. `subscription` is the subscription that governs the account (the paid plan, not a trial running beside it): plan name and type, status, bandwidth limit, the current period and the billing term. `active` is false and `subscription` null when there is none. `subscriptions` lists every subscription that currently entitles the account, admin-granted trials and the free plan included, newest live first: `governing` marks the one `subscription` describes, and `isTrial` and `trialEndsAt` identify a trial. No price or payment data is returned.",
        "responses": {
          "200": {
            "description": "The account's subscriptions.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "active": {
                          "type": "boolean"
                        },
                        "subscription": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "integer"
                            },
                            "planName": {
                              "type": "string"
                            },
                            "planType": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "canceled"
                              ]
                            },
                            "bandwidthLimitBytes": {
                              "type": "integer",
                              "nullable": true,
                              "description": "null means no bandwidth limit."
                            },
                            "bandwidthLimitFormatted": {
                              "type": "string"
                            },
                            "currentPeriodStart": {
                              "type": "string",
                              "format": "date-time",
                              "nullable": true
                            },
                            "currentPeriodEnd": {
                              "type": "string",
                              "format": "date-time",
                              "nullable": true
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "billingTerm": {
                              "type": "string",
                              "enum": [
                                "monthly",
                                "quarterly",
                                "yearly"
                              ],
                              "readOnly": true,
                              "description": "How often this subscription is billed: `monthly`, `quarterly` (every 3 months) or `yearly`. Read-only."
                            }
                          },
                          "nullable": true
                        },
                        "subscriptions": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "integer"
                              },
                              "planName": {
                                "type": "string"
                              },
                              "planType": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "active",
                                  "canceled"
                                ],
                                "description": "A `canceled` row still entitles until `currentPeriodEnd`."
                              },
                              "bandwidthLimitBytes": {
                                "type": "integer",
                                "nullable": true,
                                "description": "null means no bandwidth limit."
                              },
                              "currentPeriodStart": {
                                "type": "string",
                                "format": "date-time",
                                "nullable": true
                              },
                              "currentPeriodEnd": {
                                "type": "string",
                                "format": "date-time",
                                "nullable": true
                              },
                              "createdAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "isTrial": {
                                "type": "boolean",
                                "description": "An admin-granted free trial."
                              },
                              "trialEndsAt": {
                                "type": "string",
                                "format": "date-time",
                                "nullable": true,
                                "description": "When the trial ends; null when `isTrial` is false."
                              },
                              "governing": {
                                "type": "boolean",
                                "description": "True for exactly the subscription `data.subscription` describes."
                              },
                              "billingTerm": {
                                "type": "string",
                                "enum": [
                                  "monthly",
                                  "quarterly",
                                  "yearly"
                                ],
                                "readOnly": true,
                                "description": "How often this subscription is billed: `monthly`, `quarterly` (every 3 months) or `yearly`. Read-only."
                              }
                            },
                            "required": [
                              "id",
                              "planName",
                              "planType",
                              "status",
                              "bandwidthLimitBytes",
                              "currentPeriodStart",
                              "currentPeriodEnd",
                              "createdAt",
                              "isTrial",
                              "trialEndsAt",
                              "governing",
                              "billingTerm"
                            ]
                          }
                        }
                      },
                      "required": [
                        "active",
                        "subscription",
                        "subscriptions"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/profile": {
      "get": {
        "operationId": "getProfile",
        "tags": [
          "Account"
        ],
        "summary": "The account this key belongs to",
        "description": "Requires the `read:profile` permission on the API key. Id, name, email, role and creation time of the account that owns the key.",
        "responses": {
          "200": {
            "description": "Account profile.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "name": {
                          "type": "string",
                          "nullable": true
                        },
                        "email": {
                          "type": "string",
                          "format": "email"
                        },
                        "role": {
                          "type": "string"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "The account no longer exists.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/orders": {
      "get": {
        "operationId": "listOrders",
        "tags": [
          "Account"
        ],
        "summary": "Order history",
        "description": "Requires the `read:orders` permission on the API key. Orders on the account, newest first: type, status, amount in cents, currency, description and `provisioning`, the delivery state (`awaiting_payment`, `payment_unconfirmed` or `under_review` for a card charge still being confirmed or held for review: do not pay again, `in_progress`, `delivered`, `not_delivered`, `revoked`). Page with `limit` (default 20, at most 100) and `offset`. GET /orders/{id} returns one order in full.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "description": "Orders per page. Clamped to 100."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Orders, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "orders": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "provisioning": {
                                "type": "string",
                                "enum": [
                                  "awaiting_payment",
                                  "payment_unconfirmed",
                                  "under_review",
                                  "in_progress",
                                  "delivered",
                                  "not_delivered",
                                  "revoked",
                                  "unknown"
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createOrder",
        "tags": [
          "Purchasing"
        ],
        "summary": "Buy a plan",
        "description": "Requires the `write:orders` permission on the API key. `card` charges the default saved card on the account, through the same checkout and fraud checks as the dashboard; it charges the full price and does not spend store credit. `bitcoin` creates a BTCPay invoice and returns its `checkoutUrl`; available store credit is applied to it automatically. Buying never changes or cancels an existing subscription.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required. 1-255 visible ASCII characters (a UUID is ideal), unique per purchase. Retrying with the same key and the same body within 24 hours returns the original response (header `Idempotent-Replayed: true`) and never charges again. The same key with a different body returns 422; a request still being processed returns 409 `idempotency_in_flight`. A key frees up 24 hours after its request FINISHED. A key whose original request never recorded an outcome is never freed: it answers 409 `outcome_unknown` for good (check GET /orders, do not retry with a new key). Keys are scoped to your account.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "planId",
                  "paymentMethod"
                ],
                "properties": {
                  "planId": {
                    "type": "integer",
                    "description": "From GET /plans."
                  },
                  "paymentMethod": {
                    "type": "string",
                    "enum": [
                      "card",
                      "bitcoin"
                    ]
                  },
                  "discountCode": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "country": {
                    "type": "string",
                    "enum": [
                      "US",
                      "IT",
                      "ES",
                      "IT_ES"
                    ],
                    "description": "Plans with `countrySelectable` only (Premium Datacenter and Shared), one of that plan's `countries` codes. IT_ES is Shared only. Omit for the default (any country for Premium, United States for Shared)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Order placed. Card: the charge went through and the order is `completed` (provisioning `delivered`, or `in_progress` when setup needs a manual step on our side). A card charge that is declined, held for review or of unknown outcome never returns 201: see 402 (`card_declined`, `payment_held`), 409 (`payment_unconfirmed`) and 500. Bitcoin: `pending` (provisioning `awaiting_payment`) until the invoice at `checkoutUrl` is paid, or `completed` when store credit covered it; poll GET /orders/{id}. A request that repeats a recent purchase is answered 409 `duplicate_recent_purchase`, not 201.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "paymentMethod": {
                          "type": "string",
                          "enum": [
                            "card",
                            "bitcoin"
                          ]
                        },
                        "order": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "integer"
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "subscription",
                                "one_time",
                                "top_up",
                                "usage_charge"
                              ]
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "pending",
                                "completed",
                                "failed",
                                "refunded"
                              ]
                            },
                            "amountCents": {
                              "type": "integer",
                              "description": "Order total after any discount."
                            },
                            "currency": {
                              "type": "string"
                            },
                            "paymentMethod": {
                              "type": "string",
                              "enum": [
                                "card",
                                "bitcoin",
                                "paypal",
                                "none",
                                "other"
                              ]
                            },
                            "description": {
                              "type": "string",
                              "nullable": true
                            },
                            "planId": {
                              "type": "integer",
                              "nullable": true
                            },
                            "subscriptionId": {
                              "type": "integer",
                              "nullable": true
                            },
                            "discountCode": {
                              "type": "string",
                              "nullable": true
                            },
                            "creditAppliedCents": {
                              "type": "integer",
                              "description": "Store credit spent on this order (Bitcoin orders only)."
                            },
                            "refundedCents": {
                              "type": "integer"
                            },
                            "country": {
                              "type": "string",
                              "enum": [
                                "US",
                                "IT",
                                "ES",
                                "IT_ES"
                              ],
                              "nullable": true
                            },
                            "items": {
                              "type": "object",
                              "description": "Top-up orders only.",
                              "properties": {
                                "bandwidthMb": {
                                  "type": "integer"
                                },
                                "ipSlots": {
                                  "type": "integer"
                                }
                              }
                            },
                            "provisioning": {
                              "type": "object",
                              "properties": {
                                "status": {
                                  "type": "string",
                                  "enum": [
                                    "awaiting_payment",
                                    "payment_unconfirmed",
                                    "under_review",
                                    "delivered",
                                    "in_progress",
                                    "not_delivered",
                                    "revoked"
                                  ],
                                  "description": "`awaiting_payment`: not paid yet (an open Bitcoin invoice). `payment_unconfirmed`: a card charge whose outcome is still being confirmed; it may have gone through, so do not pay again. `under_review`: a card charge held for review, authorized but not captured; do not pay again. Both update once resolved, and we email you."
                                },
                                "message": {
                                  "type": "string",
                                  "nullable": true
                                }
                              }
                            },
                            "delivered": {
                              "type": "object",
                              "nullable": true,
                              "description": "What the order delivered, once completed.",
                              "properties": {
                                "subscriptionId": {
                                  "type": "integer"
                                },
                                "activeProxies": {
                                  "type": "integer",
                                  "nullable": true
                                },
                                "bandwidthMb": {
                                  "type": "integer"
                                },
                                "ipSlots": {
                                  "type": "integer"
                                }
                              }
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "settledAt": {
                              "type": "string",
                              "format": "date-time",
                              "nullable": true
                            }
                          },
                          "nullable": true
                        },
                        "checkoutUrl": {
                          "type": "string",
                          "nullable": true,
                          "description": "Bitcoin only: the BTCPay invoice to pay. null when store credit covered the whole order."
                        },
                        "paidWithStoreCredit": {
                          "type": "boolean",
                          "description": "Bitcoin only."
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed Idempotency-Key (`idempotency_key_required`), or an invalid body (`invalid_request`).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "402": {
            "description": "Card problems, nothing charged: no saved card (`no_saved_card`, add one under Settings in the dashboard), expired card (`card_expired`), or declined or refused by our card rules (`card_declined`, the message is safe to show). Or held for review (`payment_held`: the card is authorized, not captured, and nothing is activated; do not retry, since no new card purchase can start while it is under review. The order is in `orderId` and reads `under_review` until decided; you will be emailed).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, lacks the permission this endpoint needs, or the account is blocked (`account_blocked`).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Conflicts. Two of them free the key, so retry the SAME key after a short wait: `idempotency_in_flight` (the request with this key is still being processed; if it persists for minutes, check GET /orders) and `checkout_in_progress` (a checkout for the same thing is already running). The rest are stored and replay on every retry with the same key: `outcome_unknown` (the original request with this key started a purchase and its outcome was never recorded: check GET /orders or contact support, and do NOT retry with a new key); `payment_unconfirmed` (card: an earlier card payment on this account is still being confirmed, or is held for review, so no new card purchase can start; nothing was charged by this request. The earlier order is returned in `orderId` when it can be found. Do NOT retry: check GET /orders/{orderId}, which reads `payment_unconfirmed` or `under_review` until resolved, and wait for our email); `duplicate_recent_purchase` (this repeats a purchase that already exists, returned in `orderId`, and nothing new was charged: a card purchase of the same plan completed in the last 2 minutes, or a Bitcoin purchase of the same items while that invoice, in `checkoutUrl`, is still open, up to 60 minutes. Check GET /orders/{orderId}; to buy the same thing again on purpose, wait out the window and use a new key).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "422": {
            "description": "Idempotency-Key reused with a different body (`idempotency_key_reused`), or the purchase was refused (`plan_unavailable`: the plan does not exist, is inactive, a trial, or unlisted (unlisted plans are never sold through the API), `checkout_refused`, `topup_not_eligible`, `addon_unavailable`, `payment_method_unsupported`, `profile_incomplete`).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Stored, so a retry with the same key replays it rather than charging again, with one exception. `checkout_error`: the message is written for the customer and says what happened, e.g. the payment went through and setup will be finished (do not pay again), or we could not confirm the payment (do not retry; we will email). A `checkout_error` whose message says \"You have not been charged\" (or that the order could not be created) charged nothing: it frees the key, so retry with the same key. `internal_error`: an unexpected failure. `orderId`, when present, is the order this request created. In every stored case check GET /orders before buying again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "502": {
            "description": "The Bitcoin payment provider could not create an invoice (`payment_provider_unavailable`). Nothing was charged and nothing was created, so this answer frees the key (it is not stored): retry later with the same key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Purchases are temporarily unavailable (`unavailable`). Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/notifications": {
      "get": {
        "operationId": "listNotifications",
        "tags": [
          "Account"
        ],
        "summary": "Account notifications",
        "description": "Requires the `read:notifications` permission on the API key. The newest account notifications (the same ones the dashboard bell shows), `limit` default 20, at most 100.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "description": "Number of notifications. Clamped to 100."
          }
        ],
        "responses": {
          "200": {
            "description": "Notifications, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "notifications": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/ip-whitelist": {
      "get": {
        "operationId": "listWhitelistedIps",
        "tags": [
          "IP whitelist"
        ],
        "summary": "List whitelisted addresses",
        "description": "Requires the `read:profile` permission on the API key. Source IP addresses allowed to use IP-authenticated proxies without a username and password.",
        "responses": {
          "200": {
            "description": "Whitelisted addresses.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer"
                        },
                        "ips": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "addWhitelistedIp",
        "tags": [
          "IP whitelist"
        ],
        "summary": "Whitelist an address",
        "description": "Requires the `write:ip-whitelist` permission on the API key. The address must be a publicly routable unicast IPv4 address. Proxy endpoints are IPv4, so IPv6 addresses are refused: they would save without ever matching a connection. Private, loopback, link-local and reserved ranges are refused, as are CIDR blocks.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ipAddress": {
                    "type": "string",
                    "description": "A single public IPv4 address."
                  },
                  "label": {
                    "type": "string",
                    "nullable": true
                  }
                },
                "required": [
                  "ipAddress"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The new entry.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "ipAddress": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string",
                          "nullable": true
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Not a public address, already whitelisted, or the plan's slot limit is reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/ip-whitelist/{id}": {
      "delete": {
        "operationId": "removeWhitelistedIp",
        "tags": [
          "IP whitelist"
        ],
        "summary": "Remove a whitelisted address",
        "description": "Requires the `write:ip-whitelist` permission on the API key. The address stops authenticating immediately; cached approvals are dropped.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Removed."
          },
          "400": {
            "description": "Malformed id.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/credentials": {
      "get": {
        "operationId": "listCredentials",
        "tags": [
          "Credentials"
        ],
        "summary": "List proxy credentials (sub-accounts)",
        "description": "Requires the `read:proxies` permission on the API key. `bandwidthUsedMb` is usage in the CURRENT UTC calendar month — the figure the cap is enforced against — never a lifetime total; `bandwidthPeriod` states this on every row.",
        "parameters": [
          {
            "name": "includePasswords",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": true
            },
            "description": "`false` leaves passwords out of the response: the `password` field in JSON, the password column in txt and csv. Use it when the list is stored, logged or displayed. Anything other than true, false, 1 or 0 is a 400. The API key is still secret material: it can read the passwords back at any time, so keep it out of client-side code and logs either way."
          }
        ],
        "responses": {
          "200": {
            "description": "The account's credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer"
                        },
                        "credentials": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "integer"
                              },
                              "username": {
                                "type": "string"
                              },
                              "password": {
                                "type": "string",
                                "description": "Omitted by GET /credentials when the request sets `includePasswords=false`."
                              },
                              "label": {
                                "type": "string",
                                "nullable": true,
                                "description": "Customer-chosen name for the sub-account. At most 128 characters."
                              },
                              "isActive": {
                                "type": "boolean"
                              },
                              "maxConnections": {
                                "type": "integer",
                                "description": "Advisory concurrent-connection guideline; the enforced brake is per source IP."
                              },
                              "bandwidthLimitMb": {
                                "type": "integer",
                                "nullable": true,
                                "description": "Bandwidth cap in MB per UTC calendar month. null = no cap."
                              },
                              "bandwidthUsedMb": {
                                "type": "integer",
                                "description": "Usage in the CURRENT UTC calendar month — the figure enforced against bandwidthLimitMb. Resets each month; never a lifetime total."
                              },
                              "bandwidthPeriod": {
                                "type": "string",
                                "const": "calendar_month_utc",
                                "description": "The window both fields above are measured over."
                              },
                              "expiresAt": {
                                "type": "string",
                                "format": "date-time",
                                "nullable": true
                              },
                              "lastAuthAt": {
                                "type": "string",
                                "format": "date-time",
                                "nullable": true
                              },
                              "createdAt": {
                                "type": "string",
                                "format": "date-time"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createCredential",
        "tags": [
          "Credentials"
        ],
        "summary": "Create a credential",
        "description": "Requires the `write:credentials` permission on the API key. Mints a working proxy login, which is why this needs a scope of its own rather than `write:proxies`: mint keys for credential automation deliberately. The username and password are generated server-side and returned in the response. Subject to the same per-plan cap on credential count as the dashboard (1 free / 5 paid).",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "nullable": true,
                    "maxLength": 128,
                    "description": "Name for the sub-account, e.g. the client or project. At most 128 characters."
                  },
                  "bandwidthLimitMb": {
                    "type": "integer",
                    "nullable": true,
                    "minimum": 1024,
                    "description": "Bandwidth cap in MB per UTC calendar month, at least 1024 (1 GB). Omit or null for no cap."
                  },
                  "maxConnections": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Advisory concurrent-connection guideline."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The new credential, password included.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "username": {
                          "type": "string"
                        },
                        "password": {
                          "type": "string",
                          "description": "Omitted by GET /credentials when the request sets `includePasswords=false`."
                        },
                        "label": {
                          "type": "string",
                          "nullable": true,
                          "description": "Customer-chosen name for the sub-account. At most 128 characters."
                        },
                        "isActive": {
                          "type": "boolean"
                        },
                        "maxConnections": {
                          "type": "integer",
                          "description": "Advisory concurrent-connection guideline; the enforced brake is per source IP."
                        },
                        "bandwidthLimitMb": {
                          "type": "integer",
                          "nullable": true,
                          "description": "Bandwidth cap in MB per UTC calendar month. null = no cap."
                        },
                        "bandwidthUsedMb": {
                          "type": "integer",
                          "description": "Usage in the CURRENT UTC calendar month — the figure enforced against bandwidthLimitMb. Resets each month; never a lifetime total."
                        },
                        "bandwidthPeriod": {
                          "type": "string",
                          "const": "calendar_month_utc",
                          "description": "The window both fields above are measured over."
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true
                        },
                        "lastAuthAt": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Credential cap reached, label too long, or a bound violated (bandwidthLimitMb below 1024).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Another credential change for this account is in progress. Retry in a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/credentials/{id}": {
      "patch": {
        "operationId": "updateCredential",
        "tags": [
          "Credentials"
        ],
        "summary": "Update a credential's label, limits or active state",
        "description": "Requires the `write:credentials` permission on the API key. Any subset of the fields below; `label` and `bandwidthLimitMb` accept null to clear. Enabling a disabled credential counts against the same active-credential cap the dashboard enforces. Changes to enforced fields take effect within seconds (the auth cache is dropped).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "nullable": true,
                    "maxLength": 128
                  },
                  "bandwidthLimitMb": {
                    "type": "integer",
                    "nullable": true,
                    "minimum": 1024,
                    "description": "MB per UTC calendar month, at least 1024 (1 GB). null for no cap."
                  },
                  "maxConnections": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "isActive": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "username": {
                          "type": "string"
                        },
                        "password": {
                          "type": "string",
                          "description": "Omitted by GET /credentials when the request sets `includePasswords=false`."
                        },
                        "label": {
                          "type": "string",
                          "nullable": true,
                          "description": "Customer-chosen name for the sub-account. At most 128 characters."
                        },
                        "isActive": {
                          "type": "boolean"
                        },
                        "maxConnections": {
                          "type": "integer",
                          "description": "Advisory concurrent-connection guideline; the enforced brake is per source IP."
                        },
                        "bandwidthLimitMb": {
                          "type": "integer",
                          "nullable": true,
                          "description": "Bandwidth cap in MB per UTC calendar month. null = no cap."
                        },
                        "bandwidthUsedMb": {
                          "type": "integer",
                          "description": "Usage in the CURRENT UTC calendar month — the figure enforced against bandwidthLimitMb. Resets each month; never a lifetime total."
                        },
                        "bandwidthPeriod": {
                          "type": "string",
                          "const": "calendar_month_utc",
                          "description": "The window both fields above are measured over."
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true
                        },
                        "lastAuthAt": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Empty update, a bound violated (bandwidthLimitMb below 1024), or enabling past the active-credential cap.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "No such credential on this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Another credential change for this account is in progress. Retry in a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteCredential",
        "tags": [
          "Credentials"
        ],
        "summary": "Delete a credential",
        "description": "Requires the `write:credentials` permission on the API key. The login stops authenticating immediately.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted."
          },
          "400": {
            "description": "Malformed id.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "No such credential on this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/webhooks": {
      "get": {
        "operationId": "listWebhooks",
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhooks",
        "description": "Requires the `write:webhooks` permission on the API key. Every webhook on the account with its URL, subscribed events, active flag and last delivery time. Signing secrets are not returned here; they are shown once, when the webhook is created.",
        "responses": {
          "200": {
            "description": "Configured webhooks.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "webhooks": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Create a webhook",
        "description": "Requires the `write:webhooks` permission on the API key. The URL is resolved and refused if it points at a non-public address, so internal hosts cannot be reached through delivery. The response includes the signing `secret`, shown only this once. `events` lists event names; the events that are delivered, with their payloads, are under `webhooks` in this document. At most 10 webhooks per account.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "name",
                  "url",
                  "events"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created webhook.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "name": {
                          "type": "string"
                        },
                        "url": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Missing fields, or a destination that is not publicly routable.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Destination could not be verified.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/webhooks/{id}": {
      "delete": {
        "operationId": "deleteWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete a webhook",
        "description": "Requires the `write:webhooks` permission on the API key. Deliveries to it stop immediately.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted."
          },
          "400": {
            "description": "Malformed id.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "No such webhook on this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/tickets": {
      "get": {
        "operationId": "listTickets",
        "tags": [
          "Support (restricted)"
        ],
        "summary": "List support tickets",
        "description": "Requires the `admin:tickets:read` permission on the API key. Admin only. Not available to customer keys.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "priority",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "needsReply",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching tickets."
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/tickets/{id}": {
      "get": {
        "operationId": "getTicket",
        "tags": [
          "Support (restricted)"
        ],
        "summary": "Read one ticket with its messages",
        "description": "Requires the `admin:tickets:read` permission on the API key. Admin only. The ticket, its metadata and the full message thread.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The ticket and its thread."
          },
          "400": {
            "description": "Malformed id.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "No such ticket.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateTicket",
        "tags": [
          "Support (restricted)"
        ],
        "summary": "Update a ticket",
        "description": "Requires the `admin:tickets:write` permission on the API key. Admin only. Status, priority, category and assignment.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated ticket."
          },
          "400": {
            "description": "Nothing to update, or a malformed field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "No such ticket.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/tickets/{id}/reply": {
      "post": {
        "operationId": "replyToTicket",
        "tags": [
          "Support (restricted)"
        ],
        "summary": "Reply to a ticket",
        "description": "Requires the `admin:tickets:write` permission on the API key. Admin only. Posts a message on the thread and emails the customer.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The posted reply."
          },
          "400": {
            "description": "Empty message.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "No such ticket.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/plans": {
      "get": {
        "operationId": "listPlans",
        "tags": [
          "Purchasing"
        ],
        "summary": "Plans you can buy",
        "description": "Requires the `read:subscription` permission on the API key. Active, publicly listed paid plans with price, billing cycle, product family and what each includes.",
        "responses": {
          "200": {
            "description": "The sellable catalog, in display order.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "plans": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "integer"
                              },
                              "slug": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string",
                                "nullable": true
                              },
                              "productFamily": {
                                "type": "string",
                                "description": "Product type, e.g. `shared`, `premium_datacenter`, `residential`, `rotating_shared`, `rotating_unmetered`."
                              },
                              "priceCents": {
                                "type": "integer"
                              },
                              "currency": {
                                "type": "string",
                                "const": "usd"
                              },
                              "billingCycle": {
                                "type": "string",
                                "enum": [
                                  "monthly",
                                  "yearly",
                                  "one_time",
                                  "usage_based"
                                ]
                              },
                              "proxyCount": {
                                "type": "integer",
                                "nullable": true,
                                "description": "Dedicated or shared IPs included. null for gateway products."
                              },
                              "bandwidthLimitMb": {
                                "type": "integer",
                                "nullable": true,
                                "description": "Monthly bandwidth included. null = unmetered."
                              },
                              "maxConcurrency": {
                                "type": "integer",
                                "nullable": true,
                                "description": "Simultaneous connections included, for connection-priced plans. null = no per-account cap."
                              },
                              "residentialTargeting": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "nullable": true,
                                "description": "Residential plans only: targeting included (country, session, city, ...)."
                              },
                              "features": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "countrySelectable": {
                                "type": "boolean",
                                "description": "True when POST /orders accepts `country`."
                              },
                              "countries": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "code": {
                                      "type": "string",
                                      "enum": [
                                        "US",
                                        "IT",
                                        "ES",
                                        "IT_ES"
                                      ]
                                    },
                                    "label": {
                                      "type": "string"
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, lacks the permission this endpoint needs, or the account is blocked (`account_blocked`).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/addons": {
      "get": {
        "operationId": "listAddons",
        "tags": [
          "Purchasing"
        ],
        "summary": "Bandwidth top-ups and IP slots this account can buy",
        "description": "Requires the `read:subscription` permission on the API key. Top-up prices depend on your own plan. Besides the listed packs, any whole number of GB inside `bounds` can be bought with addonId `topup_<gb>gb`. Add-ons are paid with Bitcoin.",
        "responses": {
          "200": {
            "description": "Add-ons available to this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "currency": {
                          "type": "string"
                        },
                        "paymentMethods": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "const": "bitcoin"
                          }
                        },
                        "bandwidth": {
                          "type": "object",
                          "properties": {
                            "eligible": {
                              "type": "boolean"
                            },
                            "reason": {
                              "type": "string",
                              "nullable": true
                            },
                            "packs": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "description": {
                                    "type": "string"
                                  },
                                  "bandwidthMb": {
                                    "type": "integer"
                                  },
                                  "priceCents": {
                                    "type": "integer"
                                  },
                                  "ratePerGbCents": {
                                    "type": "number"
                                  }
                                }
                              }
                            },
                            "bounds": {
                              "type": "object",
                              "nullable": true,
                              "properties": {
                                "minGb": {
                                  "type": "integer"
                                },
                                "maxGb": {
                                  "type": "integer"
                                },
                                "ratePerGbCents": {
                                  "type": "number"
                                },
                                "rateBreaks": {
                                  "type": "array",
                                  "items": {
                                    "type": "object"
                                  }
                                }
                              }
                            },
                            "customAddonId": {
                              "type": "string"
                            }
                          }
                        },
                        "ipSlots": {
                          "type": "object",
                          "properties": {
                            "eligible": {
                              "type": "boolean"
                            },
                            "reason": {
                              "type": "string",
                              "nullable": true
                            },
                            "currentSlots": {
                              "type": "integer"
                            },
                            "maxSlots": {
                              "type": "integer"
                            },
                            "addons": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "description": {
                                    "type": "string"
                                  },
                                  "quantity": {
                                    "type": "integer"
                                  },
                                  "priceCents": {
                                    "type": "integer"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, lacks the permission this endpoint needs, or the account is blocked (`account_blocked`).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/topups": {
      "post": {
        "operationId": "createTopup",
        "tags": [
          "Purchasing"
        ],
        "summary": "Buy a bandwidth top-up or IP slots",
        "description": "Requires the `write:orders` permission on the API key. `addonId` is a bandwidth pack (`topup_<gb>gb`) or an IP-slot add-on (`ip_1`, `ip_5`, `ip_10`) from GET /addons. Paid with Bitcoin; store credit is applied automatically. `card` is refused with `payment_method_unsupported`.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required. 1-255 visible ASCII characters (a UUID is ideal), unique per purchase. Retrying with the same key and the same body within 24 hours returns the original response (header `Idempotent-Replayed: true`) and never charges again. The same key with a different body returns 422; a request still being processed returns 409 `idempotency_in_flight`. A key frees up 24 hours after its request FINISHED. A key whose original request never recorded an outcome is never freed: it answers 409 `outcome_unknown` for good (check GET /orders, do not retry with a new key). Keys are scoped to your account.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "addonId",
                  "paymentMethod"
                ],
                "properties": {
                  "addonId": {
                    "type": "string"
                  },
                  "paymentMethod": {
                    "type": "string",
                    "enum": [
                      "bitcoin",
                      "card"
                    ]
                  },
                  "discountCode": {
                    "type": "string",
                    "maxLength": 64,
                    "description": "Bandwidth top-ups only."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Invoice created (or settled by store credit).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "paymentMethod": {
                          "type": "string",
                          "enum": [
                            "card",
                            "bitcoin"
                          ]
                        },
                        "order": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "integer"
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "subscription",
                                "one_time",
                                "top_up",
                                "usage_charge"
                              ]
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "pending",
                                "completed",
                                "failed",
                                "refunded"
                              ]
                            },
                            "amountCents": {
                              "type": "integer",
                              "description": "Order total after any discount."
                            },
                            "currency": {
                              "type": "string"
                            },
                            "paymentMethod": {
                              "type": "string",
                              "enum": [
                                "card",
                                "bitcoin",
                                "paypal",
                                "none",
                                "other"
                              ]
                            },
                            "description": {
                              "type": "string",
                              "nullable": true
                            },
                            "planId": {
                              "type": "integer",
                              "nullable": true
                            },
                            "subscriptionId": {
                              "type": "integer",
                              "nullable": true
                            },
                            "discountCode": {
                              "type": "string",
                              "nullable": true
                            },
                            "creditAppliedCents": {
                              "type": "integer",
                              "description": "Store credit spent on this order (Bitcoin orders only)."
                            },
                            "refundedCents": {
                              "type": "integer"
                            },
                            "country": {
                              "type": "string",
                              "enum": [
                                "US",
                                "IT",
                                "ES",
                                "IT_ES"
                              ],
                              "nullable": true
                            },
                            "items": {
                              "type": "object",
                              "description": "Top-up orders only.",
                              "properties": {
                                "bandwidthMb": {
                                  "type": "integer"
                                },
                                "ipSlots": {
                                  "type": "integer"
                                }
                              }
                            },
                            "provisioning": {
                              "type": "object",
                              "properties": {
                                "status": {
                                  "type": "string",
                                  "enum": [
                                    "awaiting_payment",
                                    "payment_unconfirmed",
                                    "under_review",
                                    "delivered",
                                    "in_progress",
                                    "not_delivered",
                                    "revoked"
                                  ],
                                  "description": "`awaiting_payment`: not paid yet (an open Bitcoin invoice). `payment_unconfirmed`: a card charge whose outcome is still being confirmed; it may have gone through, so do not pay again. `under_review`: a card charge held for review, authorized but not captured; do not pay again. Both update once resolved, and we email you."
                                },
                                "message": {
                                  "type": "string",
                                  "nullable": true
                                }
                              }
                            },
                            "delivered": {
                              "type": "object",
                              "nullable": true,
                              "description": "What the order delivered, once completed.",
                              "properties": {
                                "subscriptionId": {
                                  "type": "integer"
                                },
                                "activeProxies": {
                                  "type": "integer",
                                  "nullable": true
                                },
                                "bandwidthMb": {
                                  "type": "integer"
                                },
                                "ipSlots": {
                                  "type": "integer"
                                }
                              }
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "settledAt": {
                              "type": "string",
                              "format": "date-time",
                              "nullable": true
                            }
                          },
                          "nullable": true
                        },
                        "checkoutUrl": {
                          "type": "string",
                          "nullable": true,
                          "description": "Bitcoin only: the BTCPay invoice to pay. null when store credit covered the whole order."
                        },
                        "paidWithStoreCredit": {
                          "type": "boolean",
                          "description": "Bitcoin only."
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed Idempotency-Key (`idempotency_key_required`), or an invalid body (`invalid_request`).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, lacks the permission this endpoint needs, or the account is blocked (`account_blocked`).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Conflicts. Two of them free the key, so retry the SAME key after a short wait: `idempotency_in_flight` (the request with this key is still being processed; if it persists for minutes, check GET /orders) and `checkout_in_progress` (a checkout for the same thing is already running). The rest are stored and replay on every retry with the same key: `outcome_unknown` (the original request with this key started a purchase and its outcome was never recorded: check GET /orders or contact support, and do NOT retry with a new key); `payment_unconfirmed` (card: an earlier card payment on this account is still being confirmed, or is held for review, so no new card purchase can start; nothing was charged by this request. The earlier order is returned in `orderId` when it can be found. Do NOT retry: check GET /orders/{orderId}, which reads `payment_unconfirmed` or `under_review` until resolved, and wait for our email); `duplicate_recent_purchase` (this repeats a purchase that already exists, returned in `orderId`, and nothing new was charged: a card purchase of the same plan completed in the last 2 minutes, or a Bitcoin purchase of the same items while that invoice, in `checkoutUrl`, is still open, up to 60 minutes. Check GET /orders/{orderId}; to buy the same thing again on purpose, wait out the window and use a new key).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "422": {
            "description": "Idempotency-Key reused with a different body (`idempotency_key_reused`), or the purchase was refused (`plan_unavailable`: the plan does not exist, is inactive, a trial, or unlisted (unlisted plans are never sold through the API), `checkout_refused`, `topup_not_eligible`, `addon_unavailable`, `payment_method_unsupported`, `profile_incomplete`).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Stored, so a retry with the same key replays it rather than charging again, with one exception. `checkout_error`: the message is written for the customer and says what happened, e.g. the payment went through and setup will be finished (do not pay again), or we could not confirm the payment (do not retry; we will email). A `checkout_error` whose message says \"You have not been charged\" (or that the order could not be created) charged nothing: it frees the key, so retry with the same key. `internal_error`: an unexpected failure. `orderId`, when present, is the order this request created. In every stored case check GET /orders before buying again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "502": {
            "description": "The Bitcoin payment provider could not create an invoice (`payment_provider_unavailable`). Nothing was charged and nothing was created, so this answer frees the key (it is not stored): retry later with the same key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Purchases are temporarily unavailable (`unavailable`). Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/orders/{id}": {
      "get": {
        "operationId": "getOrder",
        "tags": [
          "Purchasing"
        ],
        "summary": "One order's status",
        "description": "Requires the `read:orders` permission on the API key. Payment status, provisioning status and what was delivered. Only your own orders.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The order.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "order": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "integer"
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "subscription",
                                "one_time",
                                "top_up",
                                "usage_charge"
                              ]
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "pending",
                                "completed",
                                "failed",
                                "refunded"
                              ]
                            },
                            "amountCents": {
                              "type": "integer",
                              "description": "Order total after any discount."
                            },
                            "currency": {
                              "type": "string"
                            },
                            "paymentMethod": {
                              "type": "string",
                              "enum": [
                                "card",
                                "bitcoin",
                                "paypal",
                                "none",
                                "other"
                              ]
                            },
                            "description": {
                              "type": "string",
                              "nullable": true
                            },
                            "planId": {
                              "type": "integer",
                              "nullable": true
                            },
                            "subscriptionId": {
                              "type": "integer",
                              "nullable": true
                            },
                            "discountCode": {
                              "type": "string",
                              "nullable": true
                            },
                            "creditAppliedCents": {
                              "type": "integer",
                              "description": "Store credit spent on this order (Bitcoin orders only)."
                            },
                            "refundedCents": {
                              "type": "integer"
                            },
                            "country": {
                              "type": "string",
                              "enum": [
                                "US",
                                "IT",
                                "ES",
                                "IT_ES"
                              ],
                              "nullable": true
                            },
                            "items": {
                              "type": "object",
                              "description": "Top-up orders only.",
                              "properties": {
                                "bandwidthMb": {
                                  "type": "integer"
                                },
                                "ipSlots": {
                                  "type": "integer"
                                }
                              }
                            },
                            "provisioning": {
                              "type": "object",
                              "properties": {
                                "status": {
                                  "type": "string",
                                  "enum": [
                                    "awaiting_payment",
                                    "payment_unconfirmed",
                                    "under_review",
                                    "delivered",
                                    "in_progress",
                                    "not_delivered",
                                    "revoked"
                                  ],
                                  "description": "`awaiting_payment`: not paid yet (an open Bitcoin invoice). `payment_unconfirmed`: a card charge whose outcome is still being confirmed; it may have gone through, so do not pay again. `under_review`: a card charge held for review, authorized but not captured; do not pay again. Both update once resolved, and we email you."
                                },
                                "message": {
                                  "type": "string",
                                  "nullable": true
                                }
                              }
                            },
                            "delivered": {
                              "type": "object",
                              "nullable": true,
                              "description": "What the order delivered, once completed.",
                              "properties": {
                                "subscriptionId": {
                                  "type": "integer"
                                },
                                "activeProxies": {
                                  "type": "integer",
                                  "nullable": true
                                },
                                "bandwidthMb": {
                                  "type": "integer"
                                },
                                "ipSlots": {
                                  "type": "integer"
                                }
                              }
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "settledAt": {
                              "type": "string",
                              "format": "date-time",
                              "nullable": true
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The id is not a positive integer.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, lacks the permission this endpoint needs, or the account is blocked (`account_blocked`).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "No such order on this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Customer-safe explanation."
                    },
                    "code": {
                      "type": "string",
                      "description": "Machine-readable reason, e.g. `card_declined`, `no_saved_card`, `plan_unavailable`."
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "The order to check with GET /orders/{orderId}. `duplicate_recent_purchase`: the earlier order this request repeats. `payment_unconfirmed`: the earlier card order still being confirmed or held for review. `payment_held`: the order held for review. `checkout_error` / `internal_error` on a card purchase: the order this request created, when it got that far."
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "`duplicate_recent_purchase` on Bitcoin only: the still-open invoice to pay."
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/gateways": {
      "get": {
        "operationId": "listGateways",
        "tags": [
          "Gateways"
        ],
        "summary": "Rotating and residential gateways on the account",
        "description": "Requires the `read:proxies` permission on the API key. One entry per gateway product the account holds: hostname, HTTP and SOCKS5 ports, the usernames that authenticate, and which targeting segments the product accepts. Passwords are returned by /gateways/endpoint. Rotation is per connection: without a session id the gateway picks an exit for each HTTPS tunnel or SOCKS5 connection (and each plain-HTTP request), not for each request sent over a kept-alive tunnel.",
        "responses": {
          "200": {
            "description": "Gateway products held by the account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "gateways": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "product": {
                                "type": "string",
                                "enum": [
                                  "rotating_shared",
                                  "residential",
                                  "rotating_unmetered"
                                ]
                              },
                              "name": {
                                "type": "string",
                                "example": "Rotating Datacenter"
                              },
                              "host": {
                                "type": "string",
                                "example": "gw-rotating_datacenter.node4.io"
                              },
                              "legacyHosts": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Older hostnames that still serve the same listeners."
                              },
                              "ports": {
                                "type": "object",
                                "properties": {
                                  "http": {
                                    "type": "integer"
                                  },
                                  "socks5": {
                                    "type": "integer"
                                  }
                                },
                                "example": {
                                  "http": 8083,
                                  "socks5": 1083
                                }
                              },
                              "rotation": {
                                "type": "string",
                                "const": "per_connection"
                              },
                              "targeting": {
                                "type": "object",
                                "properties": {
                                  "country": {
                                    "type": "boolean"
                                  },
                                  "state": {
                                    "type": "boolean"
                                  },
                                  "city": {
                                    "type": "boolean"
                                  },
                                  "asn": {
                                    "type": "boolean"
                                  },
                                  "session": {
                                    "type": "boolean"
                                  }
                                }
                              },
                              "usernameGrammar": {
                                "type": "string",
                                "example": "USERNAME[-country-<cc>][-session-<id>]"
                              },
                              "stickySession": {
                                "type": "object",
                                "properties": {
                                  "supported": {
                                    "type": "boolean"
                                  },
                                  "segment": {
                                    "type": "string",
                                    "example": "-session-<id>"
                                  },
                                  "sessionIdPattern": {
                                    "type": "string",
                                    "example": "^[A-Za-z0-9]{1,32}$"
                                  },
                                  "maxSeconds": {
                                    "type": "integer",
                                    "description": "Fixed ceiling: 1800 on rotating (from first assignment), 1800 on residential (best effort)."
                                  },
                                  "bestEffort": {
                                    "type": "boolean"
                                  }
                                }
                              },
                              "connectionLimit": {
                                "type": "integer",
                                "nullable": true,
                                "description": "Rotating Unmetered only: the account's concurrent-connection ceiling (stacked across plans)."
                              },
                              "usernames": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "username": {
                                      "type": "string"
                                    },
                                    "source": {
                                      "type": "string",
                                      "enum": [
                                        "account",
                                        "gateway"
                                      ]
                                    },
                                    "status": {
                                      "type": "string",
                                      "enum": [
                                        "active",
                                        "over_limit"
                                      ],
                                      "description": "`over_limit`: an account credential that has used its own monthly bandwidth cap. Every gateway refuses it, so it is never the default, and naming it in /gateways/endpoint is a 409."
                                    },
                                    "credentialId": {
                                      "type": "integer",
                                      "description": "Present for account credentials (see /credentials)."
                                    },
                                    "label": {
                                      "type": "string",
                                      "nullable": true
                                    },
                                    "proxyId": {
                                      "type": "integer",
                                      "description": "Present for a gateway row's own credential."
                                    }
                                  }
                                }
                              },
                              "defaultUsername": {
                                "type": "string",
                                "nullable": true,
                                "description": "The first login with status `active`."
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/gateways/endpoint": {
      "get": {
        "operationId": "getGatewayEndpoint",
        "tags": [
          "Gateways"
        ],
        "summary": "Build proxy strings for a gateway (query form)",
        "description": "Requires the `read:proxies` permission on the API key. Same as the POST form, with the options as query parameters. Rotation is per connection: without a session id the gateway picks an exit for each HTTPS tunnel or SOCKS5 connection (and each plain-HTTP request), not for each request sent over a kept-alive tunnel.",
        "parameters": [
          {
            "name": "product",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "rotating_shared",
                "residential",
                "rotating_unmetered",
                "rotating_datacenter"
              ],
              "description": "Gateway product. `rotating_datacenter` is an alias of `rotating_shared`."
            }
          },
          {
            "name": "protocol",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "http",
                "socks5"
              ],
              "default": "http"
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 2,
              "description": "ISO 3166-1 alpha-2. Rotating and residential. Checked against the countries the product's exit pool holds (rotating: the same pool the gateways draw from, per product; residential: the coverage list); a country with no exits is a 422 that lists the countries served."
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 3,
              "description": "Residential only; needs country."
            }
          },
          {
            "name": "city",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9]+$",
              "description": "Residential only; needs country. A city code from /geo/countries/{country}/cities. A city name that exists in more than one state is refused (422) unless state is given."
            }
          },
          {
            "name": "asn",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "description": "Residential only."
            }
          },
          {
            "name": "session",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9]{1,32}$",
              "description": "Fixed sticky session id (count must be 1)."
            }
          },
          {
            "name": "sticky",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "Mint a session id when none is given."
            }
          },
          {
            "name": "count",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 1,
              "description": "Mint this many distinct sticky sessions (max 100). Implies sticky."
            }
          },
          {
            "name": "ttl",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Not selectable. Pins last up to a fixed ceiling (1800 s rotating, 1800 s residential); any other value is refused with 400."
            }
          },
          {
            "name": "credentialId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Use this account credential (see /credentials). Default: the first active one that is not over its monthly cap."
            }
          },
          {
            "name": "username",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Use the login with this base username (one of /gateways usernames)."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ready-to-use proxy strings.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "description": "The first endpoint's fields are repeated at the top level for the common count=1 case.",
                      "properties": {
                        "product": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "protocol": {
                          "type": "string",
                          "enum": [
                            "http",
                            "socks5"
                          ]
                        },
                        "rotation": {
                          "type": "string",
                          "const": "per_connection"
                        },
                        "targeting": {
                          "type": "object",
                          "properties": {
                            "country": {
                              "type": "string",
                              "nullable": true
                            },
                            "state": {
                              "type": "string",
                              "nullable": true
                            },
                            "city": {
                              "type": "string",
                              "nullable": true
                            },
                            "asn": {
                              "type": "integer",
                              "nullable": true
                            }
                          }
                        },
                        "sticky": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean"
                            },
                            "maxSeconds": {
                              "type": "integer"
                            },
                            "note": {
                              "type": "string"
                            }
                          }
                        },
                        "sessionId": {
                          "type": "string",
                          "nullable": true
                        },
                        "host": {
                          "type": "string"
                        },
                        "port": {
                          "type": "integer",
                          "description": "The port for the requested protocol."
                        },
                        "username": {
                          "type": "string",
                          "description": "The full username, targeting and session segments included."
                        },
                        "password": {
                          "type": "string"
                        },
                        "url": {
                          "type": "string",
                          "description": "`http` or `socks5` below, matching the requested protocol."
                        },
                        "http": {
                          "type": "string",
                          "example": "http://USERNAME:PASSWORD@gw-rotating_datacenter.node4.io:8083"
                        },
                        "socks5": {
                          "type": "string",
                          "example": "socks5://USERNAME:PASSWORD@gw-rotating_datacenter.node4.io:1083"
                        },
                        "hostPortUserPass": {
                          "type": "string",
                          "example": "gw-rotating_datacenter.node4.io:8083:USERNAME:PASSWORD"
                        },
                        "endpoints": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "sessionId": {
                                "type": "string",
                                "nullable": true
                              },
                              "host": {
                                "type": "string"
                              },
                              "port": {
                                "type": "integer",
                                "description": "The port for the requested protocol."
                              },
                              "username": {
                                "type": "string",
                                "description": "The full username, targeting and session segments included."
                              },
                              "password": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string",
                                "description": "`http` or `socks5` below, matching the requested protocol."
                              },
                              "http": {
                                "type": "string",
                                "example": "http://USERNAME:PASSWORD@gw-rotating_datacenter.node4.io:8083"
                              },
                              "socks5": {
                                "type": "string",
                                "example": "socks5://USERNAME:PASSWORD@gw-rotating_datacenter.node4.io:1083"
                              },
                              "hostPortUserPass": {
                                "type": "string",
                                "example": "gw-rotating_datacenter.node4.io:8083:USERNAME:PASSWORD"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Unknown product, malformed value, an option the product does not support, count out of range, or a ttl other than the fixed ceiling.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked or lacks read:proxies, or the targeting asked for is not in your residential plan (\"Your residential plan does not include <capability> targeting.\").",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "The account has no active plan for that product, or the named credential is not one of its active logins.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "The account has no active proxy login, or the named login has used its monthly bandwidth cap.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "422": {
            "description": "A country with no exits in the product's pool (rotating or residential; the message lists the countries served), residential state or city outside the coverage list, an ambiguous city (the message names the states to choose from), or, on rotating, a base username that already contains a gateway targeting marker (-country-, -session-, -city-), so targeting cannot be appended unambiguously. Pick another login.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "buildGatewayEndpoint",
        "tags": [
          "Gateways"
        ],
        "summary": "Build proxy strings for a gateway",
        "description": "Requires the `read:proxies` permission on the API key. Composes the username (targeting and session segments) for one product and returns host, port, username, password and the `http://`, `socks5://` and `host:port:user:pass` forms. Residential targeting is checked against your plan and the coverage list. Rotation is per connection: without a session id the gateway picks an exit for each HTTPS tunnel or SOCKS5 connection (and each plain-HTTP request), not for each request sent over a kept-alive tunnel.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "product"
                ],
                "properties": {
                  "product": {
                    "type": "string",
                    "enum": [
                      "rotating_shared",
                      "residential",
                      "rotating_unmetered",
                      "rotating_datacenter"
                    ],
                    "description": "Gateway product. `rotating_datacenter` is an alias of `rotating_shared`."
                  },
                  "protocol": {
                    "type": "string",
                    "enum": [
                      "http",
                      "socks5"
                    ],
                    "default": "http"
                  },
                  "country": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 2,
                    "description": "ISO 3166-1 alpha-2. Rotating and residential. Checked against the countries the product's exit pool holds (rotating: the same pool the gateways draw from, per product; residential: the coverage list); a country with no exits is a 422 that lists the countries served."
                  },
                  "state": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 3,
                    "description": "Residential only; needs country."
                  },
                  "city": {
                    "type": "string",
                    "pattern": "^[a-z0-9]+$",
                    "description": "Residential only; needs country. A city code from /geo/countries/{country}/cities. A city name that exists in more than one state is refused (422) unless state is given."
                  },
                  "asn": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Residential only."
                  },
                  "session": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9]{1,32}$",
                    "description": "Fixed sticky session id (count must be 1)."
                  },
                  "sticky": {
                    "type": "boolean",
                    "description": "Mint a session id when none is given."
                  },
                  "count": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 1,
                    "description": "Mint this many distinct sticky sessions (max 100). Implies sticky."
                  },
                  "ttl": {
                    "type": "integer",
                    "description": "Not selectable. Pins last up to a fixed ceiling (1800 s rotating, 1800 s residential); any other value is refused with 400."
                  },
                  "credentialId": {
                    "type": "integer",
                    "description": "Use this account credential (see /credentials). Default: the first active one that is not over its monthly cap."
                  },
                  "username": {
                    "type": "string",
                    "description": "Use the login with this base username (one of /gateways usernames)."
                  }
                }
              },
              "example": {
                "product": "residential",
                "country": "us",
                "state": "tx",
                "city": "austin",
                "count": 3
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ready-to-use proxy strings.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "description": "The first endpoint's fields are repeated at the top level for the common count=1 case.",
                      "properties": {
                        "product": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "protocol": {
                          "type": "string",
                          "enum": [
                            "http",
                            "socks5"
                          ]
                        },
                        "rotation": {
                          "type": "string",
                          "const": "per_connection"
                        },
                        "targeting": {
                          "type": "object",
                          "properties": {
                            "country": {
                              "type": "string",
                              "nullable": true
                            },
                            "state": {
                              "type": "string",
                              "nullable": true
                            },
                            "city": {
                              "type": "string",
                              "nullable": true
                            },
                            "asn": {
                              "type": "integer",
                              "nullable": true
                            }
                          }
                        },
                        "sticky": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean"
                            },
                            "maxSeconds": {
                              "type": "integer"
                            },
                            "note": {
                              "type": "string"
                            }
                          }
                        },
                        "sessionId": {
                          "type": "string",
                          "nullable": true
                        },
                        "host": {
                          "type": "string"
                        },
                        "port": {
                          "type": "integer",
                          "description": "The port for the requested protocol."
                        },
                        "username": {
                          "type": "string",
                          "description": "The full username, targeting and session segments included."
                        },
                        "password": {
                          "type": "string"
                        },
                        "url": {
                          "type": "string",
                          "description": "`http` or `socks5` below, matching the requested protocol."
                        },
                        "http": {
                          "type": "string",
                          "example": "http://USERNAME:PASSWORD@gw-rotating_datacenter.node4.io:8083"
                        },
                        "socks5": {
                          "type": "string",
                          "example": "socks5://USERNAME:PASSWORD@gw-rotating_datacenter.node4.io:1083"
                        },
                        "hostPortUserPass": {
                          "type": "string",
                          "example": "gw-rotating_datacenter.node4.io:8083:USERNAME:PASSWORD"
                        },
                        "endpoints": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "sessionId": {
                                "type": "string",
                                "nullable": true
                              },
                              "host": {
                                "type": "string"
                              },
                              "port": {
                                "type": "integer",
                                "description": "The port for the requested protocol."
                              },
                              "username": {
                                "type": "string",
                                "description": "The full username, targeting and session segments included."
                              },
                              "password": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string",
                                "description": "`http` or `socks5` below, matching the requested protocol."
                              },
                              "http": {
                                "type": "string",
                                "example": "http://USERNAME:PASSWORD@gw-rotating_datacenter.node4.io:8083"
                              },
                              "socks5": {
                                "type": "string",
                                "example": "socks5://USERNAME:PASSWORD@gw-rotating_datacenter.node4.io:1083"
                              },
                              "hostPortUserPass": {
                                "type": "string",
                                "example": "gw-rotating_datacenter.node4.io:8083:USERNAME:PASSWORD"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Unknown product, malformed value, an option the product does not support, count out of range, or a ttl other than the fixed ceiling.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked or lacks read:proxies, or the targeting asked for is not in your residential plan (\"Your residential plan does not include <capability> targeting.\").",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "The account has no active plan for that product, or the named credential is not one of its active logins.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "The account has no active proxy login, or the named login has used its monthly bandwidth cap.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "422": {
            "description": "A country with no exits in the product's pool (rotating or residential; the message lists the countries served), residential state or city outside the coverage list, an ambiguous city (the message names the states to choose from), or, on rotating, a base username that already contains a gateway targeting marker (-country-, -session-, -city-), so targeting cannot be appended unambiguously. Pick another login.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/connections/live": {
      "get": {
        "operationId": "getLiveConnections",
        "tags": [
          "Gateways"
        ],
        "summary": "Open connections vs the Rotating Unmetered ceiling",
        "description": "Requires the `read:proxies` permission on the API key. The same live count the dashboard's live connections panel shows, plus recent refusals at the ceiling. `hasPlan` is false for an account without a Rotating Unmetered plan.",
        "responses": {
          "200": {
            "description": "Live connection state.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "hasPlan": {
                          "type": "boolean"
                        },
                        "limit": {
                          "type": "integer",
                          "nullable": true,
                          "description": "Concurrent-connection ceiling."
                        },
                        "open": {
                          "type": "integer",
                          "nullable": true,
                          "description": "Open connections fleet-wide right now; null when the count is unavailable."
                        },
                        "at": {
                          "type": "integer",
                          "description": "Epoch milliseconds."
                        },
                        "category": {
                          "type": "string",
                          "const": "rotating_unmetered"
                        },
                        "refusedThisMinute": {
                          "type": "integer",
                          "nullable": true,
                          "description": "Connections refused at the ceiling in the current (still filling) minute."
                        },
                        "refusedLast5Minutes": {
                          "type": "integer",
                          "nullable": true,
                          "description": "Refused in the current minute and the four before it."
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/connections/history": {
      "get": {
        "operationId": "getConnectionHistory",
        "tags": [
          "Gateways"
        ],
        "summary": "Rotating Unmetered connection history",
        "description": "Requires the `read:proxies` permission on the API key. Peak open connections and refusals per bucket, the series the dashboard charts. History is kept 35 days.",
        "parameters": [
          {
            "name": "range",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "1h",
                "24h",
                "7d",
                "30d"
              ],
              "default": "24h"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Connection history.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "hasPlan": {
                          "type": "boolean"
                        },
                        "limit": {
                          "type": "integer",
                          "nullable": true
                        },
                        "range": {
                          "type": "string",
                          "enum": [
                            "1h",
                            "24h",
                            "7d",
                            "30d"
                          ]
                        },
                        "bucketMinutes": {
                          "type": "integer",
                          "description": "1 for 1h, 5 for 24h, 60 for 7d, 240 for 30d."
                        },
                        "buckets": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "t": {
                                "type": "integer",
                                "description": "Bucket start, epoch milliseconds."
                              },
                              "peak": {
                                "type": "integer",
                                "description": "Highest open-connection count in the bucket."
                              },
                              "refused": {
                                "type": "integer",
                                "description": "Connections refused at the ceiling in the bucket."
                              }
                            }
                          }
                        },
                        "summary": {
                          "type": "object",
                          "properties": {
                            "peak": {
                              "type": "integer"
                            },
                            "peakAt": {
                              "type": "integer",
                              "nullable": true
                            },
                            "refused": {
                              "type": "integer"
                            },
                            "minutesAtLimit": {
                              "type": "integer"
                            },
                            "activeMinutes": {
                              "type": "integer"
                            }
                          }
                        },
                        "suggestion": {
                          "type": "object",
                          "nullable": true,
                          "description": "A larger plan sized to the refusals, when there were any."
                        },
                        "suggestionKind": {
                          "type": "string",
                          "enum": [
                            "add",
                            "convert"
                          ],
                          "description": "`add`: the suggestion stacks onto your paid plans. `convert`: your limit comes from a trial only, so the suggestion is the plan that keeps this capacity after it (buying ends the trial; nothing stacks)."
                        },
                        "redisOk": {
                          "type": "boolean",
                          "description": "False when the most recent minutes could not be read."
                        },
                        "category": {
                          "type": "string",
                          "const": "rotating_unmetered"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "range is not one of 1h, 24h, 7d, 30d.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/sub-users": {
      "get": {
        "operationId": "listSubUsers",
        "tags": [
          "Sub-users"
        ],
        "summary": "List sub-users",
        "description": "Requires the `read:proxies` permission on the API key. Every per-client login on the account with its status, limits, this month's usage and last use, plus the plan's sub-user caps. Disabled sub-users count toward `maxSubUsers`.",
        "responses": {
          "200": {
            "description": "The account's sub-users.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer"
                        },
                        "plan": {
                          "type": "object",
                          "properties": {
                            "maxSubUsers": {
                              "type": "integer",
                              "description": "Sub-users the account may hold, disabled included (1 free / 5 paid)."
                            },
                            "maxActiveSubUsers": {
                              "type": "integer"
                            },
                            "used": {
                              "type": "integer"
                            },
                            "active": {
                              "type": "integer"
                            }
                          }
                        },
                        "bandwidthPeriod": {
                          "type": "string",
                          "const": "calendar_month_utc"
                        },
                        "subUsers": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "integer"
                              },
                              "username": {
                                "type": "string"
                              },
                              "password": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string",
                                "nullable": true,
                                "description": "Customer-chosen name, e.g. the client. At most 128 characters."
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "active",
                                  "disabled",
                                  "expired",
                                  "over_limit"
                                ],
                                "description": "`over_limit` = this month's bandwidth cap is used up; the login is refused until the cap is raised or the month rolls over."
                              },
                              "limits": {
                                "type": "object",
                                "properties": {
                                  "bandwidthLimitMb": {
                                    "type": "integer",
                                    "nullable": true,
                                    "description": "Cap in MB per UTC calendar month. null = no cap. Enforced as described on the create and update bodies."
                                  },
                                  "bandwidthPeriod": {
                                    "type": "string",
                                    "const": "calendar_month_utc"
                                  },
                                  "maxConnections": {
                                    "type": "integer",
                                    "description": "Advisory concurrent-connection guideline. Not enforced."
                                  },
                                  "maxConnectionsEnforced": {
                                    "type": "boolean",
                                    "const": false
                                  }
                                }
                              },
                              "usage": {
                                "type": "object",
                                "properties": {
                                  "periodStart": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "periodEnd": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "bandwidthUsedMb": {
                                    "type": "integer",
                                    "description": "Usage this UTC calendar month, the figure the cap is enforced against."
                                  },
                                  "bandwidthRemainingMb": {
                                    "type": "integer",
                                    "nullable": true,
                                    "description": "null when there is no cap."
                                  }
                                }
                              },
                              "lastUsedAt": {
                                "type": "string",
                                "format": "date-time",
                                "nullable": true,
                                "description": "Last authentication. Can trail real use by a few minutes (cached authentications do not restamp it)."
                              },
                              "expiresAt": {
                                "type": "string",
                                "format": "date-time",
                                "nullable": true
                              },
                              "createdAt": {
                                "type": "string",
                                "format": "date-time"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createSubUser",
        "tags": [
          "Sub-users"
        ],
        "summary": "Create a sub-user",
        "description": "Requires the `write:credentials` permission on the API key. Mints a working proxy login; the username and password are generated and returned. Subject to the plan's sub-user cap and, on the free tier, email verification. Fields that cannot be enforced are refused with a 400 rather than stored: `allowedIps`/`ipWhitelist` (use the account IP whitelist and send the sub-user's username from a whitelisted address), `allowedProducts`/`products`, and `maxConcurrentConnections`/`connectionLimit` (the Rotating Unmetered ceiling is per account). Unknown fields are refused too.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "label": {
                    "type": "string",
                    "nullable": true,
                    "maxLength": 128,
                    "description": "Blank or null clears it."
                  },
                  "bandwidthLimitMb": {
                    "type": "integer",
                    "nullable": true,
                    "minimum": 1024,
                    "description": "Cap in MB per UTC calendar month, at least 1024 (1 GB). null = no cap. Caps are checked against a usage counter the gateways update about every 10 s, through cached auth answers, so they are not a to-the-byte cut-off: expect roughly the login's throughput over 30 s to 2 minutes past the cap, plus bytes inside connections already open. Residential is checked the same way, through the residential gateway's 30 s cache."
                  },
                  "maxConnections": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Advisory only."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new sub-user, password included.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "username": {
                          "type": "string"
                        },
                        "password": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string",
                          "nullable": true,
                          "description": "Customer-chosen name, e.g. the client. At most 128 characters."
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "active",
                            "disabled",
                            "expired",
                            "over_limit"
                          ],
                          "description": "`over_limit` = this month's bandwidth cap is used up; the login is refused until the cap is raised or the month rolls over."
                        },
                        "limits": {
                          "type": "object",
                          "properties": {
                            "bandwidthLimitMb": {
                              "type": "integer",
                              "nullable": true,
                              "description": "Cap in MB per UTC calendar month. null = no cap. Enforced as described on the create and update bodies."
                            },
                            "bandwidthPeriod": {
                              "type": "string",
                              "const": "calendar_month_utc"
                            },
                            "maxConnections": {
                              "type": "integer",
                              "description": "Advisory concurrent-connection guideline. Not enforced."
                            },
                            "maxConnectionsEnforced": {
                              "type": "boolean",
                              "const": false
                            }
                          }
                        },
                        "usage": {
                          "type": "object",
                          "properties": {
                            "periodStart": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "periodEnd": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "bandwidthUsedMb": {
                              "type": "integer",
                              "description": "Usage this UTC calendar month, the figure the cap is enforced against."
                            },
                            "bandwidthRemainingMb": {
                              "type": "integer",
                              "nullable": true,
                              "description": "null when there is no cap."
                            }
                          }
                        },
                        "lastUsedAt": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true,
                          "description": "Last authentication. Can trail real use by a few minutes (cached authentications do not restamp it)."
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Cap reached, a bound violated (bandwidthLimitMb below 1024), an unsupported or unknown field, or email not verified.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Another credential change for this account is in progress. Retry.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/sub-users/{id}": {
      "patch": {
        "operationId": "updateSubUser",
        "tags": [
          "Sub-users"
        ],
        "summary": "Update a sub-user's label, limits or status",
        "description": "Requires the `write:credentials` permission on the API key. Any subset of the fields. Changes reach traffic within about 2 minutes (per-replica server caches, the gateways' 30 s cache, the Squid helper's 120 s cache). Enabling counts against the plan's active sub-user cap. Fields that cannot be enforced are refused with a 400 rather than stored: `allowedIps`/`ipWhitelist` (use the account IP whitelist and send the sub-user's username from a whitelisted address), `allowedProducts`/`products`, and `maxConcurrentConnections`/`connectionLimit` (the Rotating Unmetered ceiling is per account). Unknown fields are refused too.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "label": {
                    "type": "string",
                    "nullable": true,
                    "maxLength": 128,
                    "description": "Blank or null clears it."
                  },
                  "bandwidthLimitMb": {
                    "type": "integer",
                    "nullable": true,
                    "minimum": 1024,
                    "description": "Cap in MB per UTC calendar month, at least 1024 (1 GB). null = no cap. Caps are checked against a usage counter the gateways update about every 10 s, through cached auth answers, so they are not a to-the-byte cut-off: expect roughly the login's throughput over 30 s to 2 minutes past the cap, plus bytes inside connections already open. Residential is checked the same way, through the residential gateway's 30 s cache."
                  },
                  "maxConnections": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Advisory only."
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "disabled"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated sub-user.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "username": {
                          "type": "string"
                        },
                        "password": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string",
                          "nullable": true,
                          "description": "Customer-chosen name, e.g. the client. At most 128 characters."
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "active",
                            "disabled",
                            "expired",
                            "over_limit"
                          ],
                          "description": "`over_limit` = this month's bandwidth cap is used up; the login is refused until the cap is raised or the month rolls over."
                        },
                        "limits": {
                          "type": "object",
                          "properties": {
                            "bandwidthLimitMb": {
                              "type": "integer",
                              "nullable": true,
                              "description": "Cap in MB per UTC calendar month. null = no cap. Enforced as described on the create and update bodies."
                            },
                            "bandwidthPeriod": {
                              "type": "string",
                              "const": "calendar_month_utc"
                            },
                            "maxConnections": {
                              "type": "integer",
                              "description": "Advisory concurrent-connection guideline. Not enforced."
                            },
                            "maxConnectionsEnforced": {
                              "type": "boolean",
                              "const": false
                            }
                          }
                        },
                        "usage": {
                          "type": "object",
                          "properties": {
                            "periodStart": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "periodEnd": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "bandwidthUsedMb": {
                              "type": "integer",
                              "description": "Usage this UTC calendar month, the figure the cap is enforced against."
                            },
                            "bandwidthRemainingMb": {
                              "type": "integer",
                              "nullable": true,
                              "description": "null when there is no cap."
                            }
                          }
                        },
                        "lastUsedAt": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true,
                          "description": "Last authentication. Can trail real use by a few minutes (cached authentications do not restamp it)."
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed id, empty update, a bound violated (bandwidthLimitMb below 1024), an unsupported field, or enabling past the cap.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "No such sub-user on this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Enabling while another credential change for this account is in progress. Retry.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteSubUser",
        "tags": [
          "Sub-users"
        ],
        "summary": "Disable (or permanently delete) a sub-user",
        "description": "Requires the `write:credentials` permission on the API key. By default DISABLES the sub-user and keeps the row (re-enable with PATCH `status: active`). Changes reach traffic within about 2 minutes (per-replica server caches, the gateways' 30 s cache, the Squid helper's 120 s cache). With `permanent=true` the sub-user is deleted and its slot freed; the username stays reserved for a grace period so late usage reports are still billed.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "permanent",
            "in": "query",
            "required": false,
            "description": "`true` or `1` (any case) deletes; anything else disables.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Disabled or deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "deleted": {
                          "type": "boolean"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "disabled"
                          ],
                          "description": "Present when disabled rather than deleted."
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed id.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "No such sub-user on this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/sub-users/{id}/usage": {
      "get": {
        "operationId": "getSubUserUsage",
        "tags": [
          "Sub-users"
        ],
        "summary": "A sub-user's usage",
        "description": "Requires the `read:usage` permission on the API key. Per-sub-user traffic is recorded as a running total for the current UTC calendar month (the figure the cap is enforced against). No hourly or daily series exists per sub-user, so `series` is null and `seriesAvailable` false whatever `range` is; account-level hourly data is at GET /usage/bandwidth.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "range",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "current_month",
                "24h",
                "7d",
                "30d"
              ],
              "default": "current_month"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "This month's usage for the sub-user.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "username": {
                          "type": "string"
                        },
                        "requestedRange": {
                          "type": "string"
                        },
                        "resolution": {
                          "type": "string",
                          "const": "calendar_month_utc"
                        },
                        "seriesAvailable": {
                          "type": "boolean",
                          "const": false
                        },
                        "series": {
                          "type": "array",
                          "nullable": true,
                          "items": {
                            "type": "object"
                          }
                        },
                        "period": {
                          "type": "object",
                          "properties": {
                            "start": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "end": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "bandwidthUsedMb": {
                              "type": "integer"
                            },
                            "bandwidthLimitMb": {
                              "type": "integer",
                              "nullable": true
                            },
                            "bandwidthRemainingMb": {
                              "type": "integer",
                              "nullable": true
                            }
                          }
                        },
                        "lastUsedAt": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true
                        },
                        "note": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed id or unknown range.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "No such sub-user on this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/billing/credit": {
      "get": {
        "operationId": "getCreditBalance",
        "tags": [
          "Billing"
        ],
        "summary": "Account credit balance and recent ledger entries",
        "description": "Requires the `read:billing` permission on the API key. The spendable account credit and the most recent credit movements, newest first. Descriptions are fixed labels per entry type.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Credit balance and entries.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "balanceCents": {
                          "type": "integer"
                        },
                        "currency": {
                          "type": "string",
                          "const": "usd"
                        },
                        "entries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "integer"
                              },
                              "type": {
                                "type": "string",
                                "enum": [
                                  "refund",
                                  "proration_credit",
                                  "referral",
                                  "manual_adjustment",
                                  "promo",
                                  "spend",
                                  "credit_release"
                                ]
                              },
                              "amountCents": {
                                "type": "integer",
                                "description": "Positive = credit added, negative = credit used."
                              },
                              "balanceAfterCents": {
                                "type": "integer"
                              },
                              "description": {
                                "type": "string"
                              },
                              "invoiceId": {
                                "type": "integer",
                                "nullable": true
                              },
                              "orderId": {
                                "type": "integer",
                                "nullable": true
                              },
                              "expiresAt": {
                                "type": "string",
                                "format": "date-time",
                                "nullable": true
                              },
                              "createdAt": {
                                "type": "string",
                                "format": "date-time"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/billing/invoices": {
      "get": {
        "operationId": "listInvoices",
        "tags": [
          "Billing"
        ],
        "summary": "List invoices",
        "description": "Requires the `read:billing` permission on the API key. The account's invoices, newest first.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of invoices.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "invoices": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "integer"
                              },
                              "invoiceNumber": {
                                "type": "integer"
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "draft",
                                  "open",
                                  "paid",
                                  "partially_refunded",
                                  "refunded",
                                  "void",
                                  "uncollectible"
                                ]
                              },
                              "billingReason": {
                                "type": "string",
                                "enum": [
                                  "subscription_create",
                                  "subscription_renewal",
                                  "plan_change",
                                  "one_time",
                                  "manual"
                                ]
                              },
                              "currency": {
                                "type": "string"
                              },
                              "subtotalCents": {
                                "type": "integer"
                              },
                              "discountCents": {
                                "type": "integer"
                              },
                              "creditAppliedCents": {
                                "type": "integer"
                              },
                              "taxCents": {
                                "type": "integer"
                              },
                              "totalCents": {
                                "type": "integer"
                              },
                              "amountPaidCents": {
                                "type": "integer"
                              },
                              "amountDueCents": {
                                "type": "integer"
                              },
                              "refundedCents": {
                                "type": "integer"
                              },
                              "subscriptionId": {
                                "type": "integer",
                                "nullable": true
                              },
                              "issuedAt": {
                                "type": "string",
                                "format": "date-time",
                                "nullable": true
                              },
                              "dueAt": {
                                "type": "string",
                                "format": "date-time",
                                "nullable": true
                              },
                              "paidAt": {
                                "type": "string",
                                "format": "date-time",
                                "nullable": true
                              },
                              "voidedAt": {
                                "type": "string",
                                "format": "date-time",
                                "nullable": true
                              },
                              "createdAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "pdfUrl": {
                                "type": "string",
                                "description": "Path of GET /billing/invoices/{id}/pdf for this invoice."
                              }
                            }
                          }
                        },
                        "limit": {
                          "type": "integer"
                        },
                        "offset": {
                          "type": "integer"
                        },
                        "hasMore": {
                          "type": "boolean"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/billing/invoices/{id}/pdf": {
      "get": {
        "operationId": "getInvoicePdf",
        "tags": [
          "Billing"
        ],
        "summary": "Download an invoice as PDF",
        "description": "Requires the `read:billing` permission on the API key. The same PDF as the dashboard's Download button. Only the account's own invoices.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Invoice id, as returned by GET /billing/invoices.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The invoice PDF.",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "The id is not a positive integer.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "No such invoice on this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/alerts": {
      "get": {
        "operationId": "getAlertSettings",
        "tags": [
          "Account"
        ],
        "summary": "Usage alert settings",
        "description": "Requires the `read:subscription` permission on the API key. Which channels fire when bandwidth usage reaches 80% and 100% of the allowance. The in-app notification is always sent.",
        "responses": {
          "200": {
            "description": "Alert settings.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "threshold80Email": {
                          "type": "boolean",
                          "description": "Email when usage reaches 80% of the allowance, and the run-out forecast email (at the recent pace the allowance runs out within 5 days, before renewal)."
                        },
                        "threshold80Webhook": {
                          "type": "boolean",
                          "description": "Webhooks (bandwidth_threshold.warning, usage.threshold_reached) at 80%, and the usage.forecast_runout webhook."
                        },
                        "threshold100Email": {
                          "type": "boolean",
                          "description": "Email when usage reaches 100% of the allowance."
                        },
                        "threshold100Webhook": {
                          "type": "boolean",
                          "description": "Webhooks (bandwidth_threshold.exceeded, usage.threshold_reached) at 100%."
                        },
                        "thresholds": {
                          "type": "array",
                          "items": {
                            "type": "integer"
                          },
                          "description": "Always [80, 100]."
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateAlertSettings",
        "tags": [
          "Account"
        ],
        "summary": "Change usage alert settings",
        "description": "Requires the `write:subscription` permission on the API key. Send only the switches to change; the others keep their values.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "minProperties": 1,
                "properties": {
                  "threshold80Email": {
                    "type": "boolean",
                    "description": "Email when usage reaches 80% of the allowance, and the run-out forecast email (at the recent pace the allowance runs out within 5 days, before renewal)."
                  },
                  "threshold80Webhook": {
                    "type": "boolean",
                    "description": "Webhooks (bandwidth_threshold.warning, usage.threshold_reached) at 80%, and the usage.forecast_runout webhook."
                  },
                  "threshold100Email": {
                    "type": "boolean",
                    "description": "Email when usage reaches 100% of the allowance."
                  },
                  "threshold100Webhook": {
                    "type": "boolean",
                    "description": "Webhooks (bandwidth_threshold.exceeded, usage.threshold_reached) at 100%."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored alert settings.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "threshold80Email": {
                          "type": "boolean",
                          "description": "Email when usage reaches 80% of the allowance, and the run-out forecast email (at the recent pace the allowance runs out within 5 days, before renewal)."
                        },
                        "threshold80Webhook": {
                          "type": "boolean",
                          "description": "Webhooks (bandwidth_threshold.warning, usage.threshold_reached) at 80%, and the usage.forecast_runout webhook."
                        },
                        "threshold100Email": {
                          "type": "boolean",
                          "description": "Email when usage reaches 100% of the allowance."
                        },
                        "threshold100Webhook": {
                          "type": "boolean",
                          "description": "Webhooks (bandwidth_threshold.exceeded, usage.threshold_reached) at 100%."
                        },
                        "thresholds": {
                          "type": "array",
                          "items": {
                            "type": "integer"
                          },
                          "description": "Always [80, 100]."
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Empty body, an unknown field, or a non-boolean value.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key is revoked, or lacks the permission this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. 60 requests per minute per API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/proxies/{id}/replace": {
      "post": {
        "operationId": "replaceProxy",
        "tags": [
          "Proxies"
        ],
        "summary": "Replace a static proxy's IP",
        "description": "Requires the `write:proxies` permission on the API key. Swaps one active static proxy onto a fresh IP from the same product and location, with new credentials. Uses the same monthly allowance as the dashboard's refresh (the plan's IP refreshes per month), counted per calendar month. Raises the proxy.replaced webhook.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Proxy id, as returned by GET /proxies.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The proxy's new address and credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "proxyId": {
                          "type": "integer"
                        },
                        "oldIp": {
                          "type": "string"
                        },
                        "newIp": {
                          "type": "string"
                        },
                        "newPort": {
                          "type": "integer"
                        },
                        "newUsername": {
                          "type": "string"
                        },
                        "newPassword": {
                          "type": "string"
                        },
                        "replacementsUsed": {
                          "type": "integer",
                          "description": "Replacements used this month, including this one."
                        },
                        "replacementLimit": {
                          "type": "integer"
                        }
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The id is not a positive integer.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Free plan, or the plan includes no IP replacements (also: key lacks write:proxies).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "replacementLimit": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "No such proxy on this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "The proxy is not active; another replacement of it is in progress or has just finished (reload GET /proxies); or it cannot be replaced at all because it is not assigned from the IP pool. Nothing was used from the allowance.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "This month's replacements are used up (Retry-After says when they reset), or the per-key rate limit.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "replacementLimit": {
                      "type": "integer"
                    },
                    "resetsAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "No replacement IP is available right now, or replacement is briefly unavailable; retry later. Nothing was used from the allowance.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "bandwidth_threshold.warning": {
      "post": {
        "summary": "bandwidth_threshold.warning",
        "description": "Bandwidth usage reached 80% of the allowance (plan plus anything purchased). Once per billing period, with the alert email; honors the 80% webhook switch in alert settings. Delivered as a POST with headers `X-Node4-Event` (the event name), `X-Node4-Event-Id` (the event id, also in the body as `id`) and `X-Node4-Signature` (the hex HMAC-SHA256 of the raw body, keyed with the webhook's secret). Any 2xx counts as delivered. A 5xx answer or a timeout or connection failure is retried, up to 3 attempts in all (after 1 s, then 2 s); a 3xx or 4xx is final. A retry carries the same event id, as does the same event sent to each of your endpoints, so deduplicate on it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9a-f]{24}$",
                    "description": "Stable event id: the same on every retry and on every endpoint the event is sent to. Deduplicate on it."
                  },
                  "event": {
                    "type": "string",
                    "const": "bandwidth_threshold.warning"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "userId": {
                        "type": "integer"
                      },
                      "threshold": {
                        "type": "integer",
                        "enum": [
                          80,
                          100
                        ]
                      },
                      "percentUsed": {
                        "type": "integer"
                      },
                      "usedMb": {
                        "type": "number"
                      },
                      "limitMb": {
                        "type": "number"
                      },
                      "planName": {
                        "type": "string"
                      },
                      "timestamp": {
                        "type": "string",
                        "format": "date-time"
                      }
                    }
                  },
                  "timestamp": {
                    "type": "integer",
                    "description": "Send time of this attempt, milliseconds since the Unix epoch."
                  }
                },
                "required": [
                  "id",
                  "event",
                  "data",
                  "timestamp"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx to acknowledge the delivery."
          }
        }
      }
    },
    "bandwidth_threshold.exceeded": {
      "post": {
        "summary": "bandwidth_threshold.exceeded",
        "description": "Bandwidth usage reached 100% of the allowance. Once per billing period, with the alert email; honors the 100% webhook switch in alert settings. Delivered as a POST with headers `X-Node4-Event` (the event name), `X-Node4-Event-Id` (the event id, also in the body as `id`) and `X-Node4-Signature` (the hex HMAC-SHA256 of the raw body, keyed with the webhook's secret). Any 2xx counts as delivered. A 5xx answer or a timeout or connection failure is retried, up to 3 attempts in all (after 1 s, then 2 s); a 3xx or 4xx is final. A retry carries the same event id, as does the same event sent to each of your endpoints, so deduplicate on it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9a-f]{24}$",
                    "description": "Stable event id: the same on every retry and on every endpoint the event is sent to. Deduplicate on it."
                  },
                  "event": {
                    "type": "string",
                    "const": "bandwidth_threshold.exceeded"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "userId": {
                        "type": "integer"
                      },
                      "threshold": {
                        "type": "integer",
                        "enum": [
                          80,
                          100
                        ]
                      },
                      "percentUsed": {
                        "type": "integer"
                      },
                      "usedMb": {
                        "type": "number"
                      },
                      "limitMb": {
                        "type": "number"
                      },
                      "planName": {
                        "type": "string"
                      },
                      "timestamp": {
                        "type": "string",
                        "format": "date-time"
                      }
                    }
                  },
                  "timestamp": {
                    "type": "integer",
                    "description": "Send time of this attempt, milliseconds since the Unix epoch."
                  }
                },
                "required": [
                  "id",
                  "event",
                  "data",
                  "timestamp"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx to acknowledge the delivery."
          }
        }
      }
    },
    "connections.limit_reached": {
      "post": {
        "summary": "connections.limit_reached",
        "description": "A Rotating Unmetered plan turned connections away at its concurrent-connection limit in the last 24 hours. At most once a week. Delivered as a POST with headers `X-Node4-Event` (the event name), `X-Node4-Event-Id` (the event id, also in the body as `id`) and `X-Node4-Signature` (the hex HMAC-SHA256 of the raw body, keyed with the webhook's secret). Any 2xx counts as delivered. A 5xx answer or a timeout or connection failure is retried, up to 3 attempts in all (after 1 s, then 2 s); a 3xx or 4xx is final. A retry carries the same event id, as does the same event sent to each of your endpoints, so deduplicate on it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9a-f]{24}$",
                    "description": "Stable event id: the same on every retry and on every endpoint the event is sent to. Deduplicate on it."
                  },
                  "event": {
                    "type": "string",
                    "const": "connections.limit_reached"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "userId": {
                        "type": "integer"
                      },
                      "category": {
                        "type": "string"
                      },
                      "limit": {
                        "type": "integer"
                      },
                      "refused24h": {
                        "type": "integer"
                      },
                      "minutesAtLimit24h": {
                        "type": "integer"
                      }
                    }
                  },
                  "timestamp": {
                    "type": "integer",
                    "description": "Send time of this attempt, milliseconds since the Unix epoch."
                  }
                },
                "required": [
                  "id",
                  "event",
                  "data",
                  "timestamp"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx to acknowledge the delivery."
          }
        }
      }
    },
    "usage.threshold_reached": {
      "post": {
        "summary": "usage.threshold_reached",
        "description": "Bandwidth usage crossed 80% or 100% of the allowance (once per threshold per billing period, with the alert email; honors the threshold's webhook switch). Delivered as a POST with headers `X-Node4-Event` (the event name), `X-Node4-Event-Id` (the event id, also in the body as `id`) and `X-Node4-Signature` (the hex HMAC-SHA256 of the raw body, keyed with the webhook's secret). Any 2xx counts as delivered. A 5xx answer or a timeout or connection failure is retried, up to 3 attempts in all (after 1 s, then 2 s); a 3xx or 4xx is final. A retry carries the same event id, as does the same event sent to each of your endpoints, so deduplicate on it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9a-f]{24}$",
                    "description": "Stable event id: the same on every retry and on every endpoint the event is sent to. Deduplicate on it."
                  },
                  "event": {
                    "type": "string",
                    "const": "usage.threshold_reached"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "threshold": {
                        "type": "integer",
                        "enum": [
                          80,
                          100
                        ]
                      },
                      "percentUsed": {
                        "type": "integer"
                      },
                      "usedMb": {
                        "type": "number"
                      },
                      "limitMb": {
                        "type": "number"
                      },
                      "planName": {
                        "type": "string"
                      },
                      "timestamp": {
                        "type": "string",
                        "format": "date-time"
                      }
                    }
                  },
                  "timestamp": {
                    "type": "integer",
                    "description": "Send time of this attempt, milliseconds since the Unix epoch."
                  }
                },
                "required": [
                  "id",
                  "event",
                  "data",
                  "timestamp"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx to acknowledge the delivery."
          }
        }
      }
    },
    "usage.forecast_runout": {
      "post": {
        "summary": "usage.forecast_runout",
        "description": "At the recent pace (last 7 complete days, at least 2), a metered allowance is estimated to run out within 5 days and before the plan renews. An estimate with a range, not a promise. At most once per subscription per billing period, with the run-out email; not sent when auto top-up is on, at 90% or more, or after the 100% alert; honors the 80% webhook switch. Delivered as a POST with headers `X-Node4-Event` (the event name), `X-Node4-Event-Id` (the event id, also in the body as `id`) and `X-Node4-Signature` (the hex HMAC-SHA256 of the raw body, keyed with the webhook's secret). Any 2xx counts as delivered. A 5xx answer or a timeout or connection failure is retried, up to 3 attempts in all (after 1 s, then 2 s); a 3xx or 4xx is final. A retry carries the same event id, as does the same event sent to each of your endpoints, so deduplicate on it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9a-f]{24}$",
                    "description": "Stable event id: the same on every retry and on every endpoint the event is sent to. Deduplicate on it."
                  },
                  "event": {
                    "type": "string",
                    "const": "usage.forecast_runout"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "subscriptionId": {
                        "type": "integer"
                      },
                      "planName": {
                        "type": "string"
                      },
                      "usedMb": {
                        "type": "number"
                      },
                      "limitMb": {
                        "type": "number"
                      },
                      "percentUsed": {
                        "type": "integer"
                      },
                      "runOutAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "earliestAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "latestAt": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "date-time"
                      },
                      "periodEnd": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "paceMbPerDay": {
                        "type": "number"
                      },
                      "sampleDays": {
                        "type": "integer"
                      },
                      "timestamp": {
                        "type": "string",
                        "format": "date-time"
                      }
                    }
                  },
                  "timestamp": {
                    "type": "integer",
                    "description": "Send time of this attempt, milliseconds since the Unix epoch."
                  }
                },
                "required": [
                  "id",
                  "event",
                  "data",
                  "timestamp"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx to acknowledge the delivery."
          }
        }
      }
    },
    "renewal.failed": {
      "post": {
        "summary": "renewal.failed",
        "description": "A renewal payment failed: the saved card was declined or unusable, PayPal could not collect, or a Bitcoin renewal was not paid before the period ended. Once per failed renewal. Delivered as a POST with headers `X-Node4-Event` (the event name), `X-Node4-Event-Id` (the event id, also in the body as `id`) and `X-Node4-Signature` (the hex HMAC-SHA256 of the raw body, keyed with the webhook's secret). Any 2xx counts as delivered. A 5xx answer or a timeout or connection failure is retried, up to 3 attempts in all (after 1 s, then 2 s); a 3xx or 4xx is final. A retry carries the same event id, as does the same event sent to each of your endpoints, so deduplicate on it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9a-f]{24}$",
                    "description": "Stable event id: the same on every retry and on every endpoint the event is sent to. Deduplicate on it."
                  },
                  "event": {
                    "type": "string",
                    "const": "renewal.failed"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "subscriptionId": {
                        "type": "integer"
                      },
                      "planId": {
                        "type": "integer"
                      },
                      "provider": {
                        "type": "string",
                        "enum": [
                          "card",
                          "paypal",
                          "btcpay"
                        ]
                      },
                      "periodEnd": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "date-time"
                      },
                      "serviceStatus": {
                        "type": "string",
                        "enum": [
                          "paused",
                          "active_until_period_end",
                          "active_during_retries"
                        ]
                      },
                      "timestamp": {
                        "type": "string",
                        "format": "date-time"
                      }
                    }
                  },
                  "timestamp": {
                    "type": "integer",
                    "description": "Send time of this attempt, milliseconds since the Unix epoch."
                  }
                },
                "required": [
                  "id",
                  "event",
                  "data",
                  "timestamp"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx to acknowledge the delivery."
          }
        }
      }
    },
    "proxy.replaced": {
      "post": {
        "summary": "proxy.replaced",
        "description": "A static proxy moved to a new IP, by you (dashboard or API) or automatically after downtime. New credentials are not included; read them from GET /proxies. Delivered as a POST with headers `X-Node4-Event` (the event name), `X-Node4-Event-Id` (the event id, also in the body as `id`) and `X-Node4-Signature` (the hex HMAC-SHA256 of the raw body, keyed with the webhook's secret). Any 2xx counts as delivered. A 5xx answer or a timeout or connection failure is retried, up to 3 attempts in all (after 1 s, then 2 s); a 3xx or 4xx is final. A retry carries the same event id, as does the same event sent to each of your endpoints, so deduplicate on it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9a-f]{24}$",
                    "description": "Stable event id: the same on every retry and on every endpoint the event is sent to. Deduplicate on it."
                  },
                  "event": {
                    "type": "string",
                    "const": "proxy.replaced"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "proxyId": {
                        "type": "integer"
                      },
                      "oldIp": {
                        "type": "string"
                      },
                      "newIp": {
                        "type": "string"
                      },
                      "newPort": {
                        "type": "integer"
                      },
                      "reason": {
                        "type": "string",
                        "enum": [
                          "manual",
                          "auto",
                          "support"
                        ]
                      },
                      "downtimeMinutes": {
                        "type": "integer",
                        "description": "Auto only."
                      },
                      "timestamp": {
                        "type": "string",
                        "format": "date-time"
                      }
                    }
                  },
                  "timestamp": {
                    "type": "integer",
                    "description": "Send time of this attempt, milliseconds since the Unix epoch."
                  }
                },
                "required": [
                  "id",
                  "event",
                  "data",
                  "timestamp"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx to acknowledge the delivery."
          }
        }
      }
    },
    "order.completed": {
      "post": {
        "summary": "order.completed",
        "description": "An order was paid and settled. Delivered as a POST with headers `X-Node4-Event` (the event name), `X-Node4-Event-Id` (the event id, also in the body as `id`) and `X-Node4-Signature` (the hex HMAC-SHA256 of the raw body, keyed with the webhook's secret). Any 2xx counts as delivered. A 5xx answer or a timeout or connection failure is retried, up to 3 attempts in all (after 1 s, then 2 s); a 3xx or 4xx is final. A retry carries the same event id, as does the same event sent to each of your endpoints, so deduplicate on it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9a-f]{24}$",
                    "description": "Stable event id: the same on every retry and on every endpoint the event is sent to. Deduplicate on it."
                  },
                  "event": {
                    "type": "string",
                    "const": "order.completed"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "orderId": {
                        "type": "integer"
                      },
                      "type": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "completed"
                        ]
                      },
                      "amountCents": {
                        "type": "integer"
                      },
                      "currency": {
                        "type": "string"
                      },
                      "description": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "planId": {
                        "type": [
                          "integer",
                          "null"
                        ]
                      },
                      "subscriptionId": {
                        "type": [
                          "integer",
                          "null"
                        ]
                      },
                      "invoiceId": {
                        "type": [
                          "integer",
                          "null"
                        ]
                      },
                      "completedAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "timestamp": {
                        "type": "string",
                        "format": "date-time"
                      }
                    }
                  },
                  "timestamp": {
                    "type": "integer",
                    "description": "Send time of this attempt, milliseconds since the Unix epoch."
                  }
                },
                "required": [
                  "id",
                  "event",
                  "data",
                  "timestamp"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx to acknowledge the delivery."
          }
        }
      }
    }
  }
}