{
  "openapi": "3.1.0",
  "info": {
    "title": "Catmouse Anti-Bot Protocol Solver API",
    "version": "2.0.0",
    "description": "HTTP API of the Catmouse Kasada protocol solver. You fetch the Kasada challenge script (ips.js) yourself, with your own client and your own egress IP, and post its body to POST /Solver/solve; the API returns the base64 /tl request body and the x-kpsdk-* headers to send with it. POST /Solver/cd returns a fresh x-kpsdk-cd value for a protected request. The solver targets one vendor, Kasada; engine is a Kasada device-profile selector (chrome, snkrs, wkw, fl, whatnot-ios, android), not a vendor selector. Authentication is the x-api-key header (keys start with ksk_). Routes, fields and error codes in this document are taken from the server source code; anything the source cannot prove is labelled unverified.\n\nChangelog 2.0.0 (2026-10-10): rewrote the contract from the server source. Removed the engine values kasada_ips, akamai_bmp, datadome, turnstile and funcaptcha and the request fields targetUrl, method and proxy, none of which exist in the server. Removed GET /key/balance and POST /key/billing/oxprocessing/checkout, which the server does not register (404 on the live host). Added GET /Solver/getBalance, GET /v1/client/balance, GET /key/status, GET /key/metrics, the /key/billing/* routes, POST /Solver/tlOutcome and POST /signup. Corrected the request body (ipsBody, tz, tzOffset ...), the response body (payload, headers, ctHeader, dtHeader, imHeader ...) and the error codes.",
    "contact": {
      "name": "Catmouse Engineering",
      "url": "https://catmouse.ai",
      "email": "support@catmouse.ai"
    },
    "license": {
      "name": "Proprietary Commercial API",
      "url": "https://catmouse.ai/legal.html"
    }
  },
  "servers": [
    {
      "url": "https://kasadaapi.catmouse.ai",
      "description": "Production API host used by the reference scripts"
    },
    {
      "url": "https://catmouse.ai",
      "description": "Same service, also reachable on the marketing host: an unauthenticated request returned the same status and body on both hosts (probe 2026-10-10)"
    }
  ],
  "tags": [
    {
      "name": "Solve",
      "description": "Kasada solve and cd generation"
    },
    {
      "name": "Account",
      "description": "Self-service key status, balance and usage"
    },
    {
      "name": "Billing",
      "description": "Crypto top-up helpers (0xProcessing, Binance Pay)"
    },
    {
      "name": "Public",
      "description": "No API key"
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/Solver/solve": {
      "post": {
        "operationId": "solve",
        "tags": [
          "Solve"
        ],
        "summary": "Turn a fetched Kasada ips.js body into a /tl payload and headers",
        "description": "Flow: (1) GET the challenge /fp URL with your own client, keep the x-kpsdk-ct response header and the cookies; (2) read the ips.js URL (and its x-kpsdk-im query value) from the /fp HTML and GET it, keeping the body as UTF-8 text; (3) POST that body here with tz and tzOffset taken from a /locate lookup through the same proxy you will use for the target; (4) POST the base64-decoded payload to the site's /tl with the returned headers, in your own client. The API never contacts the target site. The body is either the flat shape (SolveRequest) or the production envelope {\"kasadaRequest\": {...}} (KasadaEnvelope). Sending PScript with an empty ipsBody (flat shape) or without ips (kasadaRequest) reads a /p.js instead of solving (PScriptRequest). Billing: the per-service price is charged to the USD balance only when a payload is actually returned; failed and refused requests are not charged. Request bodies up to 16 MiB are accepted, and content-encoding gzip, deflate, br and zstd request bodies are decompressed.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SolveRequest"
                  },
                  {
                    "$ref": "#/components/schemas/KasadaEnvelope"
                  },
                  {
                    "$ref": "#/components/schemas/PScriptRequest"
                  }
                ]
              },
              "example": {
                "ipsBody": "<contents of the ips.js response, as UTF-8 text>",
                "ipsUrl": "https://www.example.com/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/ips.js?x-kpsdk-v=j-1.2.661&x-kpsdk-im=ZXhhbXBsZQ",
                "ctToken": "<x-kpsdk-ct response header of the /fp request>",
                "kpsdkV": "j-1.2.661",
                "tz": "America/New_York",
                "tzOffset": 240,
                "acceptLanguage": "en-US",
                "engine": "chrome"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Payload built. success is true. On the Chrome/web engine, check mapped: identified < total was observed to fail live (instrument-only measurement in the server source, n=144, one SDK version).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SolveResponse"
                },
                "example": {
                  "success": true,
                  "payload": "<base64 of the /tl request body>",
                  "headers": {
                    "x-kpsdk-ct": "<ct>",
                    "x-kpsdk-dt": "<dt>",
                    "x-kpsdk-im": "<im>",
                    "x-kpsdk-v": "j-1.2.661"
                  },
                  "ctHeader": "<ct>",
                  "dtHeader": "<dt>",
                  "imHeader": "<im>",
                  "id": "<solve id>",
                  "genPath": "<generation path label>",
                  "mapped": "<identified>/<total>",
                  "cost": 0.003
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SolveBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/SolveUnauthorized"
          },
          "402": {
            "$ref": "#/components/responses/InsufficientBalance"
          },
          "403": {
            "$ref": "#/components/responses/SolveForbidden"
          },
          "413": {
            "$ref": "#/components/responses/FrameworkError"
          },
          "415": {
            "$ref": "#/components/responses/FrameworkError"
          },
          "422": {
            "$ref": "#/components/responses/SolveUnprocessable"
          },
          "500": {
            "$ref": "#/components/responses/SolveServerError"
          },
          "503": {
            "$ref": "#/components/responses/SolveBusy"
          },
          "504": {
            "$ref": "#/components/responses/SolveTimeout"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/Solver/cd": {
      "post": {
        "operationId": "cd",
        "tags": [
          "Solve"
        ],
        "summary": "Generate a fresh x-kpsdk-cd value",
        "description": "Returns the exact x-kpsdk-cd header value for a protected request. Generate one per protected action, immediately before sending it; a reused or early-generated value is rejected by Kasada. Proof-of-work parameters come from a pscript you send (the site's /p.js source) or from a per-host cache the server keeps warm for operator-configured hosts; the server makes no outbound request on your behalf. The same handler also answers on the alias path /cd. Requires the cd service on the key (403 service_not_enabled otherwise) and is charged to the key's USD balance at the cd price.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CdRequest"
              },
              "example": {
                "host": "www.example.com",
                "platform": "web",
                "ct": "<x-kpsdk-ct of the session, at least 16 characters>"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "cd generated. Diagnostic fields (kpsdkVersion, cdFields, paramsSource, paramsAgeSec) are returned to first-party callers only; a customer key receives success, host, platform and cd.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CdResponse"
                },
                "example": {
                  "success": true,
                  "host": "www.example.com",
                  "platform": "web",
                  "cd": "<x-kpsdk-cd header value, verbatim>"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CdError"
          },
          "401": {
            "$ref": "#/components/responses/CdError"
          },
          "402": {
            "$ref": "#/components/responses/CdError"
          },
          "403": {
            "$ref": "#/components/responses/CdError"
          },
          "422": {
            "$ref": "#/components/responses/CdError"
          },
          "500": {
            "$ref": "#/components/responses/CdError"
          },
          "503": {
            "$ref": "#/components/responses/CdError"
          },
          "504": {
            "$ref": "#/components/responses/CdError"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/Solver/getBalance": {
      "get": {
        "operationId": "getBalance",
        "tags": [
          "Account"
        ],
        "summary": "USD balance of the calling key",
        "description": "The key is a USD wallet: every service is charged in dollars at its per-service price. Returns the spendable balance in dollars and micro-USD; an unlimited key reports unlimited true with null balances. Does not charge anything.",
        "responses": {
          "200": {
            "description": "Balance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Balance"
                },
                "example": {
                  "unlimited": false,
                  "balanceUsd": 3,
                  "balanceMicroUsd": 3000000,
                  "costPerSolveUsd": 0.003,
                  "costPer1kUsd": 3,
                  "usageCount": 0,
                  "cdUsageCount": 0
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/KeyInvalid"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/v1/client/balance": {
      "get": {
        "operationId": "clientBalance",
        "tags": [
          "Account"
        ],
        "summary": "Balance, rates and top-up info for the calling key",
        "description": "The same handler also answers on the alias path /api/v1/client/balance. The key may be sent as x-api-key, as Authorization: Bearer, or as a key query parameter (discouraged: query strings are logged by proxies). The rates and activeServices objects contain entries for cd, hcap, px and tmx that are static platform-default figures hard-coded in the handler; their presence does not prove those services are available on this API.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Balance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClientBalance"
                },
                "example": {
                  "keyId": "<key id>",
                  "label": "<label>",
                  "prefix": "ksk_",
                  "status": "active",
                  "balance": {
                    "balanceUsd": 3,
                    "balanceMicroUsd": 3000000,
                    "usageCount": 0,
                    "unlimited": false
                  },
                  "rates": {
                    "kasada": {
                      "usdPerSolve": 0.003,
                      "usdPer1k": 3,
                      "isCustom": false
                    }
                  },
                  "activeServices": {
                    "kasada": true
                  },
                  "recharge": {
                    "topUpUrl": "https://catmouse.ai/app",
                    "supportedMethods": [
                      "0xProcessing Crypto (50+ assets)",
                      "Binance Pay",
                      "Dedicated Static Deposit Addresses"
                    ]
                  }
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key or api_key_invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorMessage"
                },
                "example": {
                  "error": "api_key_invalid",
                  "message": "Invalid or revoked API key."
                }
              }
            }
          }
        }
      }
    },
    "/key/status": {
      "get": {
        "operationId": "keyStatus",
        "tags": [
          "Account"
        ],
        "summary": "USD balance, usage count, expiry and status of the calling key",
        "description": "Self-service. Does not count usage. The balance is exposed as balanceUsd, balanceMicroUsd and unlimited.",
        "responses": {
          "200": {
            "description": "Key record (no secret)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyStatus"
                },
                "example": {
                  "id": "<key id>",
                  "prefix": "ksk_",
                  "label": "<label>",
                  "usageCount": 0,
                  "enabled": true,
                  "status": "active",
                  "costPerSolveUsd": 0.003,
                  "costPer1kUsd": 3,
                  "costIsDefault": true,
                  "cdUsageCount": 0,
                  "balanceUsd": 3,
                  "balanceMicroUsd": 3000000,
                  "unlimited": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/KeyInvalid"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/key/metrics": {
      "get": {
        "operationId": "keyMetrics",
        "tags": [
          "Account"
        ],
        "summary": "Your own usage time series with per-engine and per-host breakdown",
        "description": "Self-service. Does not count usage. Default window: last 24 hours hourly, or last 30 days when step is day. The network block is never returned on this route.",
        "parameters": [
          {
            "name": "step",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day"
              ],
              "default": "hour"
            },
            "description": "Bucket size."
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            },
            "description": "Window start, epoch milliseconds."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            },
            "description": "Window end, epoch milliseconds. Default: now."
          }
        ],
        "responses": {
          "200": {
            "description": "Time series. Beyond the documented top-level fields the object carries further per-key breakdowns that are not specified here.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyMetrics"
                }
              }
            }
          },
          "400": {
            "description": "bad_step, bad_range or range_too_wide",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "bad_step",
                  "allowed": [
                    "hour",
                    "day"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/KeyInvalid"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/key/billing/wallets": {
      "get": {
        "operationId": "billingWallets",
        "tags": [
          "Billing"
        ],
        "summary": "List the static deposit wallets of the calling key",
        "responses": {
          "200": {
            "description": "Wallets (empty list when the upstream lookup fails)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "wallets": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Wallet"
                      }
                    }
                  },
                  "required": [
                    "wallets"
                  ]
                },
                "example": {
                  "wallets": []
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/BillingUnauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/key/billing/create-wallet": {
      "post": {
        "operationId": "billingCreateWallet",
        "tags": [
          "Billing"
        ],
        "summary": "Create a static deposit wallet for the calling key",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "currency": {
                    "type": "string",
                    "default": "USDT (TRC20)",
                    "description": "Currency label as the payment provider names it."
                  }
                }
              },
              "example": {
                "currency": "USDT (TRC20)"
              }
            }
          },
          "description": "Send a JSON object with content-type: application/json. Send {} to accept every default; a missing body or content-type is rejected by the web framework before any default applies."
        },
        "responses": {
          "200": {
            "description": "Wallet",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wallet"
                }
              }
            }
          },
          "400": {
            "description": "Body is not valid JSON. Produced by the web framework: not the JSON error shape and its exact text is unverified.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/BillingUnauthorized"
          },
          "415": {
            "$ref": "#/components/responses/FrameworkError"
          },
          "500": {
            "$ref": "#/components/responses/BillingUpstream"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/key/billing/create-checkout": {
      "post": {
        "operationId": "billingCreateCheckout",
        "tags": [
          "Billing"
        ],
        "summary": "Create a hosted crypto payment session (0xProcessing)",
        "description": "Creates a payment session for the calling key and returns the hosted payment URL. Calling this creates a real payment order at the provider; only call it when you intend to top up. Minimum 3 USD. Credit is applied by the provider's signed webhook after payment, not by this response.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amountUsd": {
                    "type": "number",
                    "minimum": 3,
                    "default": 25
                  },
                  "currency": {
                    "type": "string",
                    "default": "USDT (TRC20)"
                  },
                  "email": {
                    "type": "string",
                    "default": "support@catmouse.ai",
                    "description": "Contact email passed to the provider."
                  }
                }
              },
              "example": {
                "amountUsd": 25,
                "currency": "USDT (TRC20)",
                "email": "billing@example.com"
              }
            }
          },
          "description": "Send a JSON object with content-type: application/json. Send {} to accept every default; a missing body or content-type is rejected by the web framework before any default applies."
        },
        "responses": {
          "200": {
            "description": "Checkout session",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "redirectUrl": {
                      "type": "string"
                    },
                    "id": {},
                    "amountUsd": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "redirectUrl",
                    "id",
                    "amountUsd"
                  ]
                },
                "example": {
                  "redirectUrl": "<hosted payment URL>",
                  "id": "<provider payment id>",
                  "amountUsd": 25
                }
              }
            }
          },
          "400": {
            "description": "minimum_recharge_is_3_usd",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "minimum_recharge_is_3_usd"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/BillingUnauthorized"
          },
          "415": {
            "$ref": "#/components/responses/FrameworkError"
          },
          "500": {
            "$ref": "#/components/responses/BillingUpstream"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/key/billing/binance-pay": {
      "post": {
        "operationId": "billingBinancePay",
        "tags": [
          "Billing"
        ],
        "summary": "Create a Binance Pay deposit session",
        "description": "Creates a real deposit order at the provider; only call it when you intend to top up. No minimum is enforced by this handler (the provider may enforce one).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "number",
                    "default": 25
                  },
                  "email": {
                    "type": "string",
                    "default": "support@catmouse.ai"
                  }
                }
              },
              "example": {
                "amount": 25,
                "email": "billing@example.com"
              }
            }
          },
          "description": "Send a JSON object with content-type: application/json. Send {} to accept every default; a missing body or content-type is rejected by the web framework before any default applies."
        },
        "responses": {
          "200": {
            "description": "Deposit session",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "qrLink": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "qrContent": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {}
                  }
                },
                "example": {
                  "url": "<pay URL>",
                  "qrLink": "<qr image URL>",
                  "qrContent": "<qr payload>",
                  "id": "<provider id>"
                }
              }
            }
          },
          "400": {
            "description": "Body is not valid JSON. Produced by the web framework: not the JSON error shape and its exact text is unverified.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/BillingUnauthorized"
          },
          "415": {
            "$ref": "#/components/responses/FrameworkError"
          },
          "500": {
            "$ref": "#/components/responses/BillingUpstream"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/Solver/tlOutcome": {
      "post": {
        "operationId": "tlOutcome",
        "tags": [
          "Solve"
        ],
        "summary": "Report the outcome of your /tl request (optional telemetry)",
        "description": "Fire-and-forget telemetry. The same handler also answers on the alias path /Solver/tl-report. Always answers 202 {\"ok\":true}, including for an invalid body, an unknown key or a rate-limited key, so a client can never distinguish stored from refused. Body limit 4 KiB. The key may be omitted. Fields are clamped server-side; the full field list is in the server source (tlreport.rs) and only the commonly sent ones are listed here.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {}
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "solveId": {
                    "type": "string"
                  },
                  "engine": {
                    "type": "string"
                  },
                  "genPath": {
                    "type": "string"
                  },
                  "host": {
                    "type": "string"
                  },
                  "tlHttpStatus": {
                    "type": "integer"
                  },
                  "outcome": {
                    "type": "string"
                  },
                  "attempt": {
                    "type": "integer"
                  }
                }
              },
              "example": {
                "solveId": "<id from the solve response>",
                "engine": "chrome",
                "host": "www.example.com",
                "tlHttpStatus": 200,
                "attempt": 1
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted (always)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            }
          }
        }
      }
    },
    "/signup": {
      "post": {
        "operationId": "signup",
        "tags": [
          "Public"
        ],
        "summary": "Request an API key",
        "description": "Records a key request; it never issues a key. Issuance is a manual step after review, and the key is sent by email. Public, rate limited per source, body limit 64 KiB.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "maxLength": 254
                  },
                  "company": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "useCase": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "volume": {
                    "type": "string",
                    "maxLength": 80
                  },
                  "chatPlatform": {
                    "type": "string"
                  },
                  "chatHandle": {
                    "type": "string",
                    "maxLength": 40
                  }
                }
              },
              "example": {
                "email": "you@example.com",
                "company": "Example Co",
                "useCase": "Describe the authorized use case",
                "volume": "10k/month"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Request recorded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "chatHandleRejected": {
                      "type": "boolean",
                      "description": "Present and true when the optional chat handle was not kept; the request itself was recorded."
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "message": "request received — we will email your key"
                }
              }
            }
          },
          "400": {
            "description": "invalid_json or a validation code",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "ok": false,
                  "error": "invalid_json"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "ok": false,
                  "error": "rate_limited"
                }
              }
            }
          },
          "503": {
            "description": "not_recorded: nothing was persisted or notified; fall back to email.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "ok": false,
                  "error": "not_recorded"
                }
              }
            }
          }
        }
      }
    },
    "/status.json": {
      "get": {
        "operationId": "statusJson",
        "tags": [
          "Public"
        ],
        "summary": "Measured check results",
        "description": "Public endpoint returning the results of Catmouse's own scheduled checks: how many checks ran, how many passed, API latency, and one row per surface and site. These are measured check results, not an availability guarantee. Cached for 15 seconds; CORS open (access-control-allow-origin: *).",
        "security": [],
        "responses": {
          "200": {
            "description": "Status document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusDocument"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "Catmouse API key (starts with ksk_). First-party clients may use x-key; customers use x-api-key."
      },
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Accepted by GET /v1/client/balance only."
      }
    },
    "schemas": {
      "SolveRequest": {
        "type": "object",
        "description": "Flat solve request. Field names are camelCase. Unknown fields are ignored (no strict validation). Several string fields tolerate non-string JSON by treating it as absent.",
        "required": [
          "ipsBody",
          "tz",
          "tzOffset"
        ],
        "properties": {
          "ipsBody": {
            "type": "string",
            "description": "Body of the Kasada ips.js you fetched, as UTF-8 text. Base64 of that text is also accepted and auto-detected. Must look like a Kasada script: an HTML block page, a URL or a non-Kasada payload is rejected with 400 invalid ipsBody. A truncated upload is rejected with 400 truncated ips body."
          },
          "ipsUrl": {
            "type": "string",
            "description": "The full URL the ips.js was fetched from. Preferred way to tell the solver the target host; its x-kpsdk-im query value is used when imHeader is absent."
          },
          "ipsTransferSize": {
            "type": "integer",
            "minimum": 0,
            "description": "Content-encoded size (content-length) of the ips.js response, used as the resource-timing transferSize. Aliases: ips_transfer_size, transfer_size, ips_content_length, ipsContentLength."
          },
          "ctToken": {
            "type": "string",
            "description": "x-kpsdk-ct from the /fp response."
          },
          "imHeader": {
            "type": "string",
            "description": "x-kpsdk-im from the ips.js URL."
          },
          "kpsdkV": {
            "type": "string",
            "description": "x-kpsdk-v the challenge declares, for example j-1.2.661. The prefix is authoritative for engine routing: a- is Android, i- is native iOS, j- and v- are web."
          },
          "tz": {
            "type": "string",
            "description": "IANA timezone of the proxy exit IP, for example Asia/Seoul. Required: production runs with the geo gate on and answers 400 missing geo without tz and tzOffset."
          },
          "tzOffset": {
            "type": "integer",
            "description": "Timezone offset in minutes, JS getTimezoneOffset sign (America/New_York in summer is 240). Required together with tz."
          },
          "tzLong": {
            "type": "string",
            "description": "Long zone display name, for example Eastern Daylight Time, from the /locate lookup."
          },
          "ip": {
            "type": "string",
            "description": "Client IP, recorded and not resolved. A credentialed proxy URL is tolerated but redacted in logs; do not send credentials."
          },
          "acceptLanguage": {
            "type": "string",
            "default": "en-US"
          },
          "engine": {
            "type": "string",
            "description": "Kasada device-profile selector, case-insensitive. Unknown values fall back to chrome. The x-kpsdk-v prefix overrides a label that disagrees with it. Aliases: snkrs, snkrs-ios, ios-snkrs, ios select native iOS (Nike SNKRS class); wkw, accounts-wkw, accounts-wkwebview, wkwebview select iOS WKWebView; fl, fl-ios, footsites, footsites-ios select the Foot Locker iOS app; whatnot-ios, whatnot_ios, ios-whatnot, whatnot-native select the Whatnot iOS app; android, whatnot, chipotle, android-webview select the Android SDK.",
            "enum": [
              "chrome",
              "snkrs",
              "wkw",
              "fl",
              "whatnot-ios",
              "android"
            ],
            "default": "chrome"
          },
          "profile": {
            "type": "string",
            "description": "Used as the engine selector when engine is absent."
          },
          "deviceJson": {
            "type": "string",
            "description": "Optional real passing-device fingerprint bag as a JSON string; overrides the synthesized device."
          },
          "userAgent": {
            "type": "string",
            "description": "Optional UA override. An incoherent UA for the engine is replaced by the engine default."
          },
          "fcHeader": {
            "type": "string",
            "description": "x-kpsdk-fc from /mfc (native SDK only)."
          },
          "hHeader": {
            "type": "string",
            "description": "x-kpsdk-h from /mfc (native SDK only)."
          },
          "dvHeader": {
            "type": "string",
            "description": "x-kpsdk-dv from the client (Android only)."
          },
          "kpsdkDv": {
            "type": "string",
            "description": "Client-computed iOS native dv (kpsdkdv)."
          },
          "deviceCode": {
            "type": "string",
            "description": "Apple hardware model id (native iOS)."
          },
          "osVersion": {
            "type": "string",
            "description": "iOS version (native iOS)."
          },
          "androidAppVersion": {
            "type": "string",
            "description": "The Android app's own version."
          },
          "appVersion": {
            "type": "string",
            "description": "The app's own version, for building a V2 dv on native iOS. Aliases: appversion, app_version."
          },
          "appId": {
            "type": "string",
            "description": "The app's bundle or package id. Aliases: appid, app_id."
          },
          "bmsz": {
            "type": "string",
            "description": "Reserved cookie passthrough."
          },
          "site": {
            "type": "string",
            "description": "Challenge host override, for example api.nike.com. Used when ipsUrl is absent."
          },
          "sessionId": {
            "type": "string",
            "description": "Opaque stable per-account device identity: the same string for every solve of one account, a different one per account. Aliases: session_id, deviceSeed, device_seed. Never send x-kpsdk-ct here."
          },
          "pageOrigin": {
            "type": "string",
            "description": "Origin of the storefront page embedding the challenge iframe (web)."
          },
          "pageUrl": {
            "type": "string",
            "description": "Full URL of that storefront page (web); supersedes pageOrigin for the referrer."
          },
          "cfBeacon": {
            "type": "boolean",
            "description": "True when the embedding page injects Cloudflare Web Analytics (web)."
          },
          "session": {
            "type": "string",
            "enum": [
              "fresh",
              "returning"
            ],
            "default": "fresh",
            "description": "Browsing-session persona. Aliases: sessionState, session_state. Unknown words are ignored."
          },
          "timeline": {
            "$ref": "#/components/schemas/Timeline"
          }
        }
      },
      "Timeline": {
        "type": "object",
        "description": "Opt-in caller-measured challenge timeline, five epoch-ms readings of one client clock. Used only when all five are present, finite and non-decreasing in this order. Chrome/web only. When used, the response carries holdMs.",
        "properties": {
          "fpSentAt": {
            "type": "number"
          },
          "fpDoneAt": {
            "type": "number"
          },
          "ipsSentAt": {
            "type": "number"
          },
          "ipsDoneAt": {
            "type": "number"
          },
          "sentAt": {
            "type": "number"
          }
        }
      },
      "KasadaEnvelope": {
        "type": "object",
        "description": "Production envelope. Selected when the top-level object has a kasadaRequest key. Any other top-level key (for example mode) is ignored. The engine is inferred from site, userAgent and version/vHeader; there is no engine field.",
        "required": [
          "kasadaRequest"
        ],
        "properties": {
          "kasadaRequest": {
            "type": "object",
            "required": [
              "ips",
              "Timezone",
              "TimezoneOffset"
            ],
            "properties": {
              "ips": {
                "type": "string",
                "description": "The ips.js body (UTF-8 text or its base64)."
              },
              "ipsUrl": {
                "type": "string"
              },
              "ipsTransferSize": {
                "type": "integer"
              },
              "ctHeader": {
                "type": "string",
                "description": "x-kpsdk-ct."
              },
              "imHeader": {
                "type": "string"
              },
              "version": {
                "type": "string",
                "description": "x-kpsdk-v. vHeader (aliases vheader, v_header) is used when version is empty."
              },
              "vHeader": {
                "type": "string"
              },
              "site": {
                "type": "string"
              },
              "userAgent": {
                "type": "string"
              },
              "language": {
                "type": "string"
              },
              "Timezone": {
                "type": "string",
                "description": "IANA timezone (Pascal case)."
              },
              "TimezoneOffset": {
                "type": "integer",
                "description": "Minutes (Pascal case)."
              },
              "TimezoneName": {
                "type": "string"
              },
              "ip": {
                "type": "string"
              },
              "bmsz": {
                "type": "string"
              },
              "fcHeader": {
                "type": "string"
              },
              "hHeader": {
                "type": "string"
              },
              "dvHeader": {
                "type": "string"
              },
              "kpsdkdv": {
                "type": "string"
              },
              "deviceCode": {
                "type": "string"
              },
              "osVersion": {
                "type": "string"
              },
              "androidAppVersion": {
                "type": "string"
              },
              "appVersion": {
                "type": "string"
              },
              "appId": {
                "type": "string"
              },
              "sessionId": {
                "type": "string",
                "description": "Alias: deviceSeed."
              },
              "pageOrigin": {
                "type": "string"
              },
              "pageUrl": {
                "type": "string"
              },
              "cfBeacon": {
                "type": "boolean"
              },
              "session": {
                "type": "string"
              },
              "timeline": {
                "$ref": "#/components/schemas/Timeline"
              },
              "PScript": {
                "type": "string",
                "description": "Aliases: pScript, pscript, p_script."
              }
            }
          },
          "mode": {
            "type": [
              "integer",
              "string"
            ],
            "description": "Ignored by the server. The samples send 0."
          }
        }
      },
      "PScriptRequest": {
        "type": "object",
        "description": "PSCRIPT-ONLY mode: PScript present and ipsBody empty. In the flat shape ipsBody must be present and empty (an absent ipsBody is rejected with 400 missing field ipsBody); inside a kasadaRequest envelope the ips field may be omitted. The response carries vHeader and the proof-of-work parameters the /p.js bakes, and no payload. No geo fields are needed. Not charged.",
        "required": [
          "PScript",
          "ipsBody"
        ],
        "properties": {
          "PScript": {
            "type": "string",
            "description": "The site's /p.js source. Aliases: pScript, pscript, p_script."
          },
          "site": {
            "type": "string"
          },
          "ipsUrl": {
            "type": "string"
          },
          "ipsBody": {
            "type": "string",
            "maxLength": 0,
            "description": "Must be present and empty in the flat shape.",
            "example": ""
          }
        }
      },
      "SolveResponse": {
        "type": "object",
        "required": [
          "success",
          "genPath"
        ],
        "properties": {
          "success": {
            "type": "boolean"
          },
          "payload": {
            "type": "string",
            "description": "Base64 of the /tl request body ciphertext. Absent on errors and in PScript-only mode."
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "x-kpsdk-* headers to send with /tl (for example x-kpsdk-ct, x-kpsdk-dt, x-kpsdk-im, x-kpsdk-v; native engines add fc, h, dv)."
          },
          "ctHeader": {
            "type": "string"
          },
          "dtHeader": {
            "type": "string"
          },
          "imHeader": {
            "type": "string"
          },
          "holdMs": {
            "type": "integer",
            "description": "Only for timeline-anchored solves: wait this many milliseconds, then POST /tl."
          },
          "fcHeader": {
            "type": "string"
          },
          "hHeader": {
            "type": "string"
          },
          "dvHeader": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Solve id."
          },
          "genPath": {
            "type": "string",
            "description": "Generation-path label; auth on authentication failures, unknown on request parse failures."
          },
          "error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Error code or message on failure."
          },
          "mapped": {
            "type": "string",
            "description": "identified/total probe naming coverage (diagnostic). Present on every success."
          },
          "vHeader": {
            "type": "string",
            "description": "PScript-only mode: the x-kpsdk-v the /p.js declares."
          },
          "pow": {
            "type": "object",
            "description": "PScript-only mode: lhw, difficulty, subCount, seedSuffix. All four or absent."
          },
          "powError": {
            "type": "string",
            "description": "PScript-only mode: pscript_no_pow when pow is absent."
          },
          "pscript": {
            "type": "object",
            "description": "PScript-only mode: extraction diagnostics."
          },
          "cost": {
            "type": "number",
            "description": "USD charged for this solve. Present only on a successful solve attributed to an external customer key; absent (not 0) otherwise."
          }
        }
      },
      "CdRequest": {
        "type": "object",
        "required": [
          "host",
          "platform"
        ],
        "properties": {
          "host": {
            "type": "string",
            "description": "Protected host, for example www.chewy.com. Lower-cased by the server."
          },
          "platform": {
            "type": "string",
            "enum": [
              "web",
              "ios"
            ],
            "description": "android is refused with 422 cd_platform_unproven. Any other value is 400 invalid_platform."
          },
          "ct": {
            "type": "string",
            "minLength": 16,
            "description": "x-kpsdk-ct of the session; when sent it must be at least 16 characters."
          },
          "pscript": {
            "type": "string",
            "description": "The site's /p.js source; refreshes the per-host cache."
          },
          "st": {
            "type": "integer",
            "description": "Your own timing anchor. Send st and rst together or neither; otherwise the API generates a coherent pair."
          },
          "rst": {
            "type": "integer"
          },
          "telemetry": {
            "type": "string",
            "enum": [
              "real",
              "zeroed",
              "derived"
            ],
            "default": "real"
          },
          "seed": {
            "type": "string",
            "enum": [
              "auto",
              "bare",
              "ct",
              "ct-lhw"
            ],
            "default": "auto"
          },
          "kpsdkVersion": {
            "type": "string",
            "description": "The served x-kpsdk-v; on ios it selects the timing band."
          }
        }
      },
      "CdResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "host": {
            "type": "string"
          },
          "platform": {
            "type": "string"
          },
          "cd": {
            "type": "string",
            "description": "The exact x-kpsdk-cd header value."
          },
          "error": {
            "type": "string",
            "description": "invalid_host, invalid_platform, invalid_ct, invalid_st_rst, invalid_telemetry, invalid_seed, cd_platform_unproven, pjs_host_unwarmed, pjs_warming (503 with Retry-After: 2), pjs_pow_not_found, cd_shape_unproven, cd_busy, cd_timeout, cd_panic, or an auth code."
          }
        }
      },
      "Balance": {
        "type": "object",
        "properties": {
          "unlimited": {
            "type": "boolean",
            "description": "true only for an explicitly unlimited key; both balance fields are null then."
          },
          "balanceUsd": {
            "type": [
              "number",
              "null"
            ],
            "description": "Spendable USD balance in dollars; every service is charged to it at the key's per-service price. null when unlimited."
          },
          "balanceMicroUsd": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The same balance in micro-USD (1 USD = 1,000,000), exact. null when unlimited."
          },
          "costPerSolveUsd": {
            "type": "number",
            "description": "The key's price; the platform default is 0.003 (3000 micro-USD) unless the key has an override."
          },
          "costPer1kUsd": {
            "type": "number"
          },
          "usageCount": {
            "type": "integer",
            "description": "Lifetime solves on this key. A history counter; nothing is limited by it."
          },
          "cdUsageCount": {
            "type": "integer"
          }
        }
      },
      "ClientBalance": {
        "type": "object",
        "properties": {
          "keyId": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "balance": {
            "type": "object",
            "properties": {
              "balanceUsd": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Spendable USD balance in dollars; every service is charged to it at the key's per-service price. null when unlimited."
              },
              "balanceMicroUsd": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "The same balance in micro-USD (1 USD = 1,000,000), exact. null when unlimited."
              },
              "usageCount": {
                "type": "integer"
              },
              "unlimited": {
                "type": "boolean",
                "description": "true only for an explicitly unlimited key; both balance fields are null then."
              }
            }
          },
          "rates": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "usdPerSolve": {
                  "type": "number"
                },
                "usdPer1k": {
                  "type": "number"
                },
                "isCustom": {
                  "type": "boolean"
                }
              }
            }
          },
          "activeServices": {
            "type": "object",
            "additionalProperties": {
              "type": "boolean"
            }
          },
          "recharge": {
            "type": "object",
            "properties": {
              "topUpUrl": {
                "type": "string"
              },
              "supportedMethods": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "KeyStatus": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "createdAt": {
            "type": "integer"
          },
          "expiresAt": {
            "type": [
              "integer",
              "null"
            ]
          },
          "usageCount": {
            "type": "integer"
          },
          "lastUsedAt": {
            "type": [
              "integer",
              "null"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "disabled",
              "expired",
              "insufficient_balance"
            ]
          },
          "internal": {
            "type": "boolean"
          },
          "priceMicroUsd": {
            "type": [
              "integer",
              "null"
            ]
          },
          "costPerSolveUsd": {
            "type": "number"
          },
          "costPer1kUsd": {
            "type": "number"
          },
          "costIsDefault": {
            "type": "boolean"
          },
          "services": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "cdUsageCount": {
            "type": "integer"
          },
          "balanceUsd": {
            "type": [
              "number",
              "null"
            ],
            "description": "Spendable USD balance in dollars; every service is charged to it at the key's per-service price. null when unlimited."
          },
          "rates": {
            "type": "object",
            "description": "Per-service price in USD per call as plain numbers (unlike the {usdPerSolve,isCustom,usdPer1k} objects of GET /v1/client/balance).",
            "properties": {
              "kasada": {
                "type": "number"
              },
              "hcap": {
                "type": "number"
              },
              "cd": {
                "type": "number"
              },
              "px": {
                "type": "number"
              },
              "tmx": {
                "type": "number"
              }
            }
          },
          "hcapUsageCount": {
            "type": "integer",
            "description": "hcap redeemable tokens delivered on this key. A token is charged only when it is returned."
          },
          "hcapPriceMicroUsd": {
            "type": "integer",
            "description": "Effective hcap price per token in micro-USD (one millionth of a dollar)."
          },
          "hcapPriceIsCustom": {
            "type": "boolean",
            "description": "True when the key carries its own hcap price instead of the platform default."
          },
          "servicePrices": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            },
            "description": "Per-service price overrides in micro-USD, keyed by service name (for example hcap)."
          },
          "balanceMicroUsd": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The same balance in micro-USD (1 USD = 1,000,000), exact. null when unlimited."
          },
          "unlimited": {
            "type": "boolean",
            "description": "true only for an explicitly unlimited key; both balance fields are null then."
          }
        }
      },
      "KeyMetrics": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "step": {
            "type": "string"
          },
          "from": {
            "type": "integer"
          },
          "to": {
            "type": "integer"
          },
          "series": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "totals": {
            "type": "object",
            "properties": {
              "ok": {
                "type": "integer"
              },
              "err": {
                "type": "integer"
              },
              "rejected": {
                "type": "integer"
              },
              "total": {
                "type": "integer"
              },
              "errorRatePct": {
                "type": "number"
              },
              "rejectedRatePct": {
                "type": "number"
              },
              "p50Ms": {},
              "p95Ms": {},
              "p99Ms": {},
              "avgMs": {}
            }
          },
          "latency": {
            "type": "object"
          },
          "engines": {
            "type": "object"
          },
          "hosts": {
            "type": "object"
          }
        }
      },
      "Wallet": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "tag": {
            "type": [
              "string",
              "null"
            ]
          },
          "balance": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "currency",
          "address"
        ]
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ]
      },
      "ErrorMessage": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ]
      },
      "StatusDocument": {
        "type": "object",
        "description": "Measured check results. Beyond the listed fields the document carries per-surface and per-site rows and a history array.",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "status": {
            "type": "string"
          },
          "generatedAt": {
            "type": "string"
          },
          "checks": {
            "type": "integer"
          },
          "passed": {
            "type": "integer"
          },
          "passRate": {
            "type": "number"
          },
          "apiLatencyMs": {
            "type": "object",
            "properties": {
              "p50": {
                "type": "number"
              },
              "p95": {
                "type": "number"
              }
            }
          },
          "surfaces": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      }
    },
    "responses": {
      "SolveBadRequest": {
        "description": "400. error is one of: empty ipsBody; invalid ipsBody: expected Kasada ips.js script ...; missing geo: tz and tzOffset are REQUIRED ...; truncated ips body: ... (re-fetch the full script); bad request: <parse error> or bad kasadaRequest: <parse error> (valid JSON, wrong field types); missing host: ... (only when the host gate is enabled, default off). A body that is not valid JSON is rejected by the web framework before the handler with a plain-text body.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SolveResponse"
            },
            "example": {
              "success": false,
              "genPath": "unknown",
              "error": "empty ipsBody"
            }
          }
        }
      },
      "SolveUnauthorized": {
        "description": "401 api_key_missing (no x-api-key) or api_key_invalid (unknown, rotated or deleted key).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SolveResponse"
            },
            "example": {
              "success": false,
              "genPath": "auth",
              "error": "api_key_missing"
            }
          }
        }
      },
      "SolveForbidden": {
        "description": "403 api_key_disabled, api_key_expired, or service_not_enabled (the key was never granted the solve service). Not charged.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SolveResponse"
            },
            "example": {
              "success": false,
              "genPath": "auth",
              "error": "api_key_disabled"
            }
          }
        }
      },
      "SolveUnprocessable": {
        "description": "422. The ips.js body could not be solved (script parse error, failed to find slots, uncertified opcode permutation, invalid fingerprint json, key too short, device-coherence refusal ...). The text is free-form. Not charged. Re-fetch the current script; if it repeats, the vendor script has likely changed and the target is not currently solvable.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SolveResponse"
            },
            "example": {
              "success": false,
              "genPath": "<label>",
              "error": "script parse error: ..."
            }
          }
        }
      },
      "SolveServerError": {
        "description": "500 solver task panicked. Not charged; retry.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SolveResponse"
            },
            "example": {
              "success": false,
              "genPath": "<label>",
              "error": "solver task panicked"
            }
          }
        }
      },
      "SolveBusy": {
        "description": "503 load shedding: max_concurrent_requests_exceeded: N in flight >= ceiling M; solver queue full; solver deadline infeasible; solver admission deadline exceeded. Not charged; retry with backoff. A 503 without this JSON shape comes from the load balancer.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SolveResponse"
            },
            "example": {
              "success": false,
              "genPath": "offline-static",
              "error": "solver queue full"
            }
          }
        }
      },
      "SolveTimeout": {
        "description": "504 solve timed out. Not charged; retry.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SolveResponse"
            },
            "example": {
              "success": false,
              "genPath": "<label>",
              "error": "solve timed out"
            }
          }
        }
      },
      "CdError": {
        "description": "Error. Body is {success:false, error:<code>}. 401 api_key_missing or api_key_invalid; 403 api_key_disabled, api_key_expired or service_not_enabled; 402 insufficient_balance; 400 invalid_host, invalid_platform, invalid_ct, invalid_st_rst, invalid_telemetry, invalid_seed; 422 cd_platform_unproven, pjs_host_unwarmed, pjs_pow_not_found, cd_shape_unproven; 503 pjs_warming (Retry-After: 2) or cd_busy; 504 cd_timeout; 500 cd_panic.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/CdResponse"
            },
            "example": {
              "success": false,
              "error": "invalid_host"
            }
          }
        }
      },
      "KeyInvalid": {
        "description": "401 api_key_invalid. This route answers api_key_invalid for a missing key too.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "api_key_invalid"
            }
          }
        }
      },
      "BillingUnauthorized": {
        "description": "401 missing_api_key or invalid_api_key.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "missing_api_key"
            }
          }
        }
      },
      "BillingUpstream": {
        "description": "500 with the upstream provider's error text in error.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "<upstream error text>"
            }
          }
        }
      },
      "FrameworkError": {
        "description": "413 body larger than 16 MiB after decompression, or 415 missing content-type: application/json. Produced by the web framework: the body is not the JSON error shape and its exact text is unverified.",
        "content": {
          "text/plain": {
            "schema": {
              "type": "string"
            }
          }
        }
      },
      "InsufficientBalance": {
        "description": "402 insufficient_balance: the USD balance on the key is used up. Top up your USD balance through the billing routes or the dashboard.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SolveResponse"
            },
            "example": {
              "success": false,
              "genPath": "auth",
              "error": "insufficient_balance"
            }
          }
        }
      }
    }
  }
}
