{
  "components": {
    "schemas": {
      "AccountDetails": {
        "properties": {
          "active": {
            "type": "boolean"
          },
          "email": {
            "format": "email",
            "type": "string"
          },
          "first_name": {
            "type": "string"
          },
          "last_name": {
            "type": "string"
          },
          "monthly_bandwidth": {
            "type": "number"
          },
          "monthly_bandwidth_limit": {
            "type": "integer"
          },
          "total_bandwidth": {
            "type": "number"
          },
          "total_bandwidth_limit": {
            "type": "integer"
          },
          "username": {
            "type": "string"
          }
        },
        "required": [
          "username",
          "active",
          "monthly_bandwidth",
          "monthly_bandwidth_limit",
          "total_bandwidth",
          "total_bandwidth_limit"
        ],
        "type": "object"
      },
      "BearerToken": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "expires_at": {
            "format": "date-time",
            "nullable": true,
            "type": "string"
          },
          "id": {
            "type": "integer"
          },
          "is_active": {
            "type": "boolean"
          },
          "label": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "label",
          "is_active",
          "expires_at",
          "created_at"
        ],
        "type": "object"
      },
      "BearerTokenCreated": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BearerToken"
          },
          {
            "properties": {
              "token": {
                "type": "string"
              }
            },
            "required": [
              "token"
            ],
            "type": "object"
          }
        ]
      },
      "DomainAddedResponse": {
        "properties": {
          "domain": {
            "type": "string"
          }
        },
        "required": [
          "domain"
        ],
        "type": "object"
      },
      "DomainsResponse": {
        "properties": {
          "domains": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "domains"
        ],
        "type": "object"
      },
      "IpAddedResponse": {
        "properties": {
          "ip": {
            "format": "ipv4",
            "type": "string"
          },
          "label": {
            "type": "string"
          }
        },
        "required": [
          "ip"
        ],
        "type": "object"
      },
      "IpLabel": {
        "properties": {
          "ip": {
            "format": "ipv4",
            "type": "string"
          },
          "label": {
            "type": "string"
          }
        },
        "required": [
          "ip",
          "label"
        ],
        "type": "object"
      },
      "IpsResponse": {
        "properties": {
          "ips": {
            "items": {
              "format": "ipv4",
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "ips"
        ],
        "type": "object"
      },
      "ProxiesResponse": {
        "properties": {
          "proxies": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "proxies"
        ],
        "type": "object"
      },
      "ProxyAddedResponse": {
        "properties": {
          "proxy": {
            "type": "string"
          }
        },
        "required": [
          "proxy"
        ],
        "type": "object"
      },
      "TokensResponse": {
        "properties": {
          "tokens": {
            "items": {
              "$ref": "#/components/schemas/BearerToken"
            },
            "type": "array"
          }
        },
        "required": [
          "tokens"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "basicAuth": {
        "description": "HTTP Basic authentication with parent account credentials",
        "scheme": "basic",
        "type": "http"
      }
    }
  },
  "externalDocs": {
    "description": "ProxyMesh API documentation",
    "url": "https://docs.proxymesh.com/article/8-api"
  },
  "info": {
    "description": "Programmatically manage sub-accounts, authorized IPs and hostnames, proxy ACLs, and bearer tokens. All requests require HTTP Basic authentication with your parent account credentials. See the [human-readable API guide](https://docs.proxymesh.com/article/8-api) for usage details and [error response messages](https://docs.proxymesh.com/article/108-api-error-response-messages).",
    "title": "ProxyMesh Account Management API",
    "version": "1.0.0"
  },
  "openapi": "3.0.3",
  "paths": {
    "/api/geoips/open/": {
      "get": {
        "description": "Returns country-code to IP-count mapping for the open proxy pool.",
        "operationId": "get_geo_ips",
        "parameters": [
          {
            "in": "path",
            "name": "proxy",
            "required": true,
            "schema": {
              "enum": [
                "open",
                "world"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "type": "object"
                }
              }
            },
            "description": "GeoIP counts by country code"
          },
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "400": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Form validation error"
          },
          "401": {
            "description": "Basic authentication failure"
          },
          "402": {
            "description": "Payment required \u2014 upgrade your plan or account limit reached"
          },
          "403": {
            "description": "Forbidden (sub account or wrong parent)"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Get open proxy GeoIP counts"
      }
    },
    "/api/geoips/world/": {
      "get": {
        "description": "Returns country-code to IP-count mapping for the world proxy pool.",
        "operationId": "get_geo_ips",
        "parameters": [
          {
            "in": "path",
            "name": "proxy",
            "required": true,
            "schema": {
              "enum": [
                "open",
                "world"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "type": "object"
                }
              }
            },
            "description": "GeoIP counts by country code"
          },
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "400": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Form validation error"
          },
          "401": {
            "description": "Basic authentication failure"
          },
          "402": {
            "description": "Payment required \u2014 upgrade your plan or account limit reached"
          },
          "403": {
            "description": "Forbidden (sub account or wrong parent)"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Get world proxy GeoIP counts"
      }
    },
    "/api/hostname/add/": {
      "post": {
        "description": "Add a hostname to your authenticated hostname list.",
        "operationId": "add_authorized_hostname",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "properties": {
                  "domain": {
                    "type": "string"
                  },
                  "username": {
                    "description": "Optional sub account username. When omitted, operates on the authenticated parent account.",
                    "type": "string"
                  }
                },
                "required": [
                  "domain"
                ],
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DomainAddedResponse"
                }
              }
            },
            "description": "Hostname added"
          },
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "400": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Form validation error"
          },
          "401": {
            "description": "Basic authentication failure"
          },
          "402": {
            "description": "Payment required \u2014 upgrade your plan or account limit reached"
          },
          "403": {
            "description": "Forbidden (sub account or wrong parent)"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Add authorized hostname"
      }
    },
    "/api/hostname/delete/": {
      "post": {
        "description": "Remove a hostname from your authenticated hostname list.",
        "operationId": "delete_authorized_hostname",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "properties": {
                  "domain": {
                    "type": "string"
                  },
                  "username": {
                    "description": "Optional sub account username. When omitted, operates on the authenticated parent account.",
                    "type": "string"
                  }
                },
                "required": [
                  "domain"
                ],
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Deleted successfully"
          },
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "400": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Form validation error"
          },
          "401": {
            "description": "Basic authentication failure"
          },
          "402": {
            "description": "Payment required \u2014 upgrade your plan or account limit reached"
          },
          "403": {
            "description": "Forbidden (sub account or wrong parent)"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Delete authorized hostname"
      }
    },
    "/api/hostnames/": {
      "get": {
        "description": "List authenticated hostnames for your account or an optional sub account.",
        "operationId": "get_authorized_domains",
        "parameters": [
          {
            "description": "Optional sub account username. When omitted, operates on the authenticated parent account.",
            "in": "query",
            "name": "username",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DomainsResponse"
                }
              }
            },
            "description": "Authorized hostnames"
          },
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "400": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Form validation error"
          },
          "401": {
            "description": "Basic authentication failure"
          },
          "402": {
            "description": "Payment required \u2014 upgrade your plan or account limit reached"
          },
          "403": {
            "description": "Forbidden (sub account or wrong parent)"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Get authorized hostnames"
      }
    },
    "/api/ip/add/": {
      "post": {
        "description": "Add an IP address to your authenticated IP list.",
        "operationId": "add_authorized_ip",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "properties": {
                  "ip": {
                    "format": "ipv4",
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  },
                  "username": {
                    "description": "Optional sub account username. When omitted, operates on the authenticated parent account.",
                    "type": "string"
                  }
                },
                "required": [
                  "ip"
                ],
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IpAddedResponse"
                }
              }
            },
            "description": "IP added"
          },
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "400": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Form validation error"
          },
          "401": {
            "description": "Basic authentication failure"
          },
          "402": {
            "description": "Payment required \u2014 upgrade your plan or account limit reached"
          },
          "403": {
            "description": "Forbidden (sub account or wrong parent)"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Add authorized IP address"
      }
    },
    "/api/ip/delete/": {
      "post": {
        "description": "Remove an IP address from your authenticated IP list.",
        "operationId": "delete_authorized_ip",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "properties": {
                  "ip": {
                    "format": "ipv4",
                    "type": "string"
                  },
                  "username": {
                    "description": "Optional sub account username. When omitted, operates on the authenticated parent account.",
                    "type": "string"
                  }
                },
                "required": [
                  "ip"
                ],
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Deleted successfully"
          },
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "400": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Form validation error"
          },
          "401": {
            "description": "Basic authentication failure"
          },
          "402": {
            "description": "Payment required \u2014 upgrade your plan or account limit reached"
          },
          "403": {
            "description": "Forbidden (sub account or wrong parent)"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Delete authorized IP address"
      }
    },
    "/api/ip_labels/": {
      "get": {
        "description": "List authenticated IP addresses and optional labels.",
        "operationId": "get_authorized_ip_labels",
        "parameters": [
          {
            "description": "Optional sub account username. When omitted, operates on the authenticated parent account.",
            "in": "query",
            "name": "username",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/IpLabel"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Authorized IP addresses with labels"
          },
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "400": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Form validation error"
          },
          "401": {
            "description": "Basic authentication failure"
          },
          "402": {
            "description": "Payment required \u2014 upgrade your plan or account limit reached"
          },
          "403": {
            "description": "Forbidden (sub account or wrong parent)"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Get authorized IP addresses with labels"
      }
    },
    "/api/ips/": {
      "get": {
        "description": "List authenticated IP addresses for your account or an optional sub account.",
        "operationId": "get_authorized_ips",
        "parameters": [
          {
            "description": "Optional sub account username. When omitted, operates on the authenticated parent account.",
            "in": "query",
            "name": "username",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IpsResponse"
                }
              }
            },
            "description": "Authorized IP addresses"
          },
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "400": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Form validation error"
          },
          "401": {
            "description": "Basic authentication failure"
          },
          "402": {
            "description": "Payment required \u2014 upgrade your plan or account limit reached"
          },
          "403": {
            "description": "Forbidden (sub account or wrong parent)"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Get authorized IP addresses"
      }
    },
    "/api/proxies/": {
      "get": {
        "description": "Returns proxy hostnames the authenticated account may use.",
        "operationId": "get_proxies",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProxiesResponse"
                }
              }
            },
            "description": "Authorized proxies"
          },
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "400": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Form validation error"
          },
          "401": {
            "description": "Basic authentication failure"
          },
          "402": {
            "description": "Payment required \u2014 upgrade your plan or account limit reached"
          },
          "403": {
            "description": "Forbidden (sub account or wrong parent)"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Get authorized proxies",
        "x-sub-account-allowed": false
      }
    },
    "/api/proxy/add/": {
      "post": {
        "description": "Authorize a proxy server for your account. Accepts host, full domain, or domain:port. Returns 402 if your plan does not allow more proxies.",
        "operationId": "add_proxy_acl",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "properties": {
                  "proxy": {
                    "type": "string"
                  }
                },
                "required": [
                  "proxy"
                ],
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "402": {
            "description": "Plan does not allow adding more proxies"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Add proxy authorization",
        "x-sub-account-allowed": false
      }
    },
    "/api/proxy/delete/": {
      "post": {
        "description": "Remove authorization for a proxy server. No change if not already authorized.",
        "operationId": "delete_proxy_acl",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "properties": {
                  "proxy": {
                    "type": "string"
                  }
                },
                "required": [
                  "proxy"
                ],
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Deleted successfully"
          },
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "400": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Form validation error"
          },
          "401": {
            "description": "Basic authentication failure"
          },
          "402": {
            "description": "Payment required \u2014 upgrade your plan or account limit reached"
          },
          "403": {
            "description": "Forbidden (sub account or wrong parent)"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Remove proxy authorization",
        "x-sub-account-allowed": false
      }
    },
    "/api/sub/activate/": {
      "post": {
        "description": "Reactivate a previously deactivated sub account.",
        "operationId": "activate_sub",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountDetails"
                }
              }
            },
            "description": "Sub account details"
          },
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "400": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Form validation error"
          },
          "401": {
            "description": "Basic authentication failure"
          },
          "402": {
            "description": "Payment required \u2014 upgrade your plan or account limit reached"
          },
          "403": {
            "description": "Forbidden (sub account or wrong parent)"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Activate sub account",
        "x-sub-account-allowed": false
      }
    },
    "/api/sub/create/": {
      "post": {
        "description": "Create a new sub account with optional bandwidth limits. Returns sub account details on success.",
        "operationId": "create_sub",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "properties": {
                  "email": {
                    "format": "email",
                    "type": "string"
                  },
                  "first_name": {
                    "type": "string"
                  },
                  "last_name": {
                    "type": "string"
                  },
                  "monthly_limit": {
                    "minimum": 0,
                    "type": "integer"
                  },
                  "password": {
                    "type": "string"
                  },
                  "total_limit": {
                    "minimum": 0,
                    "type": "integer"
                  },
                  "username": {
                    "type": "string"
                  }
                },
                "required": [
                  "username"
                ],
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "402": {
            "description": "Sub account limit reached \u2014 upgrade your plan"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Create sub account",
        "x-sub-account-allowed": false
      }
    },
    "/api/sub/deactivate/": {
      "post": {
        "description": "Deactivate a sub account. Proxy requests for deactivated accounts return 402.",
        "operationId": "deactivate_sub",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountDetails"
                }
              }
            },
            "description": "Sub account details"
          },
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "400": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Form validation error"
          },
          "401": {
            "description": "Basic authentication failure"
          },
          "402": {
            "description": "Payment required \u2014 upgrade your plan or account limit reached"
          },
          "403": {
            "description": "Forbidden (sub account or wrong parent)"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Deactivate sub account",
        "x-sub-account-allowed": false
      }
    },
    "/api/sub/delete/": {
      "post": {
        "description": "Permanently delete a sub account and all associated data.",
        "operationId": "delete_sub",
        "responses": {
          "200": {
            "description": "Sub account deleted"
          },
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "400": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Form validation error"
          },
          "401": {
            "description": "Basic authentication failure"
          },
          "402": {
            "description": "Payment required \u2014 upgrade your plan or account limit reached"
          },
          "403": {
            "description": "Forbidden (sub account or wrong parent)"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Delete sub account",
        "x-sub-account-allowed": false
      }
    },
    "/api/sub/edit/": {
      "post": {
        "description": "Edit an existing sub account and update bandwidth limits. The username must belong to your account.",
        "operationId": "edit_sub",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "properties": {
                  "email": {
                    "format": "email",
                    "type": "string"
                  },
                  "first_name": {
                    "type": "string"
                  },
                  "last_name": {
                    "type": "string"
                  },
                  "monthly_limit": {
                    "minimum": 0,
                    "type": "integer"
                  },
                  "password": {
                    "type": "string"
                  },
                  "total_limit": {
                    "minimum": 0,
                    "type": "integer"
                  },
                  "username": {
                    "type": "string"
                  }
                },
                "required": [
                  "username"
                ],
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "402": {
            "description": "Payment required \u2014 upgrade your plan or account limit reached"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Edit sub account",
        "x-sub-account-allowed": false
      }
    },
    "/api/sub/get/": {
      "get": {
        "description": "Look up sub account details including bandwidth usage and limits.",
        "operationId": "get_sub",
        "parameters": [
          {
            "description": "Sub account username",
            "in": "query",
            "name": "username",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "402": {
            "description": "Payment required \u2014 upgrade your plan or account limit reached"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Get sub account details",
        "x-sub-account-allowed": false
      }
    },
    "/api/token/activate/": {
      "post": {
        "description": "Activate a previously deactivated bearer token by ID.",
        "operationId": "activate_token",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "properties": {
                  "id": {
                    "type": "integer"
                  },
                  "username": {
                    "description": "Optional sub account username. When omitted, operates on the authenticated parent account.",
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BearerToken"
                }
              }
            },
            "description": "Bearer token updated"
          },
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "400": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Form validation error"
          },
          "401": {
            "description": "Basic authentication failure"
          },
          "402": {
            "description": "Payment required \u2014 upgrade your plan or account limit reached"
          },
          "403": {
            "description": "Forbidden (sub account or wrong parent)"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Activate bearer token"
      }
    },
    "/api/token/create/": {
      "post": {
        "description": "Create a new bearer token. The raw token value is returned once in the response.",
        "operationId": "create_token",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "properties": {
                  "expires_at": {
                    "format": "date-time",
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  },
                  "username": {
                    "description": "Optional sub account username. When omitted, operates on the authenticated parent account.",
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "402": {
            "description": "Maximum bearer tokens reached or plan does not support bearer tokens"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Create bearer token"
      }
    },
    "/api/token/deactivate/": {
      "post": {
        "description": "Deactivate a bearer token by ID.",
        "operationId": "deactivate_token",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "properties": {
                  "id": {
                    "type": "integer"
                  },
                  "username": {
                    "description": "Optional sub account username. When omitted, operates on the authenticated parent account.",
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BearerToken"
                }
              }
            },
            "description": "Bearer token updated"
          },
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "400": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Form validation error"
          },
          "401": {
            "description": "Basic authentication failure"
          },
          "402": {
            "description": "Payment required \u2014 upgrade your plan or account limit reached"
          },
          "403": {
            "description": "Forbidden (sub account or wrong parent)"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Deactivate bearer token"
      }
    },
    "/api/token/delete/": {
      "post": {
        "description": "Permanently delete a bearer token by ID.",
        "operationId": "delete_token",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "properties": {
                  "id": {
                    "type": "integer"
                  },
                  "username": {
                    "description": "Optional sub account username. When omitted, operates on the authenticated parent account.",
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Bearer token deleted"
          },
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "400": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Form validation error"
          },
          "401": {
            "description": "Basic authentication failure"
          },
          "402": {
            "description": "Payment required \u2014 upgrade your plan or account limit reached"
          },
          "403": {
            "description": "Forbidden (sub account or wrong parent)"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Delete bearer token"
      }
    },
    "/api/tokens/": {
      "get": {
        "description": "List bearer tokens for your account. Requires ProxyMesh 20 or higher.",
        "operationId": "get_tokens",
        "parameters": [
          {
            "description": "Optional sub account username. When omitted, operates on the authenticated parent account.",
            "in": "query",
            "name": "username",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "HTTP request when HTTPS is required"
          },
          "402": {
            "description": "Plan does not support bearer tokens"
          },
          "404": {
            "description": "Sub account not found"
          },
          "405": {
            "description": "Wrong HTTP method"
          },
          "500": {
            "description": "Server error"
          },
          "503": {
            "description": "Unable to look up subscription plan \u2014 try again later"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "List bearer tokens"
      }
    }
  },
  "security": [
    {
      "basicAuth": []
    }
  ],
  "servers": [
    {
      "description": "Production",
      "url": "https://proxymesh.com"
    }
  ]
}
