{
  "openapi": "3.1.0",
  "info": {
    "title": "Peel API",
    "version": "0.1.0",
    "description": "Public Peel API for creating APIs from URLs, inspecting them, calling generated endpoints, revising builds, and exporting OpenAPI or MCP definitions."
  },
  "servers": [
    {
      "url": "https://api.peel.sh"
    }
  ],
  "tags": [
    {
      "name": "APIs",
      "description": "Create, list, inspect, revise, rebuild, and export APIs."
    },
    {
      "name": "Account",
      "description": "Credits and account usage surfaces used by REST and MCP clients."
    },
    {
      "name": "Device Auth",
      "description": "CLI browser-login device flow helpers."
    },
    {
      "name": "Endpoint Execution",
      "description": "Execute generated endpoints through a stable API resource."
    },
    {
      "name": "OAuth",
      "description": "OAuth discovery and token flows for hosted MCP clients."
    },
    {
      "name": "MCP",
      "description": "Hosted MCP transport and discovery surface."
    },
    {
      "name": "Marketplace",
      "description": "Discover, install, publish, and explicitly contribute APIs."
    },
    {
      "name": "Execution Jobs",
      "description": "Start, reconnect, answer and cancel owner-scoped host executions."
    },
    {
      "name": "Runs",
      "description": "Every call, batch item and execution you ran, with its outcome and its requests to the site."
    },
    {
      "name": "Files",
      "description": "Encrypted owner-scoped files for declared runtime uploads and downloads."
    },
    {
      "name": "Logins",
      "description": "Saved site logins Peel signs in with for endpoints that need a signed-in session."
    },
    {
      "name": "Webhooks",
      "description": "Signed Standard Webhooks events for builds and execution jobs."
    },
    {
      "name": "Schedules",
      "description": "Run a data endpoint on a schedule and hear when its answer changes."
    }
  ],
  "paths": {
    "/v1/apis/{apiId}/executions": {
      "post": {
        "tags": [
          "Execution Jobs"
        ],
        "summary": "Start an idempotent owned API execution",
        "operationId": "startExecutionJob",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "apiId",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          {
            "in": "header",
            "name": "X-Session-ID",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Target-site session ID returned by a login endpoint. Required for session_required endpoints."
          },
          {
            "in": "header",
            "name": "X-Encryption-Key",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Target-site encryption key returned by a login endpoint. Required with X-Session-ID."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExecutionJobStartInput"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The same durable job is returned for an identical idempotency key and execution fingerprint.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionJob"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/executions/{id}": {
      "get": {
        "tags": [
          "Execution Jobs"
        ],
        "summary": "Reconnect to an owned execution",
        "operationId": "getExecutionJob",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current job state, named question or completed result. Lost browser ownership is unknown and cannot automatically resume.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionJob"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runs": {
      "get": {
        "tags": [
          "Runs"
        ],
        "summary": "List your runs, newest first",
        "operationId": "listRuns",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "api_id",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One row per call, batch item or execution. Never holds inputs, results or secrets.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "runs",
                    "next_cursor"
                  ],
                  "properties": {
                    "runs": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Run"
                      }
                    },
                    "next_cursor": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/runs/{run_id}": {
      "get": {
        "tags": [
          "Runs"
        ],
        "summary": "Get a run and its log",
        "operationId": "getRun",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The run and the last 32 requests it made to the site. A request has its method, origin, path without the query, and status; any input or secret value in the path reads as …",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "run"
                  ],
                  "properties": {
                    "run": {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/Run"
                        },
                        {
                          "type": "object",
                          "required": [
                            "requests"
                          ],
                          "properties": {
                            "requests": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "required": [
                                  "method",
                                  "origin",
                                  "path",
                                  "status"
                                ],
                                "properties": {
                                  "method": {
                                    "type": "string"
                                  },
                                  "origin": {
                                    "type": "string"
                                  },
                                  "path": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "integer"
                                  }
                                },
                                "additionalProperties": false
                              }
                            }
                          },
                          "additionalProperties": true
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/executions/{id}/input": {
      "post": {
        "tags": [
          "Execution Jobs"
        ],
        "summary": "Answer the exact pending execution question",
        "operationId": "provideExecutionJobInput",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExecutionJobAnswerInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The matching answer is encrypted, consumed once and removed. Stale question IDs are rejected.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionJob"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/executions/{id}/cancel": {
      "post": {
        "tags": [
          "Execution Jobs"
        ],
        "summary": "Cancel an owned execution",
        "operationId": "cancelExecutionJob",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cancellation aborts active work; requests already dispatched may have taken effect.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionJob"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/files": {
      "post": {
        "tags": [
          "Files"
        ],
        "summary": "Store an encrypted runtime file",
        "operationId": "uploadRuntimeFile",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RuntimeFileUpload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Owner-scoped metadata for a file of at most five megabytes, with a fixed expiry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeFile"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/files/uploads": {
      "post": {
        "tags": [
          "Files"
        ],
        "summary": "Get a one-time upload URL for a file of up to 25 MiB",
        "operationId": "createRuntimeFileUpload",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RuntimeFileUploadRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "PUT the raw bytes to upload_url within 15 minutes; the URL works once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeFileUploadUrl"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/public/uploads/{token}": {
      "put": {
        "tags": [
          "Files"
        ],
        "summary": "Upload a file's raw bytes to a one-time upload URL",
        "operationId": "putRuntimeFileUpload",
        "security": [],
        "parameters": [
          {
            "in": "path",
            "name": "token",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The stored file's metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeFile"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/files/{fileId}/content": {
      "get": {
        "tags": [
          "Files"
        ],
        "summary": "Download an owned runtime file's raw bytes",
        "operationId": "getRuntimeFileContent",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "fileId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file's bytes with its stored MIME type.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/files/{fileId}": {
      "get": {
        "tags": [
          "Files"
        ],
        "summary": "Read an owned runtime file",
        "operationId": "getRuntimeFile",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "fileId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "File metadata and base64 bytes for files of at most five megabytes. Other owners and expired files return not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeFileDownload"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "Files"
        ],
        "summary": "Delete an owned runtime file",
        "operationId": "deleteRuntimeFile",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "fileId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "The file was removed and its owner storage slot was released."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/.well-known/oauth-authorization-server": {
      "get": {
        "tags": [
          "OAuth"
        ],
        "summary": "Get OAuth authorization-server metadata",
        "operationId": "getOAuthAuthorizationServerMetadataPublic",
        "responses": {
          "200": {
            "description": "Authorization-server discovery document.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/oauth-protected-resource": {
      "get": {
        "tags": [
          "OAuth"
        ],
        "summary": "Get OAuth protected resource metadata",
        "operationId": "getOAuthProtectedResourceMetadataPublic",
        "responses": {
          "200": {
            "description": "Protected resource metadata for the hosted MCP server.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/oauth-protected-resource/mcp": {
      "get": {
        "tags": [
          "OAuth"
        ],
        "summary": "Get MCP-scoped protected resource metadata",
        "operationId": "getOAuthProtectedResourceMetadataForMcp",
        "responses": {
          "200": {
            "description": "Protected resource metadata for the `/mcp` endpoint.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/oauth-protected-resource/mcp/apis/{apiId}": {
      "get": {
        "tags": [
          "OAuth"
        ],
        "summary": "Get protected resource metadata for one API's MCP endpoint",
        "operationId": "getOAuthProtectedResourceMetadataForApiMcp",
        "parameters": [
          {
            "in": "path",
            "name": "apiId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Protected resource metadata for `/mcp/apis/{apiId}`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "The API id is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/oauth/register": {
      "post": {
        "tags": [
          "OAuth"
        ],
        "summary": "Register an OAuth client dynamically",
        "operationId": "registerOAuthClientPublic",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "redirect_uris"
                ],
                "properties": {
                  "client_name": {
                    "type": "string"
                  },
                  "redirect_uris": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OAuth client registered.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/oauth/authorize": {
      "get": {
        "tags": [
          "OAuth"
        ],
        "summary": "Start OAuth authorization",
        "operationId": "authorizeOAuthPublicGet",
        "parameters": [
          {
            "in": "query",
            "name": "client_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "redirect_uri",
            "schema": {
              "type": "string",
              "format": "uri"
            }
          },
          {
            "in": "query",
            "name": "code_challenge",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "code_challenge_method",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "scope",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "state",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirects to the consent screen."
          }
        }
      },
      "post": {
        "tags": [
          "OAuth"
        ],
        "summary": "Approve OAuth authorization",
        "operationId": "authorizeOAuthPublicPost",
        "security": [
          {
            "SessionCookieAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "client_id",
                  "code_challenge",
                  "csrf_token",
                  "redirect_uri"
                ],
                "properties": {
                  "client_id": {
                    "type": "string"
                  },
                  "code_challenge": {
                    "type": "string"
                  },
                  "code_challenge_method": {
                    "type": "string",
                    "default": "S256"
                  },
                  "csrf_token": {
                    "type": "string",
                    "description": "The csrf_token GET /oauth/authorize put in the consent URL. It must match the oauth_csrf cookie."
                  },
                  "redirect_uri": {
                    "type": "string",
                    "format": "uri"
                  },
                  "scope": {
                    "type": "string"
                  },
                  "state": {
                    "type": "string"
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "With `Accept: application/json`, the redirect back to the client as JSON instead of a 302.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "redirect"
                  ],
                  "properties": {
                    "redirect": {
                      "type": "string",
                      "format": "uri"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "302": {
            "description": "Redirects back to the client with an authorization code."
          },
          "400": {
            "description": "Invalid request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth.",
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "OAuth bearer challenge with MCP resource metadata when available."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "`access_denied`: the Origin is not Peel's or the CSRF token does not match its cookie.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/oauth/deny": {
      "post": {
        "tags": [
          "OAuth"
        ],
        "summary": "Deny OAuth authorization",
        "description": "Sends the person back to the client with `error=access_denied`. Used by the consent page.",
        "operationId": "denyOAuthPublic",
        "security": [
          {
            "SessionCookieAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "client_id",
                  "csrf_token",
                  "redirect_uri"
                ],
                "properties": {
                  "client_id": {
                    "type": "string"
                  },
                  "csrf_token": {
                    "type": "string",
                    "description": "The csrf_token GET /oauth/authorize put in the consent URL. It must match the oauth_csrf cookie."
                  },
                  "redirect_uri": {
                    "type": "string",
                    "format": "uri"
                  },
                  "state": {
                    "type": "string"
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "With `Accept: application/json`, the redirect back to the client as JSON instead of a 302.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "redirect"
                  ],
                  "properties": {
                    "redirect": {
                      "type": "string",
                      "format": "uri"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "302": {
            "description": "Redirects back to the client with `error=access_denied`."
          },
          "400": {
            "description": "Invalid request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth.",
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "OAuth bearer challenge with MCP resource metadata when available."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "`access_denied`: the Origin is not Peel's or the CSRF token does not match its cookie.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/oauth/token": {
      "post": {
        "tags": [
          "OAuth"
        ],
        "summary": "Exchange an authorization code or refresh token",
        "operationId": "issueOAuthTokenPublic",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            },
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OAuth token response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/oauth/revoke": {
      "post": {
        "tags": [
          "OAuth"
        ],
        "summary": "Revoke an OAuth token",
        "operationId": "revokeOAuthTokenPublic",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            },
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Token revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/mcp": {
      "get": {
        "tags": [
          "MCP"
        ],
        "summary": "Probe the hosted MCP endpoint",
        "operationId": "probeMcpEndpoint",
        "responses": {
          "405": {
            "description": "Peel's MCP endpoints are stateless and take JSON-RPC POST requests only.",
            "headers": {
              "Allow": {
                "schema": {
                  "type": "string"
                },
                "description": "Allowed HTTP methods: POST."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "MCP"
        ],
        "summary": "Delete is not supported for the hosted MCP endpoint",
        "operationId": "deleteMcpEndpointUnsupported",
        "responses": {
          "405": {
            "description": "Peel's MCP endpoints are stateless and take JSON-RPC POST requests only.",
            "headers": {
              "Allow": {
                "schema": {
                  "type": "string"
                },
                "description": "Allowed HTTP methods: POST."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "MCP"
        ],
        "summary": "Call the hosted MCP endpoint",
        "operationId": "postMcpJsonRpcPublic",
        "security": [
          {
            "OAuthBearerAuth": []
          },
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Accept",
            "schema": {
              "type": "string"
            },
            "description": "Should include \"application/json\" and \"text/event-stream\"."
          },
          {
            "in": "header",
            "name": "MCP-Protocol-Version",
            "schema": {
              "type": "string",
              "enum": [
                "2026-07-28",
                "2025-11-25",
                "2025-06-18",
                "2025-03-26",
                "2024-11-05"
              ]
            },
            "description": "2026-07-28 clients call server/discover and need no initialize; when sent, this header and Mcp-Method must match the body. Older clients use the version negotiated by initialize. If omitted, the server falls back to 2025-03-26."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/McpRequest"
              },
              "examples": {
                "initialize": {
                  "summary": "Initialize an MCP session",
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 1,
                    "method": "initialize",
                    "params": {
                      "protocolVersion": "2025-11-25",
                      "capabilities": {},
                      "clientInfo": {
                        "name": "example-client",
                        "version": "1.0.0"
                      }
                    }
                  }
                },
                "listTools": {
                  "summary": "List available tools",
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 2,
                    "method": "tools/list",
                    "params": {}
                  }
                },
                "callEndpoint": {
                  "summary": "Call a Peel endpoint through MCP",
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 3,
                    "method": "tools/call",
                    "params": {
                      "name": "call_endpoint",
                      "arguments": {
                        "api_id": "11111111-1111-4111-8111-111111111111",
                        "endpoint_name": "list_items",
                        "params": {}
                      }
                    }
                  }
                },
                "callSessionEndpoint": {
                  "summary": "Call a session-backed Peel endpoint through MCP",
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 4,
                    "method": "tools/call",
                    "params": {
                      "name": "call_endpoint",
                      "arguments": {
                        "api_id": "11111111-1111-4111-8111-111111111111",
                        "endpoint_name": "list_orders",
                        "params": {
                          "status": "open"
                        },
                        "session_id": "sess_example",
                        "encryption_key": "enc_example"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC result or error envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpJsonRpcResponse"
                }
              }
            }
          },
          "202": {
            "description": "Accepted notification or notification-only request with no response body."
          },
          "400": {
            "description": "Invalid request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth.",
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "OAuth bearer challenge with MCP resource metadata when available."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "406": {
            "description": "The client did not advertise a compatible Accept header.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/v1/logins": {
      "get": {
        "tags": [
          "Logins"
        ],
        "summary": "List saved logins",
        "description": "The site logins Peel signs in with for signed-in endpoints, without their secrets. `sms_available` says whether Peel can rent a phone number for texted codes.",
        "operationId": "listSiteLogins",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Saved logins.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "logins",
                    "sms_available"
                  ],
                  "properties": {
                    "logins": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "origin",
                          "identifier",
                          "fields",
                          "two_factor",
                          "status",
                          "updated_at"
                        ],
                        "properties": {
                          "origin": {
                            "type": "string",
                            "format": "uri"
                          },
                          "identifier": {
                            "type": "string",
                            "description": "The username or email the login signs in with."
                          },
                          "fields": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "two_factor": {
                            "type": "string",
                            "enum": [
                              "none",
                              "authenticator",
                              "code",
                              "sms"
                            ]
                          },
                          "sms_number": {
                            "type": "string",
                            "description": "The Peel phone number that receives the site's texted codes."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "unchecked",
                              "verified",
                              "needs_attention"
                            ]
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "sms_available": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "503": {
            "description": "`site_logins_unavailable`: saved logins are not configured on this server.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Logins"
        ],
        "summary": "Save a login",
        "description": "Saves or replaces the login for the URL's site. Peel encrypts the field values and never returns them. Session only. `two_factor: sms` rents a Peel phone number and needs a paid plan.",
        "operationId": "saveSiteLogin",
        "security": [
          {
            "SessionCookieAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "description": "An authenticator login carries its setup key in `authenticator`. No other login takes one.",
                "oneOf": [
                  {
                    "type": "object",
                    "required": [
                      "url",
                      "fields",
                      "two_factor",
                      "authenticator"
                    ],
                    "properties": {
                      "url": {
                        "type": "string",
                        "format": "uri"
                      },
                      "fields": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "pattern": "^[a-z][a-z0-9_]{0,63}$",
                          "not": {
                            "const": "otp"
                          }
                        },
                        "additionalProperties": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 4096
                        },
                        "minProperties": 1,
                        "maxProperties": 12
                      },
                      "two_factor": {
                        "type": "string",
                        "const": "authenticator"
                      },
                      "authenticator": {
                        "type": "string",
                        "maxLength": 1024
                      }
                    },
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "required": [
                      "url",
                      "fields",
                      "two_factor"
                    ],
                    "properties": {
                      "url": {
                        "type": "string",
                        "format": "uri"
                      },
                      "fields": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "pattern": "^[a-z][a-z0-9_]{0,63}$",
                          "not": {
                            "const": "otp"
                          }
                        },
                        "additionalProperties": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 4096
                        },
                        "minProperties": 1,
                        "maxProperties": 12
                      },
                      "two_factor": {
                        "type": "string",
                        "enum": [
                          "none",
                          "code",
                          "sms"
                        ]
                      }
                    },
                    "additionalProperties": false
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The saved login.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "login"
                  ],
                  "properties": {
                    "login": {
                      "type": "object",
                      "required": [
                        "origin",
                        "identifier",
                        "fields",
                        "two_factor",
                        "status",
                        "updated_at"
                      ],
                      "properties": {
                        "origin": {
                          "type": "string",
                          "format": "uri"
                        },
                        "identifier": {
                          "type": "string",
                          "description": "The username or email the login signs in with."
                        },
                        "fields": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "two_factor": {
                          "type": "string",
                          "enum": [
                            "none",
                            "authenticator",
                            "code",
                            "sms"
                          ]
                        },
                        "sms_number": {
                          "type": "string",
                          "description": "The Peel phone number that receives the site's texted codes."
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "unchecked",
                            "verified",
                            "needs_attention"
                          ]
                        },
                        "updated_at": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "`invalid_login`: the message names the problem.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`sms_requires_paid_plan`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "`site_logins_unavailable`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Logins"
        ],
        "summary": "Delete a saved login",
        "description": "Deletes the login for a site and releases its Peel phone number. Session only.",
        "operationId": "deleteSiteLogin",
        "security": [
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "site",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "description": "The login's site, as a URL."
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "400": {
            "description": "`invalid_login_site`: name the login's site.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "`login_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "`site_logins_unavailable`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/logins/code": {
      "get": {
        "tags": [
          "Logins"
        ],
        "summary": "Get a login's current authenticator code",
        "description": "The current one-time code from the login's saved authenticator key, for signing in by hand. Session only.",
        "operationId": "getSiteLoginCode",
        "security": [
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "site",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "description": "The login's site, as a URL."
          }
        ],
        "responses": {
          "200": {
            "description": "The code and the seconds it stays valid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "expires_in"
                  ],
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "expires_in": {
                      "type": "integer",
                      "minimum": 1
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "`invalid_login_site`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "`authenticator_not_saved`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "`site_logins_unavailable`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List your webhooks",
        "operationId": "listWebhooks",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Your webhooks without their secrets.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "webhooks"
                  ],
                  "properties": {
                    "webhooks": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Webhook"
                      }
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Create a webhook",
        "operationId": "createWebhook",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new webhook with its signing secret. Up to 20 per account; URLs must be public HTTPS.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "webhook"
                  ],
                  "properties": {
                    "webhook": {
                      "$ref": "#/components/schemas/WebhookWithSecret"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/webhooks/{id}": {
      "patch": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Change a webhook's URL, events or status",
        "operationId": "updateWebhook",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookPatch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated webhook.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "webhook"
                  ],
                  "properties": {
                    "webhook": {
                      "$ref": "#/components/schemas/Webhook"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete a webhook",
        "operationId": "deleteWebhook",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "The webhook was deleted."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/webhooks/{id}/test": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Send a webhook.test event now",
        "operationId": "testWebhook",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Whether your endpoint acknowledged the test event with a 2xx.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "delivered"
                  ],
                  "properties": {
                    "delivered": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/webhooks/{id}/rotate-secret": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Replace a webhook's signing secret",
        "operationId": "rotateWebhookSecret",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The webhook with its new signing secret.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "webhook"
                  ],
                  "properties": {
                    "webhook": {
                      "$ref": "#/components/schemas/WebhookWithSecret"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/mcp/keyless": {
      "get": {
        "tags": [
          "MCP"
        ],
        "summary": "Probe the keyless MCP endpoint",
        "operationId": "probeKeylessMcpEndpoint",
        "responses": {
          "405": {
            "description": "Peel's MCP endpoints are stateless and take JSON-RPC POST requests only.",
            "headers": {
              "Allow": {
                "schema": {
                  "type": "string"
                },
                "description": "Allowed HTTP methods: POST."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "MCP"
        ],
        "summary": "Delete is not supported for the keyless MCP endpoint",
        "operationId": "deleteKeylessMcpEndpointUnsupported",
        "responses": {
          "405": {
            "description": "Peel's MCP endpoints are stateless and take JSON-RPC POST requests only.",
            "headers": {
              "Allow": {
                "schema": {
                  "type": "string"
                },
                "description": "Allowed HTTP methods: POST."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "MCP"
        ],
        "summary": "Call the keyless MCP endpoint: marketplace search and public data calls without an account",
        "operationId": "postKeylessMcpJsonRpc",
        "security": [],
        "parameters": [
          {
            "in": "header",
            "name": "Accept",
            "schema": {
              "type": "string"
            },
            "description": "Should include \"application/json\" and \"text/event-stream\"."
          },
          {
            "in": "header",
            "name": "MCP-Protocol-Version",
            "schema": {
              "type": "string",
              "enum": [
                "2026-07-28",
                "2025-11-25",
                "2025-06-18",
                "2025-03-26",
                "2024-11-05"
              ]
            },
            "description": "2026-07-28 clients call server/discover and need no initialize; when sent, this header and Mcp-Method must match the body. Older clients use the version negotiated by initialize. If omitted, the server falls back to 2025-03-26."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/McpRequest"
              },
              "examples": {
                "initialize": {
                  "summary": "Initialize an MCP session",
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 1,
                    "method": "initialize",
                    "params": {
                      "protocolVersion": "2025-11-25",
                      "capabilities": {},
                      "clientInfo": {
                        "name": "example-client",
                        "version": "1.0.0"
                      }
                    }
                  }
                },
                "listTools": {
                  "summary": "List available tools",
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 2,
                    "method": "tools/list",
                    "params": {}
                  }
                },
                "callEndpoint": {
                  "summary": "Call a Peel endpoint through MCP",
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 3,
                    "method": "tools/call",
                    "params": {
                      "name": "call_endpoint",
                      "arguments": {
                        "api_id": "11111111-1111-4111-8111-111111111111",
                        "endpoint_name": "list_items",
                        "params": {}
                      }
                    }
                  }
                },
                "callSessionEndpoint": {
                  "summary": "Call a session-backed Peel endpoint through MCP",
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 4,
                    "method": "tools/call",
                    "params": {
                      "name": "call_endpoint",
                      "arguments": {
                        "api_id": "11111111-1111-4111-8111-111111111111",
                        "endpoint_name": "list_orders",
                        "params": {
                          "status": "open"
                        },
                        "session_id": "sess_example",
                        "encryption_key": "enc_example"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC result or error envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpJsonRpcResponse"
                }
              }
            }
          },
          "202": {
            "description": "Accepted notification or notification-only request with no response body."
          },
          "400": {
            "description": "Invalid request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth.",
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "OAuth bearer challenge with MCP resource metadata when available."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "406": {
            "description": "The client did not advertise a compatible Accept header.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/mcp/apis/{apiId}": {
      "get": {
        "tags": [
          "MCP"
        ],
        "summary": "Probe one API's MCP endpoint",
        "operationId": "probeApiMcpEndpoint",
        "parameters": [
          {
            "in": "path",
            "name": "apiId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "405": {
            "description": "Peel's MCP endpoints are stateless and take JSON-RPC POST requests only.",
            "headers": {
              "Allow": {
                "schema": {
                  "type": "string"
                },
                "description": "Allowed HTTP methods: POST."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "MCP"
        ],
        "summary": "Delete is not supported for one API's MCP endpoint",
        "operationId": "deleteApiMcpEndpointUnsupported",
        "parameters": [
          {
            "in": "path",
            "name": "apiId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "405": {
            "description": "Peel's MCP endpoints are stateless and take JSON-RPC POST requests only.",
            "headers": {
              "Allow": {
                "schema": {
                  "type": "string"
                },
                "description": "Allowed HTTP methods: POST."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "MCP"
        ],
        "summary": "Call one API's own MCP server, whose tools are that API's endpoints",
        "operationId": "postApiMcpJsonRpc",
        "security": [
          {
            "OAuthBearerAuth": []
          },
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "apiId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "Accept",
            "schema": {
              "type": "string"
            },
            "description": "Should include \"application/json\" and \"text/event-stream\"."
          },
          {
            "in": "header",
            "name": "MCP-Protocol-Version",
            "schema": {
              "type": "string",
              "enum": [
                "2026-07-28",
                "2025-11-25",
                "2025-06-18",
                "2025-03-26",
                "2024-11-05"
              ]
            },
            "description": "2026-07-28 clients call server/discover and need no initialize; when sent, this header and Mcp-Method must match the body. Older clients use the version negotiated by initialize. If omitted, the server falls back to 2025-03-26."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/McpRequest"
              },
              "examples": {
                "initialize": {
                  "summary": "Initialize an MCP session",
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 1,
                    "method": "initialize",
                    "params": {
                      "protocolVersion": "2025-11-25",
                      "capabilities": {},
                      "clientInfo": {
                        "name": "example-client",
                        "version": "1.0.0"
                      }
                    }
                  }
                },
                "listTools": {
                  "summary": "List available tools",
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 2,
                    "method": "tools/list",
                    "params": {}
                  }
                },
                "callEndpoint": {
                  "summary": "Call a Peel endpoint through MCP",
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 3,
                    "method": "tools/call",
                    "params": {
                      "name": "call_endpoint",
                      "arguments": {
                        "api_id": "11111111-1111-4111-8111-111111111111",
                        "endpoint_name": "list_items",
                        "params": {}
                      }
                    }
                  }
                },
                "callSessionEndpoint": {
                  "summary": "Call a session-backed Peel endpoint through MCP",
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 4,
                    "method": "tools/call",
                    "params": {
                      "name": "call_endpoint",
                      "arguments": {
                        "api_id": "11111111-1111-4111-8111-111111111111",
                        "endpoint_name": "list_orders",
                        "params": {
                          "status": "open"
                        },
                        "session_id": "sess_example",
                        "encryption_key": "enc_example"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC result or error envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpJsonRpcResponse"
                }
              }
            }
          },
          "202": {
            "description": "Accepted notification or notification-only request with no response body."
          },
          "400": {
            "description": "Invalid request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid auth.",
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "OAuth bearer challenge with MCP resource metadata when available."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "406": {
            "description": "The client did not advertise a compatible Accept header.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/public/device/start": {
      "post": {
        "tags": [
          "Device Auth"
        ],
        "summary": "Start CLI browser-login device flow",
        "description": "Creates a short-lived CLI login session and returns the browser verification URL. No API key is required.",
        "operationId": "startDeviceAuth",
        "responses": {
          "200": {
            "description": "Pending device-auth session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeviceAuthStartResponse"
                }
              }
            }
          },
          "503": {
            "description": "Too many pending sessions or unable to create a session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/device/exchange": {
      "post": {
        "tags": [
          "Device Auth"
        ],
        "summary": "Exchange a completed CLI browser-login session",
        "description": "Polls a pending device-auth session and returns an API key after approval in the signed-in browser.",
        "operationId": "exchangeDeviceAuth",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeviceAuthExchangeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Completed device-auth session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeviceAuthExchangeSuccess"
                }
              }
            }
          },
          "400": {
            "description": "`not_ready` until the browser approves, or `invalid_request`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_session`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "410": {
            "description": "`expired`: the session expired. Start again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/device/complete": {
      "post": {
        "tags": [
          "Device Auth"
        ],
        "summary": "Approve a CLI browser-login session",
        "description": "Hands an API key of the signed-in person to the waiting CLI session with this code. Used by the CLI sign-in page. Session only.",
        "operationId": "completeDeviceAuth",
        "security": [
          {
            "SessionCookieAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "user_code",
                  "api_key"
                ],
                "properties": {
                  "user_code": {
                    "type": "string"
                  },
                  "api_key": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Approved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is not the signed-in person's.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "The code is not valid, expired or already used.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "The code was already used.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/access-requests": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Ask for access",
        "description": "Joins the waiting list while sign-up is by invitation. No account or key. At most 120 requests an hour from one address.",
        "operationId": "requestAccess",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "`temporarily_unavailable`: requests are paused.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/account/credits": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Get credit balance",
        "description": "Returns the account run balance (credits), plan, build and run allowances and billing period. Runs and credits are the same unit; the run fields are aliases added for the plan and allowance model.",
        "operationId": "getCredits",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Current credit state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicCreditState"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/account/usage": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "List credit usage",
        "description": "Credit ledger rows, newest first: calls with their API and endpoint, grants, top-ups and refunds. Needs the billing:read permission.",
        "operationId": "listAccountUsage",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 25
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of usage.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "rows",
                    "offset",
                    "limit",
                    "has_more",
                    "next_offset",
                    "prev_offset"
                  ],
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "time",
                          "api",
                          "endpoint",
                          "credits"
                        ],
                        "properties": {
                          "time": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "api": {
                            "type": "string",
                            "description": "The API's name or source URL, or the ledger reference."
                          },
                          "endpoint": {
                            "type": "string",
                            "description": "`/<endpoint>` for a call, else what the row was."
                          },
                          "credits": {
                            "type": "integer",
                            "minimum": 0
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "offset": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "limit": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_offset": {
                      "oneOf": [
                        {
                          "type": "integer"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "prev_offset": {
                      "oneOf": [
                        {
                          "type": "integer"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/account/billing/history": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "List invoices and payments",
        "description": "Stripe invoices and receipts for the account, newest first. Session only.",
        "operationId": "listBillingHistory",
        "security": [
          {
            "SessionCookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Billing history.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "entries"
                  ],
                  "properties": {
                    "entries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "amount",
                          "created",
                          "currency",
                          "number",
                          "status",
                          "download_label",
                          "download_url"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "amount": {
                            "type": "integer",
                            "description": "In the currency's smallest unit."
                          },
                          "created": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "number": {
                            "oneOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "status": {
                            "type": "string"
                          },
                          "download_label": {
                            "oneOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "download_url": {
                            "oneOf": [
                              {
                                "type": "string",
                                "format": "uri"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "additionalProperties": false
                      }
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/account/billing/checkout": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Start a plan checkout",
        "description": "Returns a Stripe Checkout URL for a paid plan. Session only.",
        "operationId": "createPlanCheckout",
        "security": [
          {
            "SessionCookieAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "plan"
                ],
                "properties": {
                  "plan": {
                    "type": "string",
                    "enum": [
                      "pro"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The Stripe Checkout URL.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "url"
                  ],
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/account/billing/topup-checkout": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Start a run pack checkout",
        "description": "Returns a Stripe Checkout URL for a run pack. Run packs do not expire. Session only.",
        "operationId": "createTopupCheckout",
        "security": [
          {
            "SessionCookieAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "pack"
                ],
                "properties": {
                  "pack": {
                    "type": "string",
                    "enum": [
                      "5000",
                      "15000",
                      "50000"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The Stripe Checkout URL.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "url"
                  ],
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/account/billing/portal": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Open the billing portal",
        "description": "Returns a Stripe customer portal URL for changing the plan, card or invoices. Session only.",
        "operationId": "createBillingPortalSession",
        "security": [
          {
            "SessionCookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The Stripe customer portal URL.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "url"
                  ],
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/account/billing/auto-recharge": {
      "put": {
        "tags": [
          "Account"
        ],
        "summary": "Set auto recharge",
        "description": "Buys a run pack when the balance falls below `threshold`, at most `monthly_limit` times a month. Session only.",
        "operationId": "setAutoRecharge",
        "security": [
          {
            "SessionCookieAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "enabled",
                  "pack",
                  "threshold"
                ],
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "pack": {
                    "type": "string",
                    "enum": [
                      "5000",
                      "15000",
                      "50000"
                    ]
                  },
                  "threshold": {
                    "type": "integer",
                    "minimum": 500,
                    "maximum": 49500
                  },
                  "monthly_limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The credit state after the change, without `is_owner`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/team": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Get the team",
        "description": "The owner, the members with their roles, and open invitations of the account you act on. With a session, send `Peel-Account` to act on a team you belong to.",
        "operationId": "getTeam",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Team"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`team_access_denied` or `role_permission_missing`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/team/invites": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Invite someone",
        "description": "Emails a link that works for 7 days, only for that address. Owner or admin, with a session; API keys cannot invite. Inviting an address again replaces its link.",
        "operationId": "inviteTeamMember",
        "security": [
          {
            "SessionCookieAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email",
                  "role"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "role": {
                    "type": "string",
                    "enum": [
                      "admin",
                      "member",
                      "tool"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The invitation, and its link for sending it yourself.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "invite",
                    "invite_url"
                  ],
                  "properties": {
                    "invite": {
                      "$ref": "#/components/schemas/TeamInvite"
                    },
                    "invite_url": {
                      "type": "string",
                      "format": "uri"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`role_permission_missing`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "`team_member_exists`, `team_full` or `team_invites_full`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/team/invites/{id}": {
      "delete": {
        "tags": [
          "Account"
        ],
        "summary": "Revoke an invitation",
        "operationId": "revokeTeamInvite",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "revoked"
                  ],
                  "properties": {
                    "revoked": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/team/members/{user_id}": {
      "patch": {
        "tags": [
          "Account"
        ],
        "summary": "Change a member's role",
        "description": "Applies within 5 seconds.",
        "operationId": "setTeamMemberRole",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "role"
                ],
                "properties": {
                  "role": {
                    "type": "string",
                    "enum": [
                      "admin",
                      "member",
                      "tool"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The member.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamMember"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "Account"
        ],
        "summary": "Remove a member",
        "description": "Applies within 5 seconds.",
        "operationId": "removeTeamMember",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Removed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "removed"
                  ],
                  "properties": {
                    "removed": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/accounts": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "List the accounts you can act on",
        "description": "Your own account first, then each team you are on. Session only.",
        "operationId": "listTeamAccounts",
        "security": [
          {
            "SessionCookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Your accounts.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "accounts"
                  ],
                  "properties": {
                    "accounts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TeamAccount"
                      }
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/accounts/join": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Accept an invitation",
        "description": "Joins the team with the token from the invitation link. The signed-in address must be the invited one, and verified.",
        "operationId": "acceptTeamInvite",
        "security": [
          {
            "SessionCookieAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "token"
                ],
                "properties": {
                  "token": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The team joined.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "account_id",
                    "role"
                  ],
                  "properties": {
                    "account_id": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "admin",
                        "member",
                        "tool"
                      ]
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`invite_email_mismatch` or `email_unverified`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`invite_not_found`: not valid, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/accounts/{account_id}/leave": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Leave a team",
        "operationId": "leaveTeam",
        "security": [
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "account_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Left.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "left"
                  ],
                  "properties": {
                    "left": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/audit-events": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "List the audit log",
        "description": "Who changed what on the account, newest first: API, login, key, webhook and team changes, and MCP tools that change something. Calls and runs are in the runs log instead. Kept 90 days. Needs the team:manage permission.",
        "operationId": "listAuditEvents",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of events.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "events",
                    "next_cursor"
                  ],
                  "properties": {
                    "events": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AuditEvent"
                      }
                    },
                    "next_cursor": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`key_permission_missing` or `role_permission_missing`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "List API keys",
        "description": "Your API keys, newest first. Shows the first characters of each, never the secret. Needs a full-access key.",
        "operationId": "listApiKeys",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Your keys.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "keys"
                  ],
                  "properties": {
                    "keys": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiKey"
                      }
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Create an API key",
        "description": "The secret is in this answer only. access is full, run or read; expires_in_days is 1 to 365, or null for no expiry. api_id limits the key to one API on the account. That key may read that API and call it (call, batch, feedback, executions), read its runs and executions (GET /v1/runs, GET /v1/runs/{id}, GET /v1/executions/{id}, and input and cancel on an execution), and reach GET /v1/quota and marketplace discovery: the GET /public/marketplace routes, which take no key, and the MCP tools get_quota, list_marketplace_apis, get_marketplace_api, search_marketplace_endpoints, search_routes and describe_route. Changing that API (revise, rebuild, repair, rollback, archive, delete, publish, unpublish), marketplace calls and installs, and every other route answer 403 `key_limited_to_api`. Needs a full-access key; a key with more access than the caller's answers 403 `key_access_too_wide`.",
        "operationId": "createApiKey",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "access": {
                    "type": "string",
                    "enum": [
                      "full",
                      "run",
                      "read"
                    ],
                    "default": "full"
                  },
                  "expires_in_days": {
                    "oneOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 365
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "api_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Limit the key to this one API."
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new key and its secret.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssuedApiKey"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`key_access_too_wide`: the new key would have more access than the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`api_not_found`: no API with this api_id on the account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys/{id}/rotate": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Rotate an API key",
        "description": "Makes a new secret with the same name, access, API limit and expiry, and revokes the old key; calls with the old key are refused within 5 seconds. Needs a full-access key.",
        "operationId": "rotateApiKey",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The new key and its secret.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssuedApiKey"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`key_access_too_wide`: the key has more access than the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/keys/{id}": {
      "delete": {
        "tags": [
          "Account"
        ],
        "summary": "Revoke an API key",
        "description": "Calls with the key are refused within 5 seconds. Needs a full-access key.",
        "operationId": "revokeApiKey",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "revoked"
                  ],
                  "properties": {
                    "revoked": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "tags": [
          "Account"
        ],
        "summary": "Rename an API key",
        "operationId": "renameApiKey",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Renamed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "api_key"
                  ],
                  "properties": {
                    "api_key": {
                      "$ref": "#/components/schemas/ApiKey"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/connected-apps": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "List connected apps",
        "description": "The MCP clients you authorized with OAuth, with their scopes and when each last got a token. Always the signed-in person's, even while acting on a team. Session only.",
        "operationId": "listConnectedApps",
        "security": [
          {
            "SessionCookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Connected apps, most recent first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "apps"
                  ],
                  "properties": {
                    "apps": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "client_id",
                          "name",
                          "scopes",
                          "last_token_at"
                        ],
                        "properties": {
                          "client_id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "scopes": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "last_token_at": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "additionalProperties": false
                      }
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/connected-apps/{client_id}": {
      "delete": {
        "tags": [
          "Account"
        ],
        "summary": "Disconnect an app",
        "description": "Revokes every token the app holds for you. Session only.",
        "operationId": "revokeConnectedApp",
        "security": [
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "client_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "revoked"
                  ],
                  "properties": {
                    "revoked": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "`connected_app_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/schedules": {
      "get": {
        "tags": [
          "Schedules"
        ],
        "summary": "List schedules",
        "description": "Your schedules, up to 20, with each one's next run and its last outcome.",
        "operationId": "listSchedules",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Your schedules.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "schedules"
                  ],
                  "properties": {
                    "schedules": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Schedule"
                      }
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "Schedules"
        ],
        "summary": "Create a schedule",
        "description": "Runs a data endpoint that needs no sign-in every 60 to 10080 minutes, first within a minute. Each run counts as a call. When an answer differs from the one before, Peel sends the schedule.changed webhook with the new data (omitted above 64 KB); a failed run sends schedule.failed. Needs run access.",
        "operationId": "createSchedule",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "api_id": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{1,128}$"
                  },
                  "endpoint_name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "params": {
                    "default": {},
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "shape": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "every_minutes": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 10080
                  }
                },
                "required": [
                  "api_id",
                  "endpoint_name",
                  "every_minutes"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new schedule.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "schedule"
                  ],
                  "properties": {
                    "schedule": {
                      "$ref": "#/components/schemas/Schedule"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The account already has 20 schedules.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/schedules/{id}": {
      "delete": {
        "tags": [
          "Schedules"
        ],
        "summary": "Delete a schedule",
        "operationId": "deleteSchedule",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/quota": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Get quota",
        "description": "What is left this period and today: runs, builds and the daily run cap, each with its limit and reset time. A null limit means no limit.",
        "operationId": "getQuota",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Current quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Quota"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "put": {
        "tags": [
          "Account"
        ],
        "summary": "Set the daily run cap and usage emails",
        "description": "Send any of the fields. Runs past daily_run_cap answer 429 quota_exceeded with details.quota daily_runs until midnight UTC; null removes the cap. usage_alerts lists the percentages of the plan's runs at which an email goes out, once each per period; an empty list turns them off. monthly_summary turns the email at the end of each billing period on or off. Needs a full-access key.",
        "operationId": "setQuota",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [],
                "properties": {
                  "daily_run_cap": {
                    "oneOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 1000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "usage_alerts": {
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 100
                    },
                    "maxItems": 5
                  },
                  "monthly_summary": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The quota with the new cap.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Quota"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/public/marketplace": {
      "get": {
        "tags": [
          "Marketplace"
        ],
        "summary": "List public marketplace APIs",
        "operationId": "listMarketplaceApis",
        "parameters": [
          {
            "in": "query",
            "name": "q",
            "schema": {
              "type": "string",
              "maxLength": 120
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 24
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of public marketplace APIs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarketplaceList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          }
        }
      }
    },
    "/public/marketplace/endpoints": {
      "get": {
        "tags": [
          "Marketplace"
        ],
        "summary": "Search endpoint contracts across public marketplace APIs",
        "operationId": "searchMarketplaceEndpoints",
        "parameters": [
          {
            "in": "query",
            "name": "q",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 24
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of matching public marketplace endpoint contracts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarketplaceEndpointSearch"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          }
        }
      }
    },
    "/public/marketplace/{marketplace_id}": {
      "get": {
        "tags": [
          "Marketplace"
        ],
        "summary": "Get public marketplace API detail",
        "operationId": "getMarketplaceApi",
        "parameters": [
          {
            "$ref": "#/components/parameters/MarketplaceId"
          }
        ],
        "responses": {
          "200": {
            "description": "Public marketplace API detail and endpoint contracts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarketplaceDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/marketplace/{marketplace_id}/install": {
      "post": {
        "tags": [
          "Marketplace"
        ],
        "summary": "Install a marketplace API as a private API",
        "operationId": "installMarketplaceApi",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/MarketplaceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The installed private API identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarketplaceInstall"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/marketplace/{marketplace_id}/endpoints/{endpoint_name}:batch": {
      "post": {
        "tags": [
          "Marketplace",
          "Endpoint Execution"
        ],
        "summary": "Run a public marketplace data endpoint on many inputs",
        "description": "Runs one public read endpoint on 1 to 100 inputs and answers once every item has ended, in the order sent. Send `items`, each with an `input` and an optional `key` echoed on its result, or `inputs` for a plain list; fields in `defaults` apply to every item and an item's own fields win. Items run four at a time; each time the site answers 429, 418 or a JSON body saying 429, the batch halves how many run at once. A bad input fails only its item (`input_invalid`). Items not started within 60 seconds end as `not_run` with `batch_timed_out`. Each successful item is charged as one call of that endpoint; failed and unstarted items cost nothing. With `Idempotency-Key`, item i is keyed `<key>:<i>`. Sign-in, signed-in and action endpoints answer 409 `batch_not_allowed`.",
        "operationId": "batchCallMarketplaceEndpoint",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/MarketplaceId"
          },
          {
            "in": "path",
            "name": "endpoint_name",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": "Optional. Item i runs with the key `<key>:<i>`, so repeating the batch repeats no charged item."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "defaults": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "items": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 100,
                    "items": {
                      "type": "object",
                      "required": [],
                      "properties": {
                        "key": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "input": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "inputs": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 100,
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "shape": {
                    "type": "object",
                    "additionalProperties": false,
                    "description": "Reshape the result's rows with no model and no code. Peel checks it against the endpoint's output schema before running and refuses a bad one with 400 `shape_invalid`, uncharged. Steps run in order: where, group_by with aggregate, sort, limit, fields.",
                    "properties": {
                      "rows": {
                        "type": "string",
                        "description": "Path to the list in the result. Defaults to the endpoint's paging list or its only list."
                      },
                      "where": {
                        "type": "array",
                        "maxItems": 20,
                        "items": {
                          "type": "object",
                          "required": [
                            "field",
                            "op"
                          ],
                          "properties": {
                            "field": {
                              "type": "string"
                            },
                            "op": {
                              "type": "string",
                              "enum": [
                                "eq",
                                "ne",
                                "gt",
                                "gte",
                                "lt",
                                "lte",
                                "contains",
                                "in",
                                "exists"
                              ]
                            },
                            "value": {}
                          },
                          "additionalProperties": false
                        }
                      },
                      "group_by": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 5,
                        "items": {
                          "type": "string"
                        }
                      },
                      "aggregate": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "object",
                          "required": [
                            "op"
                          ],
                          "properties": {
                            "op": {
                              "type": "string",
                              "enum": [
                                "count",
                                "sum",
                                "avg",
                                "min",
                                "max"
                              ]
                            },
                            "field": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "sort": {
                        "type": "array",
                        "maxItems": 5,
                        "items": {
                          "type": "object",
                          "required": [
                            "field"
                          ],
                          "properties": {
                            "field": {
                              "type": "string"
                            },
                            "order": {
                              "type": "string",
                              "enum": [
                                "asc",
                                "desc"
                              ]
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "limit": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 10000
                      },
                      "fields": {
                        "oneOf": [
                          {
                            "type": "array",
                            "minItems": 1,
                            "maxItems": 100,
                            "items": {
                              "type": "string"
                            }
                          },
                          {
                            "type": "object",
                            "additionalProperties": {
                              "type": "string"
                            },
                            "description": "Output name to field path"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Every item's result in the order sent. Each item is a call result plus its `key`; `status` is `not_run` for items that never started.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "counts",
                    "credits_charged",
                    "items"
                  ],
                  "properties": {
                    "counts": {
                      "type": "object",
                      "required": [
                        "succeeded",
                        "failed",
                        "not_run"
                      ],
                      "properties": {
                        "succeeded": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "failed": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "not_run": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "additionalProperties": false
                    },
                    "credits_charged": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "status",
                          "status_code",
                          "data",
                          "error",
                          "error_code"
                        ],
                        "additionalProperties": true,
                        "description": "The same fields as a single call's answer, plus `key`.",
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "success",
                              "error",
                              "timeout",
                              "not_run"
                            ]
                          },
                          "status_code": {
                            "oneOf": [
                              {
                                "type": "integer"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "data": {},
                          "error": {
                            "oneOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "error_code": {
                            "oneOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "credits_charged": {
                            "type": "integer",
                            "minimum": 0
                          }
                        }
                      }
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/marketplace/{marketplace_id}/endpoints/{endpoint_name}:call": {
      "post": {
        "tags": [
          "Marketplace",
          "Endpoint Execution"
        ],
        "summary": "Call a public data endpoint from its canonical marketplace version",
        "description": "Works without a key for public data endpoints: at most 25 calls a day per address and 2,000 a day shared by all calls without a key, both reset at midnight UTC, and the answer carries a `notice`. Past either limit the answer is 429 `try_limit_reached` with `Retry-After`; when the limiter cannot answer the call gets 503 `temporarily_unavailable` with `Retry-After`. A signed-in or sign-in endpoint answers 401 `sign_in_required`, and an endpoint that uses files answers 409 `not_executable`. Without a key, `Idempotency-Key` and session headers are ignored, nothing is stored, and every call runs live.",
        "operationId": "callMarketplaceEndpoint",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          },
          {}
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/MarketplaceId"
          },
          {
            "in": "path",
            "name": "endpoint_name",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": "Optional. Scoped to the owner, API and endpoint. A retry with the same key and params is not charged again: a successful response up to 375 KB is stored and replayed with `Idempotent-Replayed: true`; a login response, a larger one or a failed call answers 409 with the recorded outcome (`already_finalized`), and a call still running answers `request_in_progress`. The same key with different params returns 409 `idempotency_key_reused`."
          },
          {
            "in": "header",
            "name": "Peel-Shape",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Optional. A JSON shape (see the batch body's `shape`) applied to this call's result. A bad shape answers 400 `shape_invalid` before the run and costs nothing."
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "description": "Endpoint parameters. The body is the endpoint's input."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical marketplace endpoint execution envelope.",
            "headers": {
              "X-Peel-Credits-Charged": {
                "description": "Runs charged for this execution, in the same units as the credit ledger. Zero when the run did not return a result and was reversed.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-Peel-Credits-Remaining": {
                "description": "Authoritative remaining run balance (credits ledger units) after execution billing.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "Peel-Verified": {
                "description": "The exact program that answered and when it last passed verification: `artifact=<sha256 of the published artifact>; at=<ISO 8601 time>`. The time is the version's publication, or its most recent passing repair check if that is later.",
                "schema": {
                  "type": "string",
                  "pattern": "^artifact=[0-9a-f]{64}; at=.+$"
                }
              },
              "Server-Timing": {
                "description": "Where the call's time went, in milliseconds: `pre` (before the handler), `admit` (resolve and charge), `run` (the program, including the target site) and `settle` (record and finalize).",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicEndpointExecutionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Runtime execution envelope for a target block or policy rejection.",
            "headers": {
              "X-Peel-Credits-Charged": {
                "description": "Runs charged for this execution, in the same units as the credit ledger. Zero when the run did not return a result and was reversed.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-Peel-Credits-Remaining": {
                "description": "Authoritative remaining run balance (credits ledger units) after execution billing.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "Peel-Verified": {
                "description": "The exact program that answered and when it last passed verification: `artifact=<sha256 of the published artifact>; at=<ISO 8601 time>`. The time is the version's publication, or its most recent passing repair check if that is later.",
                "schema": {
                  "type": "string",
                  "pattern": "^artifact=[0-9a-f]{64}; at=.+$"
                }
              },
              "Server-Timing": {
                "description": "Where the call's time went, in milliseconds: `pre` (before the handler), `admit` (resolve and charge), `run` (the program, including the target site) and `settle` (record and finalize).",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicEndpointExecutionResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "description": "Runtime execution envelope for extraction or validation failure.",
            "headers": {
              "X-Peel-Credits-Charged": {
                "description": "Runs charged for this execution, in the same units as the credit ledger. Zero when the run did not return a result and was reversed.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-Peel-Credits-Remaining": {
                "description": "Authoritative remaining run balance (credits ledger units) after execution billing.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "Peel-Verified": {
                "description": "The exact program that answered and when it last passed verification: `artifact=<sha256 of the published artifact>; at=<ISO 8601 time>`. The time is the version's publication, or its most recent passing repair check if that is later.",
                "schema": {
                  "type": "string",
                  "pattern": "^artifact=[0-9a-f]{64}; at=.+$"
                }
              },
              "Server-Timing": {
                "description": "Where the call's time went, in milliseconds: `pre` (before the handler), `admit` (resolve and charge), `run` (the program, including the target site) and `settle` (record and finalize).",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicEndpointExecutionResponse"
                }
              }
            }
          },
          "429": {
            "description": "Runtime execution envelope when the target site rate-limits the run, or, without a key, a `try_limit_reached` refusal before any run.",
            "headers": {
              "X-Peel-Credits-Charged": {
                "description": "Runs charged for this execution, in the same units as the credit ledger. Zero when the run did not return a result and was reversed.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-Peel-Credits-Remaining": {
                "description": "Authoritative remaining run balance (credits ledger units) after execution billing.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "Peel-Verified": {
                "description": "The exact program that answered and when it last passed verification: `artifact=<sha256 of the published artifact>; at=<ISO 8601 time>`. The time is the version's publication, or its most recent passing repair check if that is later.",
                "schema": {
                  "type": "string",
                  "pattern": "^artifact=[0-9a-f]{64}; at=.+$"
                }
              },
              "Server-Timing": {
                "description": "Where the call's time went, in milliseconds: `pre` (before the handler), `admit` (resolve and charge), `run` (the program, including the target site) and `settle` (record and finalize).",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait. On a refusal without a key, until midnight UTC or a short retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/PublicEndpointExecutionResponse"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    }
                  ]
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "Runtime execution envelope for target transport failure.",
            "headers": {
              "X-Peel-Credits-Charged": {
                "description": "Runs charged for this execution, in the same units as the credit ledger. Zero when the run did not return a result and was reversed.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-Peel-Credits-Remaining": {
                "description": "Authoritative remaining run balance (credits ledger units) after execution billing.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "Peel-Verified": {
                "description": "The exact program that answered and when it last passed verification: `artifact=<sha256 of the published artifact>; at=<ISO 8601 time>`. The time is the version's publication, or its most recent passing repair check if that is later.",
                "schema": {
                  "type": "string",
                  "pattern": "^artifact=[0-9a-f]{64}; at=.+$"
                }
              },
              "Server-Timing": {
                "description": "Where the call's time went, in milliseconds: `pre` (before the handler), `admit` (resolve and charge), `run` (the program, including the target site) and `settle` (record and finalize).",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicEndpointExecutionResponse"
                }
              }
            }
          },
          "503": {
            "description": "Runtime execution envelope for temporary execution capacity, or, without a key, a `temporarily_unavailable` refusal before any run when the daily limiter does not answer.",
            "headers": {
              "X-Peel-Credits-Charged": {
                "description": "Runs charged for this execution, in the same units as the credit ledger. Zero when the run did not return a result and was reversed.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-Peel-Credits-Remaining": {
                "description": "Authoritative remaining run balance (credits ledger units) after execution billing.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "Peel-Verified": {
                "description": "The exact program that answered and when it last passed verification: `artifact=<sha256 of the published artifact>; at=<ISO 8601 time>`. The time is the version's publication, or its most recent passing repair check if that is later.",
                "schema": {
                  "type": "string",
                  "pattern": "^artifact=[0-9a-f]{64}; at=.+$"
                }
              },
              "Server-Timing": {
                "description": "Where the call's time went, in milliseconds: `pre` (before the handler), `admit` (resolve and charge), `run` (the program, including the target site) and `settle` (record and finalize).",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait. On a refusal without a key, until midnight UTC or a short retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/PublicEndpointExecutionResponse"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    }
                  ]
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "504": {
            "description": "Runtime execution envelope for timeout.",
            "headers": {
              "X-Peel-Credits-Charged": {
                "description": "Runs charged for this execution, in the same units as the credit ledger. Zero when the run did not return a result and was reversed.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-Peel-Credits-Remaining": {
                "description": "Authoritative remaining run balance (credits ledger units) after execution billing.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "Peel-Verified": {
                "description": "The exact program that answered and when it last passed verification: `artifact=<sha256 of the published artifact>; at=<ISO 8601 time>`. The time is the version's publication, or its most recent passing repair check if that is later.",
                "schema": {
                  "type": "string",
                  "pattern": "^artifact=[0-9a-f]{64}; at=.+$"
                }
              },
              "Server-Timing": {
                "description": "Where the call's time went, in milliseconds: `pre` (before the handler), `admit` (resolve and charge), `run` (the program, including the target site) and `settle` (record and finalize).",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicEndpointExecutionResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apis": {
      "get": {
        "tags": [
          "APIs"
        ],
        "summary": "List APIs",
        "operationId": "listApis",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "include_archived",
            "schema": {
              "type": "string",
              "enum": [
                "false",
                "true",
                "only"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Page of APIs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "apis"
                  ],
                  "properties": {
                    "apis": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PublicApiSummary"
                      }
                    },
                    "next_cursor": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "APIs"
        ],
        "summary": "Create an API",
        "operationId": "createApi",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": "Repeating a request with the same key returns the same build without starting or charging a second one. The same key with a different request returns 409 `idempotency_key_reused`."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "instructions": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "wait_for_completion": {
                    "type": "boolean",
                    "default": false
                  },
                  "timeout_ms": {
                    "type": "integer",
                    "minimum": 1000,
                    "maximum": 300000
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "API creation result.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "api",
                    "waited",
                    "timed_out"
                  ],
                  "properties": {
                    "api": {
                      "$ref": "#/components/schemas/PublicApiDetail"
                    },
                    "waited": {
                      "type": "boolean"
                    },
                    "timed_out": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apis/{api_id}": {
      "get": {
        "tags": [
          "APIs"
        ],
        "summary": "Get API detail",
        "operationId": "getApi",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          }
        ],
        "responses": {
          "200": {
            "description": "API detail.",
            "content": {
              "application/json": {
                "examples": {
                  "failedBuild": {
                    "summary": "Failed build with custom artifact diagnostics",
                    "value": {
                      "api": {
                        "id": "4d0d8c18-3a06-4d53-9a57-2e5aa3f8c0cc",
                        "url": "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html",
                        "instructions": "Get product details with name, price, and rating",
                        "name": null,
                        "status": "failed",
                        "created_at": "2026-05-18T07:00:00.000Z",
                        "updated_at": "2026-05-18T07:01:12.000Z",
                        "completed_at": "2026-05-18T07:01:12.000Z",
                        "endpoint_count": 0,
                        "failure": {
                          "category": "compile_quality",
                          "code": "compile_unpublishable_output",
                          "message": "The compiler produced output that did not meet the publishable API quality bar.",
                          "recommended_action": "revise_task",
                          "refund_reviewable": true,
                          "retryable": false,
                          "technical_reason": "Custom artifact publish gate failed: extract:quality_failed:singleton_endpoint_returned_collection",
                          "support_debug_id": "build:4d0d8c18-3a06-4d53-9a57-2e5aa3f8c0cc:compile_unpublishable_output"
                        },
                        "links": {
                          "self": "/v1/apis/4d0d8c18-3a06-4d53-9a57-2e5aa3f8c0cc",
                          "health": "/v1/apis/4d0d8c18-3a06-4d53-9a57-2e5aa3f8c0cc/health",
                          "revise": "/v1/apis/4d0d8c18-3a06-4d53-9a57-2e5aa3f8c0cc/revise",
                          "rebuild": "/v1/apis/4d0d8c18-3a06-4d53-9a57-2e5aa3f8c0cc/rebuild",
                          "respond": "/v1/apis/4d0d8c18-3a06-4d53-9a57-2e5aa3f8c0cc/respond",
                          "openapi_export": "/v1/apis/4d0d8c18-3a06-4d53-9a57-2e5aa3f8c0cc/exports/openapi",
                          "mcp_export": "/v1/apis/4d0d8c18-3a06-4d53-9a57-2e5aa3f8c0cc/exports/mcp",
                          "endpoint_call_template": "/v1/apis/4d0d8c18-3a06-4d53-9a57-2e5aa3f8c0cc/endpoints/{endpoint_name}:call"
                        },
                        "description": null,
                        "source_url": "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html",
                        "error": "Custom artifact publish gate failed: extract:quality_failed:singleton_endpoint_returned_collection",
                        "requires_session": false,
                        "user_input_prompt": null,
                        "endpoints": []
                      }
                    }
                  }
                },
                "schema": {
                  "type": "object",
                  "required": [
                    "api"
                  ],
                  "properties": {
                    "api": {
                      "$ref": "#/components/schemas/PublicApiDetail"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "APIs"
        ],
        "summary": "Delete an API",
        "operationId": "deleteApi",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          }
        ],
        "responses": {
          "200": {
            "description": "The API, its versions and its builds were deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "deleted",
                    "api_id"
                  ],
                  "properties": {
                    "deleted": {
                      "type": "boolean",
                      "const": true
                    },
                    "api_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apis/{api_id}/wait": {
      "get": {
        "tags": [
          "APIs"
        ],
        "summary": "Wait for the latest build of an API",
        "operationId": "waitForApi",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          },
          {
            "in": "query",
            "name": "timeout_ms",
            "schema": {
              "type": "integer",
              "minimum": 1000,
              "maximum": 300000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The latest build finished, failed or is waiting for input. A 202 with timed_out true means the timeout elapsed first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "api",
                    "waited",
                    "timed_out"
                  ],
                  "properties": {
                    "api": {
                      "$ref": "#/components/schemas/PublicApiDetail"
                    },
                    "waited": {
                      "type": "boolean"
                    },
                    "timed_out": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apis/{api_id}/cancel": {
      "post": {
        "tags": [
          "APIs"
        ],
        "summary": "Cancel the latest build of an API",
        "operationId": "cancelApiBuild",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [],
                "properties": {
                  "reason": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cancellation result; canceled is false when the latest build had already finished.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "api",
                    "canceled"
                  ],
                  "properties": {
                    "api": {
                      "$ref": "#/components/schemas/PublicApiDetail"
                    },
                    "canceled": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apis/{api_id}/archive": {
      "post": {
        "tags": [
          "APIs"
        ],
        "summary": "Archive an API",
        "operationId": "archiveApi",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          }
        ],
        "responses": {
          "200": {
            "description": "The archived API.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "api"
                  ],
                  "properties": {
                    "api": {
                      "$ref": "#/components/schemas/PublicApiDetail"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apis/{api_id}/unarchive": {
      "post": {
        "tags": [
          "APIs"
        ],
        "summary": "Restore an archived API",
        "operationId": "unarchiveApi",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          }
        ],
        "responses": {
          "200": {
            "description": "The restored API.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "api"
                  ],
                  "properties": {
                    "api": {
                      "$ref": "#/components/schemas/PublicApiDetail"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apis/{api_id}/repair": {
      "put": {
        "tags": [
          "APIs"
        ],
        "summary": "Turn automatic repair on or off",
        "operationId": "setApiRepair",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "enabled"
                ],
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The API with its repair setting. While repair is on, Peel re-runs the saved examples of the current version every day and rebuilds the API with the same instructions after two failed checks.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "api"
                  ],
                  "properties": {
                    "api": {
                      "$ref": "#/components/schemas/PublicApiDetail"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apis/{api_id}/rollback": {
      "post": {
        "tags": [
          "APIs"
        ],
        "summary": "Make a version of an API current: publish a draft or roll back",
        "operationId": "rollbackApi",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "version_id"
                ],
                "properties": {
                  "version_id": {
                    "type": "string",
                    "description": "A version from this API's revisions, listed as builds[].version_id."
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The API now serving the chosen version.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "api",
                    "rolled_back"
                  ],
                  "properties": {
                    "api": {
                      "$ref": "#/components/schemas/PublicApiDetail"
                    },
                    "rolled_back": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apis/{api_id}/revisions": {
      "get": {
        "tags": [
          "APIs"
        ],
        "summary": "List API revisions",
        "operationId": "listApiRevisions",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          },
          {
            "in": "query",
            "name": "build_id",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Read this one build by id instead of the list. `builds` is then that build, or empty when it is not a build of this API."
          }
        ],
        "responses": {
          "200": {
            "description": "The newest builds of this API, newest first, or only the build named by `build_id`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "api_id",
                    "builds"
                  ],
                  "properties": {
                    "api_id": {
                      "type": "string"
                    },
                    "builds": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiBuild"
                      }
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/apis/{api_id}/versions/{version_id}/page-copy": {
      "get": {
        "tags": [
          "APIs"
        ],
        "summary": "Read the page a version was built from",
        "operationId": "getApiPageCopy",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          },
          {
            "in": "path",
            "name": "version_id",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "A version from this API's revisions, listed as builds[].version_id."
          }
        ],
        "responses": {
          "200": {
            "description": "A fresh fetch of the source page made when this version published, with sign-in values, cookies, Authorization and tokens removed. It is not the exact response the builder saw. Peel keeps one record per version and deletes it with the version. Builds that used a sign-in, signed or credential-bearing links, refused or challenged fetches and sources that are not documents keep only the hash and details. Other owners get 404 `page_copy_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "version_id",
                    "url",
                    "fetched_at",
                    "status",
                    "truncated",
                    "redacted",
                    "kept",
                    "headers",
                    "download_url",
                    "download_expires_at"
                  ],
                  "properties": {
                    "version_id": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string",
                      "description": "The fetched URL with query values and token-like path segments removed."
                    },
                    "fetched_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "status": {
                      "type": "integer",
                      "description": "The HTTP status, or 0 when the fetch failed."
                    },
                    "content_type": {
                      "type": "string",
                      "description": "The media type, without parameters."
                    },
                    "sha256": {
                      "type": "string",
                      "description": "SHA-256 of the full response body. Absent when the body exceeded 64 MiB or was not read."
                    },
                    "bytes": {
                      "type": "integer",
                      "description": "Size of the full response body."
                    },
                    "truncated": {
                      "type": "boolean",
                      "description": "True when the stored body was cut at 2 MB."
                    },
                    "redacted": {
                      "type": "boolean",
                      "description": "True when private values were removed from the body."
                    },
                    "kept": {
                      "type": "string",
                      "enum": [
                        "sealed",
                        "hash_only"
                      ]
                    },
                    "reason": {
                      "type": "string",
                      "description": "Why only the hash and details were kept: signed_in, private_url, redirected_off_site, blocked, not_a_page, not_admitted, fetch_failed, unreadable, capture_failed or store_unavailable."
                    },
                    "headers": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "download_url": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "A link to the stored body that works for five minutes. Null when only the hash was kept."
                    },
                    "download_expires_at": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/public/page-copies/{token}": {
      "get": {
        "tags": [
          "APIs"
        ],
        "summary": "Download the body of a page copy",
        "operationId": "downloadApiPageCopy",
        "security": [],
        "parameters": [
          {
            "in": "path",
            "name": "token",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The stored body as raw bytes.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apis/{api_id}/code": {
      "get": {
        "tags": [
          "APIs"
        ],
        "summary": "Read the code of an API version",
        "operationId": "getApiCode",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          },
          {
            "in": "query",
            "name": "version_id",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "A version from this API's revisions. Defaults to the current version."
          }
        ],
        "responses": {
          "200": {
            "description": "The program each endpoint runs in this version. A version of another API answers 404 `version_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "api_id",
                    "version_id",
                    "current",
                    "operations"
                  ],
                  "properties": {
                    "api_id": {
                      "type": "string"
                    },
                    "version_id": {
                      "type": "string"
                    },
                    "current": {
                      "type": "boolean",
                      "description": "True when this version is the one serving calls."
                    },
                    "operations": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "name",
                          "program"
                        ],
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "The endpoint name."
                          },
                          "program": {
                            "oneOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The program the endpoint runs."
                          }
                        },
                        "additionalProperties": false
                      }
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apis/{api_id}/marketplace/publish": {
      "post": {
        "tags": [
          "Marketplace"
        ],
        "summary": "Publish an owned API to the public marketplace",
        "operationId": "publishApiToMarketplace",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expected_marketplace_version_id": {
                    "type": "string",
                    "description": "Required for contribution-back; the canonical version must still equal this compare-and-swap value."
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The current API version was contributed or was already published.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarketplacePublication"
                }
              }
            }
          },
          "201": {
            "description": "The current API version was published.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarketplacePublication"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The API is not publishable or its canonical marketplace key is already owned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apis/{api_id}/marketplace/unpublish": {
      "post": {
        "tags": [
          "Marketplace"
        ],
        "summary": "Take an owned API's listing off the public marketplace",
        "description": "The listing leaves list, search and detail, and marketplace calls to its ID answer 404 `marketplace_api_removed` and charge nothing. Your API and its own routes keep working, and so do private copies other users installed. Publishing the API again lists it under the same marketplace ID. Repeating the call, or calling it for an API that was never published, answers 200 with `already_unpublished: true`.",
        "operationId": "unpublishApiFromMarketplace",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          }
        ],
        "responses": {
          "200": {
            "description": "The listing is off the marketplace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarketplaceUnpublication"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "`marketplace_not_publisher`: another API published the listing's current version, for example an installed copy or an earlier contributor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apis/{api_id}/revise": {
      "post": {
        "tags": [
          "APIs"
        ],
        "summary": "Revise an API",
        "operationId": "reviseApi",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": "Repeating a request with the same key returns the same build without starting or charging a second one. The same key with a different request returns 409 `idempotency_key_reused`."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "instructions"
                ],
                "properties": {
                  "instructions": {
                    "type": "string"
                  },
                  "wait_for_completion": {
                    "type": "boolean",
                    "default": false
                  },
                  "timeout_ms": {
                    "type": "integer",
                    "minimum": 1000,
                    "maximum": 300000
                  },
                  "draft": {
                    "type": "boolean",
                    "default": false,
                    "description": "Build a draft: the new version is stored but the current one keeps serving until you publish the draft with rollback."
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Revision request result.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "api",
                    "revision_queued",
                    "waited",
                    "timed_out"
                  ],
                  "properties": {
                    "api": {
                      "$ref": "#/components/schemas/PublicApiDetail"
                    },
                    "revision_queued": {
                      "type": "boolean"
                    },
                    "waited": {
                      "type": "boolean"
                    },
                    "timed_out": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Another build of this API is queued or running (`revision_in_progress`), or the Idempotency-Key was used for a different request (`idempotency_key_reused`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apis/{api_id}/rebuild": {
      "post": {
        "tags": [
          "APIs"
        ],
        "summary": "Rebuild an API",
        "operationId": "rebuildApiPublic",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": "Repeating a request with the same key returns the same build without starting or charging a second one. The same key with a different request returns 409 `idempotency_key_reused`."
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string"
                  },
                  "draft": {
                    "type": "boolean",
                    "default": false,
                    "description": "Build a draft: the new version is stored but the current one keeps serving until you publish the draft with rollback."
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Rebuild request result.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "api",
                    "rebuild_queued"
                  ],
                  "properties": {
                    "api": {
                      "$ref": "#/components/schemas/PublicApiDetail"
                    },
                    "rebuild_queued": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Another build of this API is queued or running (`revision_in_progress`), the Idempotency-Key was used for a different request (`idempotency_key_reused`), or a draft was asked for before the API had a published version (`revision_source_missing`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apis/{api_id}/respond": {
      "post": {
        "tags": [
          "APIs"
        ],
        "summary": "Provide additional input for a paused API build",
        "operationId": "respondToApiInput",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "response"
                ],
                "properties": {
                  "response": {
                    "type": "object",
                    "additionalProperties": true
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paused build resumed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "api",
                    "response_queued"
                  ],
                  "properties": {
                    "api": {
                      "$ref": "#/components/schemas/PublicApiDetail"
                    },
                    "response_queued": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The API is not currently awaiting user input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apis/{api_id}/exports/source": {
      "get": {
        "tags": [
          "APIs"
        ],
        "summary": "Export owned integration source and the account-free local runtime",
        "operationId": "exportApiSource",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          }
        ],
        "responses": {
          "200": {
            "description": "Versioned source files and their SHA-256 checksums.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "format",
                    "files",
                    "sha256"
                  ],
                  "properties": {
                    "format": {
                      "type": "string",
                      "enum": [
                        "peel.source.v1"
                      ]
                    },
                    "files": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "sha256": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The selected version requires rebuild before source export.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apis/{api_id}/exports/openapi": {
      "get": {
        "tags": [
          "APIs"
        ],
        "summary": "Export API as OpenAPI",
        "operationId": "exportApiOpenApi",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          }
        ],
        "responses": {
          "200": {
            "description": "Generated OpenAPI export.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeneratedOpenApiExport"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The API has not published exportable endpoints yet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apis/{api_id}/exports/mcp": {
      "get": {
        "tags": [
          "APIs"
        ],
        "summary": "Export API as MCP tools",
        "operationId": "exportApiMcp",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          }
        ],
        "responses": {
          "200": {
            "description": "Generated MCP export.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeneratedMcpExport"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The API has not published exportable endpoints yet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apis/{api_id}/health": {
      "get": {
        "tags": [
          "APIs"
        ],
        "summary": "Get API health",
        "operationId": "getApiHealthPublic",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          }
        ],
        "responses": {
          "200": {
            "description": "API health report.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiHealth"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apis/{api_id}/feedback": {
      "post": {
        "tags": [
          "APIs"
        ],
        "summary": "Rate an endpoint's answer",
        "description": "Records a thumbs up (1) or down (-1) on an endpoint, with an optional comment and the input and output it is about. Peel reads it when it repairs or rebuilds the API. A key limited to one API must name the run with `execution_run_id`.",
        "operationId": "sendApiFeedback",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "endpoint_name",
                  "rating"
                ],
                "properties": {
                  "endpoint_name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "rating": {
                    "type": "integer",
                    "enum": [
                      1,
                      -1
                    ]
                  },
                  "comment": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "execution_run_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The run the rating is about."
                  },
                  "input_snapshot": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "output_snapshot": {}
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "recorded"
                  ],
                  "properties": {
                    "recorded": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, or `execution_run_id_required` for a key limited to one API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "The API is not on this account, or `run_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apis/{api_id}/endpoints/{endpoint_name}:batch": {
      "post": {
        "tags": [
          "Endpoint Execution"
        ],
        "summary": "Run a generated endpoint on many inputs",
        "description": "Runs one public read endpoint on 1 to 100 inputs and answers once every item has ended, in the order sent. Send `items`, each with an `input` and an optional `key` echoed on its result, or `inputs` for a plain list; fields in `defaults` apply to every item and an item's own fields win. Items run four at a time; each time the site answers 429, 418 or a JSON body saying 429, the batch halves how many run at once. A bad input fails only its item (`input_invalid`). Items not started within 60 seconds end as `not_run` with `batch_timed_out`. Each successful item is charged as one call of that endpoint; failed and unstarted items cost nothing. With `Idempotency-Key`, item i is keyed `<key>:<i>`. Sign-in, signed-in and action endpoints answer 409 `batch_not_allowed`.",
        "operationId": "batchCallApiEndpoint",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionCookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          },
          {
            "in": "path",
            "name": "endpoint_name",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": "Optional. Item i runs with the key `<key>:<i>`, so repeating the batch repeats no charged item."
          },
          {
            "in": "header",
            "name": "Peel-Version",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Optional. Run this version of the API instead of the current one, such as a draft; version ids are `builds[].version_id` in the revisions. A malformed id answers 400 `version_invalid` and a version of another API answers 404 `version_not_found`. Marketplace calls always run the current version."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "defaults": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "items": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 100,
                    "items": {
                      "type": "object",
                      "required": [],
                      "properties": {
                        "key": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "input": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "inputs": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 100,
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "shape": {
                    "type": "object",
                    "additionalProperties": false,
                    "description": "Reshape the result's rows with no model and no code. Peel checks it against the endpoint's output schema before running and refuses a bad one with 400 `shape_invalid`, uncharged. Steps run in order: where, group_by with aggregate, sort, limit, fields.",
                    "properties": {
                      "rows": {
                        "type": "string",
                        "description": "Path to the list in the result. Defaults to the endpoint's paging list or its only list."
                      },
                      "where": {
                        "type": "array",
                        "maxItems": 20,
                        "items": {
                          "type": "object",
                          "required": [
                            "field",
                            "op"
                          ],
                          "properties": {
                            "field": {
                              "type": "string"
                            },
                            "op": {
                              "type": "string",
                              "enum": [
                                "eq",
                                "ne",
                                "gt",
                                "gte",
                                "lt",
                                "lte",
                                "contains",
                                "in",
                                "exists"
                              ]
                            },
                            "value": {}
                          },
                          "additionalProperties": false
                        }
                      },
                      "group_by": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 5,
                        "items": {
                          "type": "string"
                        }
                      },
                      "aggregate": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "object",
                          "required": [
                            "op"
                          ],
                          "properties": {
                            "op": {
                              "type": "string",
                              "enum": [
                                "count",
                                "sum",
                                "avg",
                                "min",
                                "max"
                              ]
                            },
                            "field": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "sort": {
                        "type": "array",
                        "maxItems": 5,
                        "items": {
                          "type": "object",
                          "required": [
                            "field"
                          ],
                          "properties": {
                            "field": {
                              "type": "string"
                            },
                            "order": {
                              "type": "string",
                              "enum": [
                                "asc",
                                "desc"
                              ]
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "limit": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 10000
                      },
                      "fields": {
                        "oneOf": [
                          {
                            "type": "array",
                            "minItems": 1,
                            "maxItems": 100,
                            "items": {
                              "type": "string"
                            }
                          },
                          {
                            "type": "object",
                            "additionalProperties": {
                              "type": "string"
                            },
                            "description": "Output name to field path"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Every item's result in the order sent. Each item is a call result plus its `key`; `status` is `not_run` for items that never started.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "counts",
                    "credits_charged",
                    "items"
                  ],
                  "properties": {
                    "counts": {
                      "type": "object",
                      "required": [
                        "succeeded",
                        "failed",
                        "not_run"
                      ],
                      "properties": {
                        "succeeded": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "failed": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "not_run": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "additionalProperties": false
                    },
                    "credits_charged": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "status",
                          "status_code",
                          "data",
                          "error",
                          "error_code"
                        ],
                        "additionalProperties": true,
                        "description": "The same fields as a single call's answer, plus `key`.",
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "success",
                              "error",
                              "timeout",
                              "not_run"
                            ]
                          },
                          "status_code": {
                            "oneOf": [
                              {
                                "type": "integer"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "data": {},
                          "error": {
                            "oneOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "error_code": {
                            "oneOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "credits_charged": {
                            "type": "integer",
                            "minimum": 0
                          }
                        }
                      }
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apis/{api_id}/endpoints/{endpoint_name}:call": {
      "post": {
        "tags": [
          "Endpoint Execution"
        ],
        "summary": "Call a generated endpoint",
        "operationId": "callApiEndpoint",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          },
          {
            "in": "path",
            "name": "endpoint_name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Session-ID",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "SESSION_ID",
            "description": "Target-site session ID returned by a login endpoint. Required for session_required endpoints."
          },
          {
            "in": "header",
            "name": "X-Encryption-Key",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "ENCRYPTION_KEY",
            "description": "Target-site encryption key returned by a login endpoint. Required with X-Session-ID for session_required endpoints."
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": "Optional. Scoped to the owner, API and endpoint. A retry with the same key and params is not charged again: a successful response up to 375 KB is stored and replayed with `Idempotent-Replayed: true`; a login response, a larger one or a failed call answers 409 with the recorded outcome (`already_finalized`), and a call still running answers `request_in_progress`. The same key with different params returns 409 `idempotency_key_reused`."
          },
          {
            "in": "header",
            "name": "Peel-Shape",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Optional. A JSON shape (see the batch body's `shape`) applied to this call's result. A bad shape answers 400 `shape_invalid` before the run and costs nothing."
          },
          {
            "in": "header",
            "name": "Peel-Version",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Optional. Run this version of the API instead of the current one, such as a draft; version ids are `builds[].version_id` in the revisions. A malformed id answers 400 `version_invalid` and a version of another API answers 404 `version_not_found`. Marketplace calls always run the current version."
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "description": "Endpoint parameters. The body is the endpoint's input."
              },
              "examples": {
                "endpointParams": {
                  "summary": "Call with endpoint params as the body",
                  "value": {
                    "limit": 10
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Endpoint execution envelope. Runtime failures that do not map to a more specific transport status may also return 200 with status:error.",
            "headers": {
              "X-Peel-Credits-Charged": {
                "description": "Runs charged for this execution, in the same units as the credit ledger. Zero when the run did not return a result and was reversed.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-Peel-Credits-Remaining": {
                "description": "Authoritative remaining run balance (credits ledger units) after execution billing.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "Peel-Verified": {
                "description": "The exact program that answered and when it last passed verification: `artifact=<sha256 of the published artifact>; at=<ISO 8601 time>`. The time is the version's publication, or its most recent passing repair check if that is later.",
                "schema": {
                  "type": "string",
                  "pattern": "^artifact=[0-9a-f]{64}; at=.+$"
                }
              },
              "Server-Timing": {
                "description": "Where the call's time went, in milliseconds: `pre` (before the handler), `admit` (resolve and charge), `run` (the program, including the target site) and `settle` (record and finalize).",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicEndpointExecutionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Runtime execution envelope for a target block or policy rejection.",
            "headers": {
              "X-Peel-Credits-Charged": {
                "description": "Runs charged for this execution, in the same units as the credit ledger. Zero when the run did not return a result and was reversed.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-Peel-Credits-Remaining": {
                "description": "Authoritative remaining run balance (credits ledger units) after execution billing.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "Peel-Verified": {
                "description": "The exact program that answered and when it last passed verification: `artifact=<sha256 of the published artifact>; at=<ISO 8601 time>`. The time is the version's publication, or its most recent passing repair check if that is later.",
                "schema": {
                  "type": "string",
                  "pattern": "^artifact=[0-9a-f]{64}; at=.+$"
                }
              },
              "Server-Timing": {
                "description": "Where the call's time went, in milliseconds: `pre` (before the handler), `admit` (resolve and charge), `run` (the program, including the target site) and `settle` (record and finalize).",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicEndpointExecutionResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "API exists but is not ready yet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Runtime execution envelope for extraction or validation failure.",
            "headers": {
              "X-Peel-Credits-Charged": {
                "description": "Runs charged for this execution, in the same units as the credit ledger. Zero when the run did not return a result and was reversed.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-Peel-Credits-Remaining": {
                "description": "Authoritative remaining run balance (credits ledger units) after execution billing.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "Peel-Verified": {
                "description": "The exact program that answered and when it last passed verification: `artifact=<sha256 of the published artifact>; at=<ISO 8601 time>`. The time is the version's publication, or its most recent passing repair check if that is later.",
                "schema": {
                  "type": "string",
                  "pattern": "^artifact=[0-9a-f]{64}; at=.+$"
                }
              },
              "Server-Timing": {
                "description": "Where the call's time went, in milliseconds: `pre` (before the handler), `admit` (resolve and charge), `run` (the program, including the target site) and `settle` (record and finalize).",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicEndpointExecutionResponse"
                }
              }
            }
          },
          "429": {
            "description": "Runtime execution envelope for target or upstream rate limiting.",
            "headers": {
              "X-Peel-Credits-Charged": {
                "description": "Runs charged for this execution, in the same units as the credit ledger. Zero when the run did not return a result and was reversed.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-Peel-Credits-Remaining": {
                "description": "Authoritative remaining run balance (credits ledger units) after execution billing.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "Peel-Verified": {
                "description": "The exact program that answered and when it last passed verification: `artifact=<sha256 of the published artifact>; at=<ISO 8601 time>`. The time is the version's publication, or its most recent passing repair check if that is later.",
                "schema": {
                  "type": "string",
                  "pattern": "^artifact=[0-9a-f]{64}; at=.+$"
                }
              },
              "Server-Timing": {
                "description": "Where the call's time went, in milliseconds: `pre` (before the handler), `admit` (resolve and charge), `run` (the program, including the target site) and `settle` (record and finalize).",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicEndpointExecutionResponse"
                }
              }
            }
          },
          "502": {
            "description": "Runtime execution envelope for target transport failure.",
            "headers": {
              "X-Peel-Credits-Charged": {
                "description": "Runs charged for this execution, in the same units as the credit ledger. Zero when the run did not return a result and was reversed.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-Peel-Credits-Remaining": {
                "description": "Authoritative remaining run balance (credits ledger units) after execution billing.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "Peel-Verified": {
                "description": "The exact program that answered and when it last passed verification: `artifact=<sha256 of the published artifact>; at=<ISO 8601 time>`. The time is the version's publication, or its most recent passing repair check if that is later.",
                "schema": {
                  "type": "string",
                  "pattern": "^artifact=[0-9a-f]{64}; at=.+$"
                }
              },
              "Server-Timing": {
                "description": "Where the call's time went, in milliseconds: `pre` (before the handler), `admit` (resolve and charge), `run` (the program, including the target site) and `settle` (record and finalize).",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicEndpointExecutionResponse"
                }
              }
            }
          },
          "503": {
            "description": "Runtime execution envelope for temporary execution capacity or retryable runtime failure.",
            "headers": {
              "X-Peel-Credits-Charged": {
                "description": "Runs charged for this execution, in the same units as the credit ledger. Zero when the run did not return a result and was reversed.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-Peel-Credits-Remaining": {
                "description": "Authoritative remaining run balance (credits ledger units) after execution billing.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "Peel-Verified": {
                "description": "The exact program that answered and when it last passed verification: `artifact=<sha256 of the published artifact>; at=<ISO 8601 time>`. The time is the version's publication, or its most recent passing repair check if that is later.",
                "schema": {
                  "type": "string",
                  "pattern": "^artifact=[0-9a-f]{64}; at=.+$"
                }
              },
              "Server-Timing": {
                "description": "Where the call's time went, in milliseconds: `pre` (before the handler), `admit` (resolve and charge), `run` (the program, including the target site) and `settle` (record and finalize).",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicEndpointExecutionResponse"
                }
              }
            }
          },
          "504": {
            "description": "Runtime execution envelope for timeout.",
            "headers": {
              "X-Peel-Credits-Charged": {
                "description": "Runs charged for this execution, in the same units as the credit ledger. Zero when the run did not return a result and was reversed.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-Peel-Credits-Remaining": {
                "description": "Authoritative remaining run balance (credits ledger units) after execution billing.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "Peel-Verified": {
                "description": "The exact program that answered and when it last passed verification: `artifact=<sha256 of the published artifact>; at=<ISO 8601 time>`. The time is the version's publication, or its most recent passing repair check if that is later.",
                "schema": {
                  "type": "string",
                  "pattern": "^artifact=[0-9a-f]{64}; at=.+$"
                }
              },
              "Server-Timing": {
                "description": "Where the call's time went, in milliseconds: `pre` (before the handler), `admit` (resolve and charge), `run` (the program, including the target site) and `settle` (record and finalize).",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicEndpointExecutionResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "ApiId": {
        "in": "path",
        "name": "api_id",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "MarketplaceId": {
        "in": "path",
        "name": "marketplace_id",
        "required": true,
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "Gone": {
        "description": "The upload URL has expired.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          },
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "PayloadTooLarge": {
        "description": "Request or file exceeds its bounded size.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          },
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "ServiceUnavailable": {
        "description": "The authenticated execution host or durable encrypted storage is unavailable.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          },
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "BadRequest": {
        "description": "Invalid request.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          },
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing or invalid auth.",
        "headers": {
          "WWW-Authenticate": {
            "schema": {
              "type": "string"
            },
            "description": "OAuth bearer challenge with MCP resource metadata when available."
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          },
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "NotFound": {
        "description": "Requested API or endpoint was not found.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          },
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Conflict": {
        "description": "The requested lifecycle transition conflicts with current API state.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          },
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "A rate limit, the build queue, or a quota. Code quota_exceeded means runs, builds, the daily cap or the monthly build budget are used up; details.quota says which, with details.limit (details.limit_usd and details.used_usd for build_budget), details.used or details.remaining, and details.reset_at. Code builds_paused means Peel paused new builds for everyone until details.resumes_at. Retry-After gives seconds.",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Seconds to wait before retrying."
          },
          "RateLimit": {
            "schema": {
              "type": "string"
            },
            "description": "The remaining quota and seconds to reset, such as `\"dispatch-read\";r=0;t=42`."
          },
          "RateLimit-Policy": {
            "schema": {
              "type": "string"
            },
            "description": "The quota and window in seconds, such as `\"dispatch-read\";q=120;w=60`."
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          },
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      }
    },
    "schemas": {
      "ExecutionJob": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "state": {
            "type": "string",
            "enum": [
              "running",
              "needs_input",
              "succeeded",
              "failed",
              "cancelled",
              "unknown"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "question": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "prompt": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1024
              },
              "secret": {
                "type": "boolean"
              },
              "url": {
                "type": "string",
                "maxLength": 2048,
                "format": "uri"
              },
              "step": {
                "type": "string",
                "maxLength": 128
              },
              "details": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              "dialog": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  },
                  "defaultValue": {
                    "type": "string"
                  }
                },
                "required": [
                  "type",
                  "message",
                  "defaultValue"
                ],
                "additionalProperties": false
              },
              "allow_empty": {
                "type": "boolean"
              },
              "question_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "answer_url": {
                "type": "string",
                "maxLength": 2048,
                "format": "uri"
              }
            },
            "required": [
              "key",
              "prompt",
              "secret",
              "question_id"
            ],
            "additionalProperties": false
          },
          "result": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "success",
                  "error",
                  "timeout"
                ]
              },
              "execution_time": {
                "type": "number",
                "minimum": 0
              },
              "data": {},
              "status_code": {
                "type": "integer",
                "minimum": 100,
                "maximum": 599
              },
              "error_code": {
                "type": "string",
                "maxLength": 128
              },
              "action_outcome": {
                "type": "string",
                "enum": [
                  "committed",
                  "not_committed",
                  "unknown",
                  "cancelled"
                ]
              },
              "retry_safe": {
                "type": "boolean"
              },
              "retry": {
                "type": "string",
                "enum": [
                  "never",
                  "fix_request",
                  "same_key",
                  "new_key"
                ]
              },
              "cache_status": {
                "type": "string",
                "enum": [
                  "hit",
                  "miss",
                  "bypass"
                ]
              },
              "credits_charged": {
                "type": "number"
              },
              "credits_remaining": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "runtime_source": {
                "type": "string",
                "enum": [
                  "live",
                  "result_cache"
                ]
              },
              "transport": {
                "type": "string",
                "enum": [
                  "html_browser",
                  "http_replay"
                ]
              }
            },
            "required": [
              "status",
              "execution_time",
              "data"
            ],
            "additionalProperties": false
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "message": {
                "type": "string",
                "maxLength": 2048
              },
              "action_outcome": {
                "type": "string",
                "enum": [
                  "committed",
                  "not_committed",
                  "unknown",
                  "cancelled"
                ]
              },
              "retry_safe": {
                "type": "boolean"
              },
              "retry": {
                "type": "string",
                "enum": [
                  "never",
                  "fix_request",
                  "same_key",
                  "new_key"
                ]
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          },
          "progress": {
            "maxItems": 40,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "message": {
                  "type": "string",
                  "maxLength": 240
                }
              },
              "required": [
                "at",
                "message"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "state",
          "created_at",
          "expires_at"
        ],
        "additionalProperties": false
      },
      "ExecutionJobStartInput": {
        "type": "object",
        "properties": {
          "endpoint": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "params": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "writeOnly": true,
            "description": "Business inputs and named runtime controls; never echo secrets or session keys."
          },
          "idempotency_key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "session_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "writeOnly": true,
            "description": "Managed session id."
          },
          "encryption_key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "writeOnly": true,
            "description": "Key for that session."
          }
        },
        "required": [
          "endpoint",
          "idempotency_key"
        ],
        "additionalProperties": false
      },
      "ExecutionJobAnswerInput": {
        "type": "object",
        "properties": {
          "question_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "answer": {
            "type": "string",
            "maxLength": 16384,
            "writeOnly": true,
            "description": "Answer to the exact pending question. May contain a secret; never log or return it."
          }
        },
        "required": [
          "question_id",
          "answer"
        ],
        "additionalProperties": false
      },
      "RuntimeFileUpload": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "mime_type": {
            "type": "string",
            "minLength": 3,
            "maxLength": 150
          },
          "data_base64": {
            "type": "string",
            "maxLength": 6666668,
            "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$",
            "writeOnly": true,
            "description": "Canonical base64 file bytes, at most five megabytes after decoding."
          }
        },
        "required": [
          "name",
          "mime_type",
          "data_base64"
        ],
        "additionalProperties": false
      },
      "RuntimeFileUploadRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "mime_type": {
            "type": "string",
            "minLength": 3,
            "maxLength": 150
          }
        },
        "required": [
          "name",
          "mime_type"
        ],
        "additionalProperties": false
      },
      "RuntimeFileUploadUrl": {
        "type": "object",
        "properties": {
          "upload_url": {
            "type": "string",
            "format": "uri",
            "description": "One-time URL; PUT the file's raw bytes to it."
          },
          "method": {
            "type": "string",
            "const": "PUT"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "max_bytes": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "upload_url",
          "method",
          "expires_at",
          "max_bytes"
        ],
        "additionalProperties": false
      },
      "RuntimeFile": {
        "type": "object",
        "properties": {
          "file_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "mime_type": {
            "type": "string",
            "minLength": 3,
            "maxLength": 150
          },
          "size": {
            "type": "integer",
            "minimum": 0,
            "maximum": 26214400
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": [
          "file_id",
          "name",
          "mime_type",
          "size",
          "expires_at"
        ],
        "additionalProperties": false
      },
      "RuntimeFileDownload": {
        "type": "object",
        "properties": {
          "file_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "mime_type": {
            "type": "string",
            "minLength": 3,
            "maxLength": 150
          },
          "size": {
            "type": "integer",
            "minimum": 0,
            "maximum": 26214400
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "data_base64": {
            "type": "string",
            "maxLength": 6666668
          }
        },
        "required": [
          "file_id",
          "name",
          "mime_type",
          "size",
          "expires_at",
          "data_base64"
        ],
        "additionalProperties": false
      },
      "WebhookInput": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 2048,
            "format": "uri"
          },
          "events": {
            "minItems": 1,
            "maxItems": 11,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "build.needs_input",
                "build.completed",
                "build.failed",
                "execution.needs_input",
                "execution.succeeded",
                "execution.failed",
                "api.repairing",
                "api.repaired",
                "api.repair_failed",
                "schedule.changed",
                "schedule.failed"
              ]
            }
          }
        },
        "required": [
          "url"
        ]
      },
      "WebhookPatch": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 2048,
            "format": "uri"
          },
          "events": {
            "minItems": 1,
            "maxItems": 11,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "build.needs_input",
                "build.completed",
                "build.failed",
                "execution.needs_input",
                "execution.succeeded",
                "execution.failed",
                "api.repairing",
                "api.repaired",
                "api.repair_failed",
                "schedule.changed",
                "schedule.failed"
              ]
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "disabled"
            ]
          }
        }
      },
      "Webhook": {
        "type": "object",
        "required": [
          "id",
          "url",
          "events",
          "status",
          "failures",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "disabled"
            ]
          },
          "failures": {
            "type": "integer",
            "description": "Events in a row whose delivery failed; 20 turn the webhook off."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "WebhookWithSecret": {
        "type": "object",
        "required": [
          "id",
          "url",
          "events",
          "status",
          "failures",
          "created_at",
          "updated_at",
          "secret"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "disabled"
            ]
          },
          "failures": {
            "type": "integer",
            "description": "Events in a row whose delivery failed; 20 turn the webhook off."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "secret": {
            "type": "string",
            "description": "Standard Webhooks signing secret (whsec_...). Returned only here; store it now."
          }
        },
        "additionalProperties": false
      },
      "ErrorResponse": {
        "type": "object",
        "required": [
          "type",
          "title",
          "status",
          "instance",
          "code",
          "message",
          "retryable",
          "retry",
          "docs_url",
          "details"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri",
            "description": "RFC 9457 problem type: https://docs.peel.sh/errors/ followed by the code."
          },
          "title": {
            "type": "string",
            "description": "Short summary of the problem type. The same for every error with this code."
          },
          "status": {
            "type": "integer",
            "minimum": 400,
            "maximum": 599,
            "description": "The HTTP status of this response."
          },
          "instance": {
            "type": "string",
            "description": "This occurrence: urn:peel:request: followed by the request id, which x-request-id also carries."
          },
          "code": {
            "type": "string",
            "description": "Stable snake_case error code."
          },
          "message": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean",
            "description": "Whether the same request can succeed later."
          },
          "retry": {
            "type": "string",
            "enum": [
              "same_key",
              "fix_request"
            ],
            "description": "A request answered with this envelope did not commit a write. same_key: send the same request again, with the same Idempotency-Key. fix_request: change the request, key or plan first."
          },
          "docs_url": {
            "type": "string",
            "format": "uri"
          },
          "details": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": false
      },
      "ApiBuild": {
        "type": "object",
        "required": [
          "id",
          "kind",
          "status",
          "created_at",
          "updated_at",
          "completed_at",
          "user_input_prompt",
          "progress",
          "failure",
          "version_id",
          "draft"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "build",
              "rebuild",
              "revision",
              "repair"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "completed",
              "failed"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "oneOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "user_input_prompt": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": true
              },
              {
                "type": "null"
              }
            ]
          },
          "progress": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "failure": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PublicApiFailure"
              },
              {
                "type": "null"
              }
            ]
          },
          "version_id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The version this build published or stored; pass it to rollback."
          },
          "draft": {
            "type": "boolean",
            "description": "True when this build stored its version without making it current; publish it with rollback."
          }
        },
        "additionalProperties": false
      },
      "ApiRepair": {
        "type": "object",
        "required": [
          "enabled",
          "last_checked_at",
          "last_result",
          "next_check_at",
          "reason"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "last_checked_at": {
            "oneOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_result": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "healthy",
                  "failing",
                  "repairing",
                  "repaired",
                  "repair_failed",
                  "incompatible"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "next_check_at": {
            "oneOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "reason": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "MarketplaceList": {
        "type": "object",
        "required": [
          "items",
          "next_cursor",
          "search_truncated"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MarketplaceSummary"
            }
          },
          "next_cursor": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "search_truncated": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "MarketplaceEndpointSearch": {
        "type": "object",
        "required": [
          "items",
          "next_cursor",
          "search_truncated"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MarketplaceEndpointSearchItem"
            }
          },
          "next_cursor": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "search_truncated": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "MarketplaceEndpointSearchItem": {
        "type": "object",
        "required": [
          "marketplace_id",
          "marketplace_name",
          "source_host",
          "endpoint_name",
          "method",
          "description",
          "credit_cost",
          "endpoint_type",
          "auth_requirement"
        ],
        "properties": {
          "marketplace_id": {
            "type": "string"
          },
          "marketplace_name": {
            "type": "string"
          },
          "source_host": {
            "type": "string"
          },
          "endpoint_name": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "credit_cost": {
            "type": "integer",
            "minimum": 0
          },
          "endpoint_type": {
            "type": "string"
          },
          "auth_requirement": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "MarketplaceSummary": {
        "type": "object",
        "required": [
          "id",
          "name",
          "description",
          "source_host",
          "source_url",
          "endpoint_count",
          "requires_session",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "source_host": {
            "type": "string"
          },
          "source_url": {
            "type": "string",
            "format": "uri"
          },
          "endpoint_count": {
            "type": "integer",
            "minimum": 0
          },
          "requires_session": {
            "type": "boolean"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "MarketplaceDetail": {
        "type": "object",
        "required": [
          "id",
          "name",
          "description",
          "source_host",
          "source_url",
          "endpoint_count",
          "requires_session",
          "updated_at",
          "endpoints"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "source_host": {
            "type": "string"
          },
          "source_url": {
            "type": "string",
            "format": "uri"
          },
          "endpoint_count": {
            "type": "integer",
            "minimum": 0
          },
          "requires_session": {
            "type": "boolean"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "endpoints": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicEndpoint"
            },
            "description": "An endpoint that can be called directly (public data, no session) carries a runnable request in `examples`, which works without an account. Other endpoints have empty `examples`: install the API to call them."
          }
        },
        "additionalProperties": false
      },
      "MarketplaceInstall": {
        "type": "object",
        "required": [
          "installed",
          "marketplace_id",
          "api_id",
          "version_id"
        ],
        "properties": {
          "installed": {
            "type": "boolean",
            "const": true
          },
          "marketplace_id": {
            "type": "string"
          },
          "api_id": {
            "type": "string"
          },
          "version_id": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "MarketplacePublication": {
        "type": "object",
        "required": [
          "published",
          "already_published",
          "publication_kind",
          "marketplace_id",
          "api_id",
          "version_id",
          "source_version_id"
        ],
        "properties": {
          "published": {
            "type": "boolean",
            "const": true
          },
          "already_published": {
            "type": "boolean"
          },
          "publication_kind": {
            "type": "string",
            "enum": [
              "first_publish",
              "contribution"
            ]
          },
          "marketplace_id": {
            "type": "string"
          },
          "api_id": {
            "type": "string"
          },
          "version_id": {
            "type": "string",
            "description": "Immutable public marketplace snapshot version."
          },
          "source_version_id": {
            "type": "string",
            "description": "Owned private version explicitly contributed."
          }
        },
        "additionalProperties": false
      },
      "MarketplaceUnpublication": {
        "type": "object",
        "required": [
          "unpublished",
          "already_unpublished",
          "marketplace_id",
          "api_id",
          "version_id"
        ],
        "properties": {
          "unpublished": {
            "type": "boolean",
            "const": true
          },
          "already_unpublished": {
            "type": "boolean"
          },
          "marketplace_id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null when the API was never published."
          },
          "api_id": {
            "type": "string"
          },
          "version_id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The listing's last marketplace snapshot version."
          }
        },
        "additionalProperties": false
      },
      "McpRequest": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/McpInitializeRequest"
          },
          {
            "$ref": "#/components/schemas/McpToolsListRequest"
          },
          {
            "$ref": "#/components/schemas/McpToolsCallRequest"
          },
          {
            "$ref": "#/components/schemas/McpPingRequest"
          },
          {
            "$ref": "#/components/schemas/McpInitializedNotification"
          },
          {
            "$ref": "#/components/schemas/McpGenericRequest"
          }
        ]
      },
      "McpGenericRequest": {
        "type": "object",
        "required": [
          "jsonrpc",
          "method"
        ],
        "properties": {
          "id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "method": {
            "type": "string"
          },
          "params": {
            "oneOf": [
              {
                "type": "array"
              },
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": true
      },
      "McpInitializeRequest": {
        "type": "object",
        "required": [
          "jsonrpc",
          "method",
          "params"
        ],
        "properties": {
          "id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "method": {
            "type": "string",
            "const": "initialize"
          },
          "params": {
            "type": "object",
            "required": [
              "protocolVersion",
              "capabilities",
              "clientInfo"
            ],
            "properties": {
              "protocolVersion": {
                "type": "string",
                "enum": [
                  "2025-11-25",
                  "2025-03-26"
                ]
              },
              "capabilities": {
                "type": "object",
                "additionalProperties": true
              },
              "clientInfo": {
                "type": "object",
                "required": [
                  "name",
                  "version"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "version": {
                    "type": "string"
                  }
                },
                "additionalProperties": true
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "McpToolsListRequest": {
        "type": "object",
        "required": [
          "jsonrpc",
          "method"
        ],
        "properties": {
          "id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "method": {
            "type": "string",
            "const": "tools/list"
          },
          "params": {
            "type": "object",
            "properties": {
              "cursor": {
                "type": "string"
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "McpToolsCallRequest": {
        "type": "object",
        "required": [
          "jsonrpc",
          "method",
          "params"
        ],
        "properties": {
          "id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "method": {
            "type": "string",
            "const": "tools/call"
          },
          "params": {
            "type": "object",
            "required": [
              "name"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "arguments": {
                "type": "object",
                "additionalProperties": true
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "McpPingRequest": {
        "type": "object",
        "required": [
          "jsonrpc",
          "method"
        ],
        "properties": {
          "id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "method": {
            "type": "string",
            "const": "ping"
          }
        },
        "additionalProperties": true
      },
      "McpInitializedNotification": {
        "type": "object",
        "required": [
          "jsonrpc",
          "method"
        ],
        "properties": {
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "method": {
            "type": "string",
            "const": "notifications/initialized"
          }
        },
        "additionalProperties": true
      },
      "McpJsonValue": {
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": true
          },
          {
            "type": "array",
            "items": {}
          },
          {
            "type": "string"
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          },
          {
            "type": "null"
          }
        ]
      },
      "McpJsonRpcSuccess": {
        "type": "object",
        "required": [
          "jsonrpc",
          "result"
        ],
        "properties": {
          "id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "result": {
            "$ref": "#/components/schemas/McpJsonValue"
          }
        },
        "additionalProperties": false
      },
      "McpJsonRpcError": {
        "type": "object",
        "required": [
          "jsonrpc",
          "error"
        ],
        "properties": {
          "id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "integer"
              },
              "message": {
                "type": "string"
              },
              "data": {
                "$ref": "#/components/schemas/McpJsonValue"
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": false
      },
      "McpJsonRpcResponse": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/McpJsonRpcSuccess"
          },
          {
            "$ref": "#/components/schemas/McpJsonRpcError"
          }
        ]
      },
      "PublicEndpoint": {
        "type": "object",
        "required": [
          "method",
          "endpoint_name",
          "input_schema",
          "output_schema",
          "endpoint_type",
          "auth_requirement",
          "examples",
          "initiates_session"
        ],
        "properties": {
          "method": {
            "type": "string"
          },
          "endpoint_name": {
            "type": "string"
          },
          "description": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "input_schema": {
            "type": "object",
            "additionalProperties": true
          },
          "output_schema": {
            "type": "object",
            "additionalProperties": true
          },
          "endpoint_type": {
            "type": "string"
          },
          "auth_requirement": {
            "type": "string"
          },
          "credit_cost": {
            "type": "integer",
            "minimum": 0,
            "description": "Runs charged per successful call."
          },
          "examples": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicEndpointExample"
            }
          },
          "initiates_session": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "Run": {
        "type": "object",
        "required": [
          "id",
          "api_id",
          "marketplace_id",
          "endpoint",
          "status",
          "status_code",
          "error_code",
          "duration_ms",
          "credits_charged",
          "transport",
          "request_id",
          "actor",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "api_id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "marketplace_id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "endpoint": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "success",
              "error",
              "timeout"
            ]
          },
          "status_code": {
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "error_code": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "duration_ms": {
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "credits_charged": {
            "type": "number",
            "minimum": 0
          },
          "transport": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "html_browser",
                  "http_replay"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "request_id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "actor": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AuditActor"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": true
      },
      "PublicEndpointExecutionResponse": {
        "type": "object",
        "required": [
          "status",
          "status_code",
          "data",
          "error",
          "error_code",
          "execution_time"
        ],
        "properties": {
          "action_outcome": {
            "type": "string",
            "enum": [
              "committed",
              "not_committed",
              "unknown",
              "cancelled"
            ],
            "description": "What the call changed on the target. Present on every failed call and on every write. unknown means requests may have been sent."
          },
          "retry_safe": {
            "type": "boolean",
            "description": "False when action_outcome is committed or unknown."
          },
          "retry": {
            "type": "string",
            "enum": [
              "never",
              "fix_request",
              "same_key",
              "new_key"
            ],
            "description": "Present on every failed call. never: do not repeat it, inspect the target first. fix_request: nothing ran, change the request first. same_key: repeat the same request with the same Idempotency-Key. new_key: nothing was committed, repeat it as a new request."
          },
          "status": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "status_code": {
            "oneOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "data": {},
          "credits_charged": {
            "type": "number"
          },
          "credits_remaining": {
            "oneOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "error_code": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "execution_time": {
            "oneOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "transport": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "html_browser",
                  "http_replay"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "initiates_session": {
            "type": "boolean"
          },
          "session_id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "encryption_key": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "session_renewed": {
            "type": "boolean",
            "description": "True when the session sent was gone and Peel signed in again with the saved login; session_id and encryption_key then hold the new session, and the old pair no longer works."
          },
          "shape": {
            "type": "object",
            "description": "Present when the call carried a shape. applied: data is in the shape's form. skipped: data is the endpoint's own result and reason says why.",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "applied",
                  "skipped"
                ]
              },
              "reason": {
                "type": "string"
              },
              "left_out": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Row fields the shape's fields leave out"
              }
            }
          }
        },
        "additionalProperties": true
      },
      "PublicEndpointExample": {
        "type": "object",
        "required": [
          "kind",
          "label",
          "request",
          "mcp_tool_call",
          "curl",
          "cli_command"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "const": "endpoint_call"
          },
          "label": {
            "type": "string"
          },
          "request": {
            "type": "object",
            "required": [
              "method",
              "path",
              "headers",
              "body"
            ],
            "properties": {
              "method": {
                "type": "string",
                "const": "POST"
              },
              "path": {
                "type": "string"
              },
              "headers": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "body": {
                "type": "object",
                "additionalProperties": true
              }
            },
            "additionalProperties": false
          },
          "mcp_tool_call": {
            "type": "object",
            "required": [
              "name",
              "arguments"
            ],
            "properties": {
              "name": {
                "type": "string",
                "enum": [
                  "call_endpoint",
                  "call_marketplace_endpoint"
                ]
              },
              "arguments": {
                "type": "object",
                "required": [
                  "endpoint_name",
                  "params"
                ],
                "properties": {
                  "api_id": {
                    "type": "string",
                    "description": "Set for call_endpoint"
                  },
                  "marketplace_id": {
                    "type": "string",
                    "description": "Set for call_marketplace_endpoint"
                  },
                  "endpoint_name": {
                    "type": "string"
                  },
                  "params": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "session_id": {
                    "type": "string"
                  },
                  "encryption_key": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              }
            },
            "additionalProperties": false
          },
          "curl": {
            "type": "string"
          },
          "cli_command": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "PublicApiHealthEndpoint": {
        "type": "object",
        "required": [
          "endpoint_name",
          "success_count",
          "error_count",
          "last_status",
          "last_status_code",
          "last_run_at"
        ],
        "properties": {
          "endpoint_name": {
            "type": "string"
          },
          "success_count": {
            "type": "integer"
          },
          "error_count": {
            "type": "integer"
          },
          "last_status": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_status_code": {
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_run_at": {
            "oneOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "PublicReadyApiHealth": {
        "type": "object",
        "required": [
          "api_id",
          "version_id",
          "status",
          "success_count",
          "error_count",
          "timeout_count",
          "last_success_at",
          "last_failure_at",
          "quality_score",
          "recommended_action",
          "endpoints"
        ],
        "properties": {
          "api_id": {
            "type": "string"
          },
          "version_id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "degraded",
              "needs_rebuild"
            ]
          },
          "success_count": {
            "type": "integer"
          },
          "error_count": {
            "type": "integer"
          },
          "timeout_count": {
            "type": "integer"
          },
          "last_success_at": {
            "oneOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_failure_at": {
            "oneOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "quality_score": {
            "oneOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "recommended_action": {
            "type": "string",
            "enum": [
              "none",
              "rebuild"
            ]
          },
          "endpoints": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicApiHealthEndpoint"
            }
          }
        },
        "additionalProperties": false
      },
      "PublicPendingApiHealth": {
        "type": "object",
        "required": [
          "api_id",
          "version_id",
          "status",
          "build_status",
          "detail",
          "success_count",
          "error_count",
          "timeout_count",
          "last_success_at",
          "last_failure_at",
          "quality_score",
          "recommended_action",
          "endpoints"
        ],
        "properties": {
          "api_id": {
            "type": "string"
          },
          "version_id": {
            "type": "null"
          },
          "status": {
            "type": "string",
            "const": "pending_build"
          },
          "build_status": {
            "type": "string",
            "enum": [
              "queued",
              "running"
            ]
          },
          "detail": {
            "type": "string"
          },
          "success_count": {
            "type": "integer",
            "const": 0
          },
          "error_count": {
            "type": "integer",
            "const": 0
          },
          "timeout_count": {
            "type": "integer",
            "const": 0
          },
          "last_success_at": {
            "type": "null"
          },
          "last_failure_at": {
            "type": "null"
          },
          "quality_score": {
            "type": "null"
          },
          "recommended_action": {
            "type": "string",
            "const": "none"
          },
          "endpoints": {
            "type": "array",
            "maxItems": 0,
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        },
        "additionalProperties": false
      },
      "PublicFailedApiHealth": {
        "type": "object",
        "required": [
          "api_id",
          "version_id",
          "status",
          "build_status",
          "detail",
          "success_count",
          "error_count",
          "timeout_count",
          "failure",
          "last_success_at",
          "last_failure_at",
          "quality_score",
          "recommended_action",
          "endpoints"
        ],
        "properties": {
          "api_id": {
            "type": "string"
          },
          "version_id": {
            "type": "null"
          },
          "status": {
            "type": "string",
            "const": "build_failed"
          },
          "build_status": {
            "type": "string",
            "const": "failed"
          },
          "detail": {
            "type": "string"
          },
          "success_count": {
            "type": "integer",
            "const": 0
          },
          "error_count": {
            "type": "integer",
            "const": 1
          },
          "timeout_count": {
            "type": "integer",
            "const": 0
          },
          "failure": {
            "$ref": "#/components/schemas/PublicApiFailure"
          },
          "last_success_at": {
            "type": "null"
          },
          "last_failure_at": {
            "oneOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "quality_score": {
            "type": "null"
          },
          "recommended_action": {
            "type": "string",
            "enum": [
              "contact_support",
              "revise_task",
              "retry_later",
              "try_different_url",
              "wait_or_rebuild"
            ]
          },
          "endpoints": {
            "type": "array",
            "maxItems": 0,
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        },
        "additionalProperties": false
      },
      "PublicApiHealth": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/PublicReadyApiHealth"
          },
          {
            "$ref": "#/components/schemas/PublicPendingApiHealth"
          },
          {
            "$ref": "#/components/schemas/PublicFailedApiHealth"
          }
        ]
      },
      "PublicApiIdentity": {
        "type": "object",
        "required": [
          "api_id",
          "version_id"
        ],
        "properties": {
          "api_id": {
            "type": "string"
          },
          "version_id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "AuditActor": {
        "type": "object",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "session",
              "api_key",
              "bearer"
            ]
          },
          "user_id": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "key_id": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "AuditEvent": {
        "type": "object",
        "required": [
          "id",
          "at",
          "actor",
          "action",
          "target",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "actor": {
            "$ref": "#/components/schemas/AuditActor"
          },
          "action": {
            "type": "string",
            "description": "The method and route, such as `PATCH /v1/apis/:api_id`, or `mcp <tool>`."
          },
          "target": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "integer"
          }
        },
        "additionalProperties": false
      },
      "TeamMember": {
        "type": "object",
        "required": [
          "user_id",
          "email",
          "role",
          "added_at"
        ],
        "properties": {
          "user_id": {
            "type": "string"
          },
          "email": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "member",
              "tool"
            ]
          },
          "added_at": {
            "oneOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "TeamInvite": {
        "type": "object",
        "required": [
          "id",
          "email",
          "role",
          "expires_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "member",
              "tool"
            ]
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "Team": {
        "type": "object",
        "required": [
          "account_id",
          "members",
          "invites"
        ],
        "properties": {
          "account_id": {
            "type": "string"
          },
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TeamMember"
            }
          },
          "invites": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TeamInvite"
            }
          }
        },
        "additionalProperties": false
      },
      "TeamAccount": {
        "type": "object",
        "required": [
          "account_id",
          "role",
          "owner_email",
          "personal"
        ],
        "properties": {
          "account_id": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "member",
              "tool"
            ]
          },
          "owner_email": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "personal": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "ApiKey": {
        "type": "object",
        "required": [
          "id",
          "name",
          "start",
          "access",
          "permissions",
          "api_id",
          "created_at",
          "expires_at",
          "last_used_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "start": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The first characters of the key."
          },
          "access": {
            "type": "string",
            "enum": [
              "full",
              "run",
              "read",
              "custom"
            ]
          },
          "permissions": {
            "oneOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "Null for full access."
          },
          "api_id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The one API this key is limited to; null when it reaches the whole account."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "oneOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_used_at": {
            "oneOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "Schedule": {
        "type": "object",
        "required": [
          "id",
          "api_id",
          "endpoint_name",
          "params",
          "shape",
          "every_minutes",
          "next_run_at",
          "last_run_at",
          "last_outcome",
          "last_error",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "api_id": {
            "type": "string"
          },
          "endpoint_name": {
            "type": "string"
          },
          "params": {
            "type": "object",
            "additionalProperties": true
          },
          "shape": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": true
              },
              {
                "type": "null"
              }
            ]
          },
          "every_minutes": {
            "type": "integer",
            "minimum": 60,
            "maximum": 10080
          },
          "next_run_at": {
            "oneOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "null while the schedule is paused because Peel stopped reading its site; last_error says why."
          },
          "last_run_at": {
            "oneOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_outcome": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "first",
                  "changed",
                  "unchanged",
                  "failed"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "first is the answer later runs compare against."
          },
          "last_error": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "IssuedApiKey": {
        "type": "object",
        "required": [
          "key",
          "api_key"
        ],
        "properties": {
          "key": {
            "type": "string",
            "description": "The secret. It is shown only here."
          },
          "api_key": {
            "$ref": "#/components/schemas/ApiKey"
          }
        },
        "additionalProperties": false
      },
      "Quota": {
        "type": "object",
        "required": [
          "plan",
          "period_end",
          "runs",
          "builds",
          "build_budget",
          "daily_runs",
          "auto_recharge",
          "emails"
        ],
        "properties": {
          "plan": {
            "type": "string"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "runs": {
            "type": "object",
            "required": [
              "limit",
              "remaining",
              "reset_at"
            ],
            "properties": {
              "limit": {
                "oneOf": [
                  {
                    "type": "integer",
                    "minimum": 0
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "remaining": {
                "oneOf": [
                  {
                    "type": "integer",
                    "minimum": 0
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "reset_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "additionalProperties": false
          },
          "builds": {
            "type": "object",
            "required": [
              "limit",
              "used",
              "remaining",
              "reset_at"
            ],
            "properties": {
              "limit": {
                "oneOf": [
                  {
                    "type": "integer",
                    "minimum": 0
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "used": {
                "type": "integer",
                "minimum": 0
              },
              "remaining": {
                "oneOf": [
                  {
                    "type": "integer",
                    "minimum": 0
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "reset_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "additionalProperties": false
          },
          "build_budget": {
            "type": "object",
            "required": [
              "limit_usd",
              "used_usd",
              "remaining_usd",
              "reset_at"
            ],
            "properties": {
              "limit_usd": {
                "oneOf": [
                  {
                    "type": "number",
                    "minimum": 0
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "used_usd": {
                "type": "number",
                "minimum": 0
              },
              "remaining_usd": {
                "oneOf": [
                  {
                    "type": "number",
                    "minimum": 0
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "reset_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "additionalProperties": false,
            "description": "Model spend on builds, revisions and rebuilds this UTC month. At limit_usd new ones answer 429 quota_exceeded with details.quota build_budget until reset_at; null means no cap."
          },
          "daily_runs": {
            "type": "object",
            "required": [
              "limit",
              "used",
              "reset_at"
            ],
            "properties": {
              "limit": {
                "oneOf": [
                  {
                    "type": "integer",
                    "minimum": 0
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "used": {
                "type": "integer",
                "minimum": 0
              },
              "reset_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "additionalProperties": false
          },
          "auto_recharge": {
            "type": "object",
            "required": [
              "enabled",
              "monthly_limit"
            ],
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "monthly_limit": {
                "oneOf": [
                  {
                    "type": "integer",
                    "minimum": 0
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "additionalProperties": false
          },
          "emails": {
            "type": "object",
            "required": [
              "usage_alerts",
              "monthly_summary"
            ],
            "properties": {
              "usage_alerts": {
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 100
                }
              },
              "monthly_summary": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "PublicCreditState": {
        "type": "object",
        "required": [
          "auto_recharge_enabled",
          "auto_recharge_monthly_limit",
          "auto_recharge_pack",
          "auto_recharge_threshold",
          "credits",
          "current_period_end",
          "has_subscription",
          "is_unlimited",
          "monthly_credits",
          "plan",
          "purchased_credits",
          "subscription_credits",
          "updated_at",
          "used_credits",
          "used_purchased_credits",
          "used_subscription_credits"
        ],
        "properties": {
          "auto_recharge_enabled": {
            "type": "boolean"
          },
          "auto_recharge_monthly_limit": {
            "type": "integer",
            "minimum": 0
          },
          "auto_recharge_pack": {
            "type": "string"
          },
          "auto_recharge_threshold": {
            "type": "integer",
            "minimum": 0
          },
          "builds_allowance": {
            "oneOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Builds, revisions and rebuilds included in the current period. Null when volume is agreed by contract."
          },
          "builds_remaining": {
            "oneOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "builds_allowance minus builds_used, or null when builds_allowance is null."
          },
          "builds_used": {
            "type": "integer",
            "minimum": 0,
            "description": "Builds, revisions and rebuilds counted in the current period."
          },
          "credits": {
            "type": "integer",
            "minimum": 0
          },
          "current_period_end": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "daily_run_cap": {
            "oneOf": [
              {
                "type": "integer",
                "minimum": 1
              },
              {
                "type": "null"
              }
            ],
            "description": "Runs allowed per UTC day, or null for no cap."
          },
          "has_subscription": {
            "type": "boolean"
          },
          "is_unlimited": {
            "type": "boolean"
          },
          "monthly_credits": {
            "oneOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "payment_status": {
            "type": "string",
            "enum": [
              "ok",
              "past_due",
              "action_required"
            ]
          },
          "period_start": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Start of the current metering period."
          },
          "plan": {
            "type": "string"
          },
          "plan_id": {
            "type": "string",
            "enum": [
              "free",
              "pro",
              "enterprise"
            ],
            "description": "Stable plan identifier. The enterprise id is shown as Business in the plan label."
          },
          "purchased_credits": {
            "type": "integer",
            "minimum": 0
          },
          "runs_allowance": {
            "oneOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Runs included per period; same value as monthly_credits."
          },
          "runs_remaining": {
            "type": "integer",
            "minimum": 0,
            "description": "Runs available now, including purchased run packs; same value as credits."
          },
          "runs_today": {
            "type": "integer",
            "minimum": 0,
            "description": "Runs counted against the daily cap this UTC day."
          },
          "usage_alerts": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          "monthly_summary": {
            "type": "boolean"
          },
          "subscription_credits": {
            "type": "integer",
            "minimum": 0
          },
          "updated_at": {
            "type": "string"
          },
          "used_credits": {
            "type": "integer",
            "minimum": 0
          },
          "used_purchased_credits": {
            "type": "integer",
            "minimum": 0
          },
          "used_subscription_credits": {
            "type": "integer",
            "minimum": 0
          }
        },
        "additionalProperties": false
      },
      "DeviceAuthStartResponse": {
        "type": "object",
        "required": [
          "session_id",
          "user_code",
          "verification_url",
          "expires_at"
        ],
        "properties": {
          "session_id": {
            "type": "string",
            "format": "uuid"
          },
          "user_code": {
            "type": "string"
          },
          "verification_url": {
            "type": "string",
            "format": "uri"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "DeviceAuthExchangeRequest": {
        "type": "object",
        "required": [
          "session_id",
          "user_code"
        ],
        "properties": {
          "session_id": {
            "type": "string",
            "format": "uuid"
          },
          "user_code": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "DeviceAuthExchangeSuccess": {
        "type": "object",
        "required": [
          "api_key"
        ],
        "properties": {
          "api_key": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "DeviceAuthExchangePending": {
        "$ref": "#/components/schemas/ErrorResponse",
        "description": "The error envelope POST /public/device/exchange answers while the browser has not approved yet (`not_ready`) or after the session expired (`expired`)."
      },
      "GeneratedOpenApiExport": {
        "type": "object",
        "required": [
          "openapi",
          "info",
          "servers",
          "paths",
          "x-api-identity"
        ],
        "properties": {
          "openapi": {
            "type": "string",
            "const": "3.1.0"
          },
          "info": {
            "type": "object",
            "required": [
              "title",
              "version"
            ],
            "properties": {
              "title": {
                "type": "string"
              },
              "version": {
                "type": "string"
              },
              "description": {
                "type": "string"
              }
            },
            "additionalProperties": true
          },
          "servers": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string"
                }
              },
              "additionalProperties": true
            }
          },
          "paths": {
            "type": "object",
            "additionalProperties": true
          },
          "components": {
            "type": "object",
            "additionalProperties": true
          },
          "security": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "x-api-identity": {
            "$ref": "#/components/schemas/PublicApiIdentity"
          },
          "x-api-id": {
            "type": "string"
          },
          "x-version-id": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "GeneratedMcpExport": {
        "type": "object",
        "required": [
          "schema_version",
          "metadata",
          "server",
          "tools"
        ],
        "properties": {
          "schema_version": {
            "type": "string",
            "const": "1.0"
          },
          "metadata": {
            "type": "object",
            "required": [
              "identity"
            ],
            "properties": {
              "identity": {
                "$ref": "#/components/schemas/PublicApiIdentity"
              }
            },
            "additionalProperties": true
          },
          "server": {
            "type": "object",
            "required": [
              "name",
              "version"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              },
              "source_url": {
                "type": "string"
              }
            },
            "additionalProperties": true
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "description",
                "inputSchema",
                "annotations",
                "metadata"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "inputSchema": {
                  "type": "object",
                  "additionalProperties": true
                },
                "annotations": {
                  "type": "object",
                  "required": [
                    "api_id",
                    "endpoint_name",
                    "endpoint_type",
                    "openWorldHint",
                    "readOnlyHint",
                    "rest_method"
                  ],
                  "properties": {
                    "api_id": {
                      "type": "string"
                    },
                    "destructiveHint": {
                      "type": "boolean"
                    },
                    "endpoint_name": {
                      "type": "string"
                    },
                    "endpoint_type": {
                      "type": "string"
                    },
                    "idempotentHint": {
                      "type": "boolean"
                    },
                    "openWorldHint": {
                      "type": "boolean"
                    },
                    "readOnlyHint": {
                      "type": "boolean"
                    },
                    "rest_method": {
                      "type": "string",
                      "const": "POST"
                    },
                    "version_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                },
                "metadata": {
                  "type": "object",
                  "required": [
                    "api_id",
                    "auth_requirement",
                    "endpoint_name",
                    "endpoint_type",
                    "execution_base_url",
                    "identity",
                    "rest_method",
                    "rest_path",
                    "target_method"
                  ],
                  "properties": {
                    "api_id": {
                      "type": "string"
                    },
                    "auth_requirement": {
                      "type": "string"
                    },
                    "credit_cost": {
                      "type": "number"
                    },
                    "endpoint_name": {
                      "type": "string"
                    },
                    "endpoint_type": {
                      "type": "string"
                    },
                    "execution_base_url": {
                      "type": "string"
                    },
                    "identity": {
                      "$ref": "#/components/schemas/PublicApiIdentity"
                    },
                    "initiates_session": {
                      "type": "boolean"
                    },
                    "rest_method": {
                      "type": "string",
                      "const": "POST"
                    },
                    "rest_path": {
                      "type": "string"
                    },
                    "target_method": {
                      "type": "string"
                    },
                    "version_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              },
              "additionalProperties": true
            }
          }
        },
        "additionalProperties": true
      },
      "PublicApiFailure": {
        "type": "object",
        "required": [
          "category",
          "code",
          "message",
          "recommended_action",
          "refund_reviewable",
          "retryable",
          "support_debug_id",
          "technical_reason"
        ],
        "properties": {
          "category": {
            "type": "string",
            "description": "Coarse public category for the failed build.",
            "enum": [
              "access_policy",
              "auth_required",
              "build_timeout",
              "compile_quality",
              "infrastructure",
              "planner_failure",
              "unknown"
            ]
          },
          "code": {
            "description": "Compact build failure code, usually matching failure_reason_code on the API record.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "message": {
            "type": "string",
            "description": "User-facing summary of the failed build."
          },
          "recommended_action": {
            "type": "string",
            "description": "Recommended next action for the API owner.",
            "enum": [
              "contact_support",
              "revise_task",
              "retry_later",
              "try_different_url",
              "wait_or_rebuild"
            ]
          },
          "refund_reviewable": {
            "type": "boolean",
            "description": "Whether this failed build should be considered for refund review."
          },
          "retryable": {
            "type": "boolean",
            "description": "Whether retrying or rebuilding is expected to help."
          },
          "support_debug_id": {
            "type": "string",
            "description": "Quote this when contacting support."
          },
          "technical_reason": {
            "type": "string",
            "description": "The precise error the build stopped on."
          }
        },
        "additionalProperties": false
      },
      "PublicApiSummary": {
        "type": "object",
        "required": [
          "id",
          "url",
          "instructions",
          "name",
          "status",
          "created_at",
          "updated_at",
          "completed_at",
          "endpoint_count",
          "failure",
          "links",
          "build",
          "archived",
          "repair"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "instructions": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "oneOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "endpoint_count": {
            "type": "integer"
          },
          "failure": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PublicApiFailure"
              },
              {
                "type": "null"
              }
            ]
          },
          "version_id": {
            "type": "string"
          },
          "links": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "build": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ApiBuild"
              },
              {
                "type": "null"
              }
            ]
          },
          "archived": {
            "type": "boolean"
          },
          "repair": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ApiRepair"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "PublicApiDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PublicApiSummary"
          },
          {
            "type": "object",
            "required": [
              "description",
              "source_url",
              "error",
              "requires_session",
              "user_input_prompt",
              "endpoints"
            ],
            "properties": {
              "description": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "source_url": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "error": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "requires_session": {
                "type": "boolean"
              },
              "user_input_prompt": {
                "oneOf": [
                  {
                    "type": "object",
                    "additionalProperties": true
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "endpoints": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PublicEndpoint"
                }
              }
            },
            "additionalProperties": false
          }
        ]
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      },
      "SessionAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Session-ID",
        "description": "Target-site session ID returned by a compiled login endpoint."
      },
      "EncryptionKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Encryption-Key",
        "description": "Target-site encryption key returned by a compiled login endpoint."
      },
      "OAuthBearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "OAuth bearer token issued by Peel for hosted MCP clients."
      },
      "SessionCookieAuth": {
        "type": "apiKey",
        "in": "cookie",
        "name": "better-auth.session_token"
      }
    }
  }
}
