{
  "openapi": "3.1.1",
  "info": {
    "title": "xPosts Public API",
    "version": "1.1.0-design",
    "description": "xPosts business API for capabilities, quotes, asynchronous tasks, assets, usage, and integrations. Use the origin of your xPosts environment."
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/capabilities": {
      "get": {
        "operationId": "capabilities_list",
        "summary": "capabilities_list",
        "x-required-scope": "capabilities:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "image.generate",
                "video.generate",
                "social.query",
                "social.analyze"
              ]
            }
          },
          {
            "name": "platform",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,31}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapabilityPage"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/capabilities/{id}": {
      "get": {
        "operationId": "capabilities_get",
        "summary": "capabilities_get",
        "x-required-scope": "capabilities:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Capability"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/quotes": {
      "post": {
        "operationId": "quotes_create",
        "summary": "quotes_create",
        "x-required-scope": "tasks:create",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Quote"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuoteInput"
              }
            }
          }
        }
      }
    },
    "/v1/tasks": {
      "post": {
        "operationId": "tasks_create",
        "summary": "tasks_create",
        "x-required-scope": "tasks:create",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskInput"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "tasks_list",
        "summary": "tasks_list",
        "x-required-scope": "tasks:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "queued",
                "running",
                "succeeded",
                "failed",
                "canceled"
              ]
            }
          },
          {
            "name": "entry",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "web",
                "api",
                "skill",
                "mcp"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "image.generate",
                "video.generate",
                "social.query",
                "social.analyze"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskPage"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tasks/{id}": {
      "get": {
        "operationId": "tasks_get",
        "summary": "tasks_get",
        "x-required-scope": "tasks:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskDetail"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tasks/{id}/cancel": {
      "post": {
        "operationId": "tasks_cancel",
        "summary": "tasks_cancel",
        "x-required-scope": "tasks:cancel",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/assets/uploads": {
      "post": {
        "operationId": "assets_upload",
        "summary": "assets_upload",
        "x-required-scope": "assets:write",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Upload"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UploadInput"
              }
            }
          }
        }
      }
    },
    "/v1/assets/{id}/complete": {
      "post": {
        "operationId": "assets_complete",
        "summary": "assets_complete",
        "x-required-scope": "assets:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Asset"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/assets": {
      "get": {
        "operationId": "assets_list",
        "summary": "assets_list",
        "x-required-scope": "assets:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "origin",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "upload",
                "output"
              ]
            }
          },
          {
            "name": "media",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "image",
                "video"
              ]
            }
          },
          {
            "name": "created_from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssetPage"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/assets/{id}": {
      "get": {
        "operationId": "assets_get",
        "summary": "assets_get",
        "x-required-scope": "assets:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Asset"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "assets_delete",
        "summary": "assets_delete",
        "x-required-scope": "assets:delete",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/assets/{id}/download": {
      "get": {
        "operationId": "assets_download",
        "summary": "assets_download",
        "x-required-scope": "assets:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Download"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/usage": {
      "get": {
        "operationId": "usage_get",
        "summary": "usage_get",
        "x-required-scope": "usage:read",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Usage"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks": {
      "get": {
        "operationId": "webhooks_list",
        "summary": "webhooks_list",
        "x-required-scope": "webhooks:write",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookPage"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "webhooks_create",
        "summary": "webhooks_create",
        "x-required-scope": "webhooks:write",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookCreated"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookInput"
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/{id}": {
      "delete": {
        "operationId": "webhooks_delete",
        "summary": "webhooks_delete",
        "x-required-scope": "webhooks:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/{id}/deliveries": {
      "get": {
        "operationId": "webhooks_deliveries",
        "summary": "webhooks_deliveries",
        "x-required-scope": "webhooks:write",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryPage"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/{id}/rotate-key": {
      "post": {
        "operationId": "webhooks_rotate_key",
        "summary": "webhooks_rotate_key",
        "x-required-scope": "webhooks:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookRotation"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/{id}/test": {
      "post": {
        "operationId": "webhooks_test",
        "summary": "webhooks_test",
        "x-required-scope": "webhooks:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Delivery"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/{id}/replay": {
      "post": {
        "operationId": "webhooks_replay",
        "summary": "webhooks_replay",
        "x-required-scope": "webhooks:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Delivery"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplayInput"
              }
            }
          }
        }
      }
    },
    "/v1/prompt-review": {
      "get": {
        "operationId": "prompt_review_status",
        "summary": "prompt_review_status",
        "x-required-scope": "tasks:create",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PromptReviewStatus"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "prompt_review",
        "summary": "prompt_review",
        "x-required-scope": "tasks:create",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PromptReviewResult"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PromptReviewInput"
              }
            }
          }
        }
      }
    },
    "/v1/prompt-review/assets": {
      "post": {
        "operationId": "prompt_review_assets",
        "summary": "prompt_review_assets",
        "x-required-scope": "tasks:create",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PromptReviewResult"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PromptReviewAssetInput"
              }
            }
          }
        },
        "description": "Supply authorized, ready private JPEG asset IDs. Referencing assets also requires assets:read."
      }
    },
    "/v1/credentials/self": {
      "delete": {
        "operationId": "credentials_self_revoke",
        "summary": "credentials_self_revoke",
        "x-required-scope": "self",
        "parameters": [],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Structured error; 401/403/404/409/410/422/429/503 and 402 where applicable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "retryable": {
                "type": "boolean"
              },
              "request_id": {
                "type": "string"
              },
              "param": {
                "type": "string"
              },
              "retry_after_seconds": {
                "type": "integer",
                "minimum": 1
              }
            },
            "required": [
              "code",
              "message",
              "retryable",
              "request_id"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      },
      "Capability": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "image.generate",
              "video.generate",
              "social.query",
              "social.analyze"
            ]
          },
          "availability": {
            "type": "string",
            "enum": [
              "available",
              "unavailable"
            ]
          },
          "schema_hash": {
            "type": "string"
          },
          "input_schema": {
            "type": "object",
            "additionalProperties": true
          },
          "limits": {
            "type": "object",
            "additionalProperties": true
          },
          "display_name": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "model_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "platform": {
            "type": [
              "string",
              "null"
            ]
          },
          "operation": {
            "type": "string"
          },
          "unavailable_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "output_schema": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": [
          "id",
          "version",
          "kind",
          "availability",
          "schema_hash",
          "input_schema",
          "limits",
          "display_name",
          "provider",
          "model_id",
          "platform",
          "operation",
          "unavailable_reason",
          "output_schema"
        ],
        "additionalProperties": false
      },
      "QuoteInput": {
        "type": "object",
        "properties": {
          "capability_id": {
            "type": "string"
          },
          "capability_version": {
            "type": "string"
          },
          "input": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": [
          "capability_id",
          "capability_version",
          "input"
        ],
        "additionalProperties": false
      },
      "Quote": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "unit": {
            "type": "string"
          },
          "max_units": {
            "type": "integer",
            "minimum": 0
          },
          "price_version": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "unit",
          "max_units",
          "price_version",
          "expires_at"
        ],
        "additionalProperties": false
      },
      "TaskInput": {
        "type": "object",
        "properties": {
          "capability_id": {
            "type": "string"
          },
          "capability_version": {
            "type": "string"
          },
          "input": {
            "type": "object",
            "additionalProperties": true,
            "description": "Validate against the selected capability schema; social.analyze uses SocialAnalyzeInput."
          },
          "quote_id": {
            "type": "string",
            "format": "uuid"
          },
          "client_request_id": {
            "type": "string",
            "format": "uuid"
          },
          "webhook_endpoint_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "capability_id",
          "capability_version",
          "input",
          "quote_id",
          "client_request_id"
        ],
        "additionalProperties": false
      },
      "Task": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "client_request_id": {
            "type": "string",
            "format": "uuid"
          },
          "capability_id": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "succeeded",
              "failed",
              "canceled"
            ]
          },
          "stage": {
            "type": [
              "string",
              "null"
            ]
          },
          "cancel_requested": {
            "type": "boolean"
          },
          "reconcile_state": {
            "type": "string",
            "enum": [
              "none",
              "pending",
              "resolved"
            ]
          },
          "billing_state": {
            "type": "string",
            "enum": [
              "reserved",
              "settled",
              "released",
              "reconciliation"
            ]
          },
          "output_asset_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "error": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Error"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "result_available": {
            "type": "boolean"
          },
          "entry": {
            "type": "string",
            "enum": [
              "web",
              "skill",
              "mcp",
              "api"
            ]
          }
        },
        "required": [
          "id",
          "client_request_id",
          "capability_id",
          "state",
          "stage",
          "cancel_requested",
          "reconcile_state",
          "billing_state",
          "output_asset_ids",
          "created_at",
          "updated_at",
          "result_available"
        ],
        "additionalProperties": false
      },
      "UploadInput": {
        "type": "object",
        "properties": {
          "filename": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "media_type": {
            "type": "string"
          },
          "size": {
            "type": "integer",
            "minimum": 1,
            "maximum": 104857600
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "required": [
          "filename",
          "media_type",
          "size",
          "sha256"
        ],
        "additionalProperties": false
      },
      "Upload": {
        "type": "object",
        "properties": {
          "asset_id": {
            "type": "string",
            "format": "uuid"
          },
          "upload_url": {
            "type": "string",
            "format": "uri"
          },
          "method": {
            "const": "PUT"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "asset_id",
          "upload_url",
          "method",
          "headers",
          "expires_at"
        ],
        "additionalProperties": false
      },
      "Asset": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "filename": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "uploading",
              "validating",
              "ready",
              "failed",
              "deleted",
              "expired"
            ]
          },
          "origin": {
            "type": "string",
            "enum": [
              "upload",
              "output"
            ]
          },
          "media_type": {
            "type": "string"
          },
          "size": {
            "type": "integer",
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "status",
          "origin",
          "media_type",
          "size",
          "created_at",
          "expires_at"
        ],
        "additionalProperties": false
      },
      "Download": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "url",
          "expires_at"
        ],
        "additionalProperties": false
      },
      "Usage": {
        "type": "object",
        "properties": {
          "resource_scope": {
            "type": "string",
            "enum": [
              "own",
              "workspace"
            ]
          },
          "unit": {
            "type": "string"
          },
          "consumed_units": {
            "type": "integer",
            "minimum": 0
          },
          "reserved_units": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "resource_scope",
          "unit",
          "consumed_units",
          "reserved_units"
        ],
        "additionalProperties": false
      },
      "WebhookInput": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "task.succeeded",
                "task.failed",
                "task.canceled"
              ]
            }
          }
        },
        "required": [
          "url",
          "events"
        ],
        "additionalProperties": false
      },
      "Webhook": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "disabled"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "url",
          "events",
          "status",
          "created_at"
        ],
        "additionalProperties": false
      },
      "WebhookCreated": {
        "type": "object",
        "properties": {
          "endpoint": {
            "$ref": "#/components/schemas/Webhook"
          },
          "signing_key": {
            "type": "string"
          },
          "key_id": {
            "type": "string"
          }
        },
        "required": [
          "endpoint",
          "signing_key",
          "key_id"
        ],
        "additionalProperties": false
      },
      "Delivery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "task_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "attempt": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "succeeded",
              "failed"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "event_type": {
            "type": "string",
            "enum": [
              "task.succeeded",
              "task.failed",
              "task.canceled",
              "endpoint.test"
            ]
          },
          "chain_id": {
            "type": "string",
            "format": "uuid"
          },
          "chain_status": {
            "enum": [
              "active",
              "succeeded",
              "failed",
              "canceled"
            ]
          },
          "replayable": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "event_id",
          "task_id",
          "attempt",
          "status",
          "created_at",
          "event_type",
          "chain_id",
          "chain_status",
          "replayable"
        ],
        "additionalProperties": false
      },
      "WebhookEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "task.succeeded",
              "task.failed",
              "task.canceled"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "type": "object",
            "properties": {
              "task_id": {
                "type": "string",
                "format": "uuid"
              },
              "state": {
                "type": "string",
                "enum": [
                  "queued",
                  "running",
                  "succeeded",
                  "failed",
                  "canceled"
                ]
              }
            },
            "required": [
              "task_id",
              "state"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "type",
          "created_at",
          "data"
        ],
        "additionalProperties": false
      },
      "SocialItem": {
        "type": "object",
        "properties": {
          "source_platform": {
            "type": "string"
          },
          "source_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "source_id": {
            "type": "string"
          },
          "queried_at": {
            "type": "string",
            "format": "date-time"
          },
          "published_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "author": {
            "type": "object",
            "properties": {
              "id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "metrics": {
            "type": "object",
            "properties": {
              "views": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              },
              "likes": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              },
              "comments": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              },
              "shares": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              }
            },
            "required": [
              "views",
              "likes",
              "comments",
              "shares"
            ],
            "additionalProperties": false
          },
          "media_refs": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "provider_fields": {
            "type": "object",
            "additionalProperties": true
          },
          "cover_url": {
            "type": "string",
            "format": "uri",
            "description": "Optional public YouTube or Bilibili JPEG preview. The URL carries no signed query parameters and is never an owned asset."
          }
        },
        "required": [
          "source_platform",
          "source_url",
          "source_id",
          "queried_at",
          "published_at",
          "author",
          "text",
          "metrics",
          "media_refs",
          "provider_fields"
        ],
        "additionalProperties": false
      },
      "SocialQueryResult": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SocialItem"
            }
          },
          "next_source_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "metric_definitions": {
            "type": "object",
            "properties": {
              "views": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "likes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "comments": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "shares": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "views",
              "likes",
              "comments",
              "shares"
            ],
            "additionalProperties": false
          },
          "result_kind": {
            "const": "content"
          },
          "completeness": {
            "enum": [
              "complete",
              "partial"
            ]
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "stop_reason": {
            "type": "string"
          }
        },
        "required": [
          "items",
          "next_source_cursor",
          "metric_definitions",
          "result_kind",
          "completeness",
          "warnings",
          "stop_reason"
        ],
        "additionalProperties": false
      },
      "SocialAnalyzeInput": {
        "type": "object",
        "properties": {
          "source_task_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "minItems": 1,
            "maxItems": 20,
            "uniqueItems": true
          },
          "group_by": {
            "type": "string",
            "enum": [
              "platform",
              "platform_day"
            ]
          },
          "timezone": {
            "const": "UTC"
          },
          "deduplication": {
            "const": "platform_source_id_latest_query"
          },
          "result_kind": {
            "enum": [
              "content",
              "creator",
              "comment"
            ]
          },
          "source_item_indexes": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 0
            },
            "minItems": 1,
            "maxItems": 100,
            "uniqueItems": true,
            "description": "Zero-based positions in the immutable result. When present, supply exactly one source_task_id."
          }
        },
        "required": [
          "source_task_ids",
          "group_by",
          "timezone",
          "deduplication",
          "result_kind"
        ],
        "additionalProperties": false,
        "dependentSchemas": {
          "source_item_indexes": {
            "type": "object",
            "properties": {
              "source_task_ids": {
                "type": "array",
                "maxItems": 1
              }
            }
          }
        }
      },
      "MetricStats": {
        "type": "object",
        "properties": {
          "present_count": {
            "type": "integer",
            "minimum": 0
          },
          "missing_count": {
            "type": "integer",
            "minimum": 0
          },
          "missing_rate": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 1
          },
          "sum": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "min": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "max": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "mean": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          }
        },
        "required": [
          "present_count",
          "missing_count",
          "missing_rate",
          "sum",
          "min",
          "max",
          "mean"
        ],
        "additionalProperties": false
      },
      "AnalysisGroup": {
        "type": "object",
        "properties": {
          "source_platform": {
            "type": "string"
          },
          "day": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "count": {
            "type": "integer",
            "minimum": 0
          },
          "metrics": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "views": {
                    "$ref": "#/components/schemas/MetricStats"
                  },
                  "likes": {
                    "$ref": "#/components/schemas/MetricStats"
                  },
                  "comments": {
                    "$ref": "#/components/schemas/MetricStats"
                  },
                  "shares": {
                    "$ref": "#/components/schemas/MetricStats"
                  }
                },
                "required": [
                  "views",
                  "likes",
                  "comments",
                  "shares"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "followers": {
                    "$ref": "#/components/schemas/MetricStats"
                  },
                  "following": {
                    "$ref": "#/components/schemas/MetricStats"
                  },
                  "posts": {
                    "$ref": "#/components/schemas/MetricStats"
                  }
                },
                "required": [
                  "followers",
                  "following",
                  "posts"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "likes": {
                    "$ref": "#/components/schemas/MetricStats"
                  },
                  "replies": {
                    "$ref": "#/components/schemas/MetricStats"
                  }
                },
                "required": [
                  "likes",
                  "replies"
                ],
                "additionalProperties": false
              }
            ]
          }
        },
        "required": [
          "source_platform",
          "day",
          "count",
          "metrics"
        ],
        "additionalProperties": false
      },
      "SocialAnalyzeResult": {
        "type": "object",
        "properties": {
          "algorithm_version": {
            "const": "social-stats/2"
          },
          "source_task_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "group_by": {
            "type": "string",
            "enum": [
              "platform",
              "platform_day"
            ]
          },
          "timezone": {
            "const": "UTC"
          },
          "sample_count": {
            "type": "integer",
            "minimum": 0
          },
          "duplicate_count": {
            "type": "integer",
            "minimum": 0
          },
          "unknown_date_count": {
            "type": "integer",
            "minimum": 0
          },
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AnalysisGroup"
            }
          },
          "result_kind": {
            "enum": [
              "content",
              "creator",
              "comment"
            ]
          },
          "partial_source_task_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "uniqueItems": true,
            "maxItems": 20,
            "description": "Source query task IDs marked partial when the analysis ran. Older results can omit this field."
          }
        },
        "required": [
          "algorithm_version",
          "source_task_ids",
          "group_by",
          "timezone",
          "sample_count",
          "duplicate_count",
          "unknown_date_count",
          "groups",
          "result_kind"
        ],
        "additionalProperties": false
      },
      "WebhookRotation": {
        "type": "object",
        "properties": {
          "key_id": {
            "type": "string"
          },
          "signing_key": {
            "type": "string"
          },
          "previous_key_valid_until": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "key_id",
          "signing_key",
          "previous_key_valid_until"
        ],
        "additionalProperties": false
      },
      "WebhookTestEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "const": "endpoint.test"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "type": "object",
            "properties": {
              "test": {
                "const": true
              }
            },
            "required": [
              "test"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "type",
          "created_at",
          "data"
        ],
        "additionalProperties": false
      },
      "ReplayInput": {
        "type": "object",
        "properties": {
          "delivery_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "delivery_id"
        ],
        "additionalProperties": false
      },
      "SocialCreator": {
        "type": "object",
        "properties": {
          "source_platform": {
            "type": "string"
          },
          "source_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "source_id": {
            "type": "string"
          },
          "queried_at": {
            "type": "string",
            "format": "date-time"
          },
          "published_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "metrics": {
            "type": "object",
            "properties": {
              "followers": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              },
              "following": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              },
              "posts": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              }
            },
            "required": [
              "followers",
              "following",
              "posts"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "source_platform",
          "source_url",
          "source_id",
          "queried_at",
          "published_at",
          "name",
          "text",
          "metrics"
        ],
        "additionalProperties": false
      },
      "SocialComment": {
        "type": "object",
        "properties": {
          "source_platform": {
            "type": "string"
          },
          "source_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "source_id": {
            "type": "string"
          },
          "queried_at": {
            "type": "string",
            "format": "date-time"
          },
          "published_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "metrics": {
            "type": "object",
            "properties": {
              "likes": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              },
              "replies": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              }
            },
            "required": [
              "likes",
              "replies"
            ],
            "additionalProperties": false
          },
          "content_id": {
            "type": "string"
          },
          "parent_comment_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "author_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "source_platform",
          "source_url",
          "source_id",
          "queried_at",
          "published_at",
          "name",
          "text",
          "metrics",
          "content_id",
          "parent_comment_id",
          "author_id"
        ],
        "additionalProperties": false
      },
      "CreatorQueryResult": {
        "type": "object",
        "properties": {
          "result_kind": {
            "const": "creator"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SocialCreator"
            }
          },
          "next_source_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "metric_definitions": {
            "type": "object",
            "properties": {
              "followers": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "following": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "posts": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "followers",
              "following",
              "posts"
            ],
            "additionalProperties": false
          },
          "completeness": {
            "enum": [
              "complete",
              "partial"
            ]
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "stop_reason": {
            "type": "string"
          }
        },
        "required": [
          "result_kind",
          "items",
          "next_source_cursor",
          "metric_definitions",
          "completeness",
          "warnings",
          "stop_reason"
        ],
        "additionalProperties": false
      },
      "CommentQueryResult": {
        "type": "object",
        "properties": {
          "result_kind": {
            "const": "comment"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SocialComment"
            }
          },
          "next_source_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "metric_definitions": {
            "type": "object",
            "properties": {
              "likes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "replies": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "likes",
              "replies"
            ],
            "additionalProperties": false
          },
          "completeness": {
            "enum": [
              "complete",
              "partial"
            ]
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "stop_reason": {
            "type": "string"
          }
        },
        "required": [
          "result_kind",
          "items",
          "next_source_cursor",
          "metric_definitions",
          "completeness",
          "warnings",
          "stop_reason"
        ],
        "additionalProperties": false
      },
      "QueryResult": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/SocialQueryResult"
          },
          {
            "$ref": "#/components/schemas/CreatorQueryResult"
          },
          {
            "$ref": "#/components/schemas/CommentQueryResult"
          }
        ]
      },
      "TaskDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "client_request_id": {
            "type": "string",
            "format": "uuid"
          },
          "capability_id": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "succeeded",
              "failed",
              "canceled"
            ]
          },
          "stage": {
            "type": [
              "string",
              "null"
            ]
          },
          "cancel_requested": {
            "type": "boolean"
          },
          "reconcile_state": {
            "type": "string",
            "enum": [
              "none",
              "pending",
              "resolved"
            ]
          },
          "billing_state": {
            "type": "string",
            "enum": [
              "reserved",
              "settled",
              "released",
              "reconciliation"
            ]
          },
          "output_asset_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "result": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/QueryResult"
              },
              {
                "$ref": "#/components/schemas/SocialAnalyzeResult"
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "enum": [
                      "image",
                      "video"
                    ]
                  },
                  "asset_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                },
                "required": [
                  "kind",
                  "asset_ids"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Error"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "capability_version": {
            "type": "string"
          },
          "input_snapshot": {
            "type": "object",
            "additionalProperties": true
          },
          "input_asset_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "entry": {
            "enum": [
              "web",
              "skill",
              "mcp",
              "api"
            ]
          },
          "quote_snapshot": {
            "$ref": "#/components/schemas/Quote"
          }
        },
        "required": [
          "id",
          "client_request_id",
          "capability_id",
          "state",
          "stage",
          "cancel_requested",
          "reconcile_state",
          "billing_state",
          "output_asset_ids",
          "created_at",
          "updated_at",
          "capability_version",
          "input_snapshot",
          "input_asset_ids",
          "entry",
          "quote_snapshot"
        ],
        "additionalProperties": false
      },
      "CapabilityPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Capability"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "next_cursor"
        ],
        "additionalProperties": false
      },
      "TaskPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Task"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "next_cursor"
        ],
        "additionalProperties": false
      },
      "AssetPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Asset"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "next_cursor"
        ],
        "additionalProperties": false
      },
      "WebhookPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Webhook"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "next_cursor"
        ],
        "additionalProperties": false
      },
      "DeliveryPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Delivery"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "next_cursor"
        ],
        "additionalProperties": false
      },
      "PromptReviewStatus": {
        "type": "object",
        "properties": {
          "available": {
            "type": "boolean"
          }
        },
        "required": [
          "available"
        ],
        "additionalProperties": false
      },
      "PromptReviewInput": {
        "type": "object",
        "properties": {
          "operation": {
            "type": "string",
            "enum": [
              "review",
              "derive"
            ],
            "default": "review"
          },
          "kind": {
            "type": "string",
            "enum": [
              "image",
              "video"
            ]
          },
          "prompt": {
            "type": "string",
            "maxLength": 8000
          },
          "settings": {
            "type": "object"
          },
          "images": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "type": "string",
              "pattern": "^data:image/jpeg;base64,",
              "maxLength": 350000
            }
          },
          "image_numbers": {
            "type": "array",
            "maxItems": 32,
            "uniqueItems": true,
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Optional original reference numbers, one for each image, in the same order."
          },
          "frames": {
            "type": "array",
            "maxItems": 12,
            "items": {
              "type": "object",
              "properties": {
                "seconds": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 60
                },
                "url": {
                  "type": "string",
                  "pattern": "^data:image/jpeg;base64,",
                  "maxLength": 350000
                }
              },
              "required": [
                "seconds",
                "url"
              ],
              "additionalProperties": false
            }
          },
          "mask": {
            "type": "string",
            "pattern": "^data:image/jpeg;base64,",
            "maxLength": 350000
          }
        },
        "required": [
          "kind"
        ],
        "additionalProperties": false
      },
      "PromptReviewResult": {
        "type": "object",
        "properties": {
          "questions": {
            "type": "array",
            "maxItems": 2,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 400
            }
          },
          "plan": {
            "type": "array",
            "minItems": 1,
            "maxItems": 8,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 400
            }
          },
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          }
        },
        "required": [
          "questions",
          "plan",
          "prompt"
        ],
        "additionalProperties": false
      },
      "PromptReviewAssetInput": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "image",
              "video"
            ]
          },
          "operation": {
            "type": "string",
            "enum": [
              "review",
              "derive"
            ],
            "default": "review"
          },
          "prompt": {
            "type": "string",
            "maxLength": 8000
          },
          "settings": {
            "type": "object"
          },
          "image_numbers": {
            "type": "array",
            "maxItems": 32,
            "uniqueItems": true,
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Optional original reference numbers, one for each image, in the same order."
          },
          "confirmed": {
            "type": "boolean",
            "const": true,
            "description": "The user confirmed sending the specified prompt, settings and previews to the review provider."
          },
          "image_asset_ids": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "frame_assets": {
            "type": "array",
            "maxItems": 12,
            "items": {
              "type": "object",
              "properties": {
                "seconds": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 60
                },
                "asset_id": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "required": [
                "seconds",
                "asset_id"
              ],
              "additionalProperties": false
            }
          },
          "mask_asset_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "kind",
          "confirmed"
        ],
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  }
}
