{
  "openapi": "3.1.0",
  "info": {
    "title": "TubeOnAI REST API",
    "version": "0.1.0"
  },
  "servers": [
    {
      "url": "https://beta.app.tubeonai.com",
      "description": "TubeOnAI V2 beta"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/ai/transcript": {
      "post": {
        "tags": [
          "Transcripts"
        ],
        "summary": "Get a transcript",
        "operationId": "ai_transcript",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TranscriptRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TranscriptReady"
                }
              }
            }
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TranscriptPending"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "STT_CONSENT_REQUIRED: `details` carries `estimate_credits` and `eta_sec`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/ai/account": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Get account and usage",
        "operationId": "ai_account",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountSummaryView"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/me": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Get the authenticated user",
        "operationId": "me",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/ai/uploads": {
      "post": {
        "tags": [
          "Uploads"
        ],
        "operationId": "ai_create_upload",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Required stable key for one immutable upload request",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateUploadRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Created"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "Create an upload"
      }
    },
    "/v1/ai/uploads/{id}": {
      "get": {
        "tags": [
          "Uploads"
        ],
        "operationId": "ai_get_upload",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadStatus"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "Get upload status"
      }
    },
    "/v1/ai/uploads/{id}/complete": {
      "post": {
        "tags": [
          "Uploads"
        ],
        "operationId": "ai_complete_upload",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Completed"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "Complete an upload"
      }
    },
    "/v1/ai/podcasts/discover": {
      "post": {
        "tags": [
          "Podcasts"
        ],
        "operationId": "ai_podcast_discover",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DiscoverBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscoveryStatus"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "Discover podcast episodes"
      }
    },
    "/v1/ai/podcasts/discover/{id}": {
      "get": {
        "tags": [
          "Podcasts"
        ],
        "operationId": "ai_podcast_discovery_get",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscoveryStatus"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "Get podcast discovery status"
      }
    },
    "/v1/ai/follow-resolutions": {
      "post": {
        "tags": [
          "Follows"
        ],
        "operationId": "ai_follow_resolve",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResolveBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FollowResolutionAccepted"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "Resolve a channel or feed"
      }
    },
    "/v1/ai/follow-resolutions/{id}": {
      "get": {
        "tags": [
          "Follows"
        ],
        "operationId": "ai_follow_resolution",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FollowResolution"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "Get channel resolution"
      }
    },
    "/v1/ai/follows": {
      "get": {
        "tags": [
          "Follows"
        ],
        "operationId": "ai_follow_list",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FollowList"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "List follows"
      },
      "post": {
        "tags": [
          "Follows"
        ],
        "operationId": "ai_follow_create",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateFollowBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FollowCreated"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "Create a follow"
      }
    },
    "/v1/ai/follows/{id}": {
      "patch": {
        "tags": [
          "Follows"
        ],
        "operationId": "ai_follow_update",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchFollowBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Follow"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "Update a follow"
      },
      "delete": {
        "tags": [
          "Follows"
        ],
        "operationId": "ai_follow_remove",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FollowRemoved"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "Remove a follow"
      }
    },
    "/v1/ai/library": {
      "get": {
        "tags": [
          "Library"
        ],
        "operationId": "ai_library_list",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "description": "Words to find in source titles (literal, case-insensitive).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "description": "Only sources of this kind.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Source kind, in the Library's vocabulary.",
              "enum": [
                "youtube",
                "article",
                "podcast",
                "media",
                "upload",
                "text"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Only items in this state.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Where an item is: `ready` (its transcript can be read), `processing`, `waiting` (for\ncaptions or a live stream to end) or `failed` (see `failure_reason`).",
              "enum": [
                "ready",
                "processing",
                "waiting",
                "failed"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "`next_cursor` from the previous page.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Page size, 1 to 100; default 20.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LibraryList"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "List saved sources"
      },
      "post": {
        "tags": [
          "Library"
        ],
        "summary": "Add sources to the library",
        "operationId": "ai_library_add",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddToLibraryRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddedToLibrary"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "INSUFFICIENT_SCOPE: the connection lacks `library:write`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/ai/library/{id}": {
      "get": {
        "tags": [
          "Library"
        ],
        "operationId": "ai_library_get",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LibraryItemDetail"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "Get a saved source"
      },
      "delete": {
        "tags": [
          "Library"
        ],
        "summary": "Delete a saved source",
        "operationId": "ai_library_delete",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "confirm",
            "in": "query",
            "description": "Must be true, sent only after the user's explicit yes.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LibraryItemDeleted"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "INSUFFICIENT_SCOPE: the connection lacks `library:write`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "CONFIRMATION_REQUIRED: ask the user, then send confirm=true",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/ai/projects": {
      "get": {
        "tags": [
          "Projects"
        ],
        "operationId": "ai_projects_list",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "description": "Words to find in project names.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "`next_cursor` from the previous page.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Page size, 1 to 100; default 20.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectList"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "List projects"
      },
      "post": {
        "tags": [
          "Projects"
        ],
        "operationId": "ai_projects_create",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProjectBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectCreated"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "INSUFFICIENT_SCOPE: the connection lacks `library:write`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "Create a project"
      }
    },
    "/v1/ai/projects/{id}": {
      "get": {
        "tags": [
          "Projects"
        ],
        "operationId": "ai_projects_get",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectInfo"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "Get a project"
      },
      "patch": {
        "tags": [
          "Projects"
        ],
        "operationId": "ai_projects_rename",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenameProjectBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectRenamed"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "INSUFFICIENT_SCOPE: the connection lacks `library:write`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "Rename a project"
      },
      "delete": {
        "tags": [
          "Projects"
        ],
        "summary": "Delete a project",
        "operationId": "ai_projects_delete",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "confirm",
            "in": "query",
            "description": "Must be true, sent only after the user's explicit yes.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectDeleted"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "INSUFFICIENT_SCOPE: the connection lacks `library:write`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "CONFIRMATION_REQUIRED: ask the user, then send confirm=true",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/ai/projects/{id}/sources": {
      "post": {
        "tags": [
          "Projects"
        ],
        "operationId": "ai_projects_add_sources",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddToProjectBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddedToProject"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "INSUFFICIENT_SCOPE: the connection lacks `library:write`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "Add sources to a project"
      }
    },
    "/v1/ai/projects/{id}/sources/{source_id}": {
      "delete": {
        "tags": [
          "Projects"
        ],
        "operationId": "ai_projects_remove_source",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "confirm",
            "in": "query",
            "description": "Must be true, sent only after the user's explicit yes.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemovedFromProject"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "INSUFFICIENT_SCOPE: the connection lacks `library:write`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "Remove a project source"
      }
    },
    "/v1/ai/publish-destinations": {
      "get": {
        "tags": [
          "Publishing"
        ],
        "operationId": "ai_publish_destinations",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DestinationList"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "INSUFFICIENT_SCOPE: the connection lacks `publish`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "List publishing destinations"
      }
    },
    "/v1/ai/posts": {
      "get": {
        "tags": [
          "Publishing"
        ],
        "operationId": "ai_posts_list",
        "parameters": [
          {
            "name": "from_ms",
            "in": "query",
            "description": "Unix milliseconds, inclusive; default a week ago.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "to_ms",
            "in": "query",
            "description": "Unix milliseconds, exclusive, at most 42 days after `from_ms`; default five weeks ahead.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "`next_cursor` from the previous page; it keeps that page's window.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Page size, 1 to 100; default 50.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostList"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "INSUFFICIENT_SCOPE: the connection lacks `publish`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "List posts"
      },
      "post": {
        "tags": [
          "Publishing"
        ],
        "summary": "Publish or schedule a post",
        "operationId": "ai_posts_create",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePostRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostAccepted"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "INSUFFICIENT_SCOPE: the connection lacks `publish`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "CONFIRMATION_REQUIRED: ask the user, then send confirm: true",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/ai/posts/{id}": {
      "get": {
        "tags": [
          "Publishing"
        ],
        "operationId": "ai_posts_get",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostDetail"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "INSUFFICIENT_SCOPE: the connection lacks `publish`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "summary": "Get a post"
      }
    },
    "/v1/ai/post-deliveries/{id}/reschedule": {
      "post": {
        "tags": [
          "Publishing"
        ],
        "summary": "Reschedule a delivery",
        "operationId": "ai_post_deliveries_reschedule",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReschedulePostBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostDeliveryChanged"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "INSUFFICIENT_SCOPE: the connection lacks `publish`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/ai/post-deliveries/{id}/cancel": {
      "post": {
        "tags": [
          "Publishing"
        ],
        "summary": "Cancel a scheduled delivery",
        "operationId": "ai_post_deliveries_cancel",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelPostBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostDeliveryChanged"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "INSUFFICIENT_SCOPE: the connection lacks `publish`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "TranscriptRequest": {
        "type": "object",
        "description": "Exactly one of `url`, `media_url`, `id`, `upload_id` or `podcast`.",
        "properties": {
          "allow_image_ocr": {
            "type": "boolean",
            "description": "Run AI image OCR only after explicit user consent to the configured credit policy."
          },
          "allow_paid_transcription": {
            "type": "boolean",
            "description": "Paid speech-to-text when there are no captions. Only after the user agreed to the cost."
          },
          "cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "`next_cursor` from the previous page. Fetch it only if the question needs more."
          },
          "format": {
            "$ref": "#/components/schemas/TranscriptFormatParam"
          },
          "id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The `id` from an earlier call: continue a pending item or fetch another page."
          },
          "media_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "Explicit native-media discovery for a URL outside the known routing hints."
          },
          "podcast": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PodcastSelector",
                "description": "One explicitly selected publisher episode; mutually exclusive with URL, item and upload."
              },
              {
                "type": "null"
              }
            ]
          },
          "poll_only": {
            "type": "boolean",
            "description": "Continue an existing item without starting another attempt if it fails. Only with `id`; defaults to false."
          },
          "upload_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "A verified Library-purpose upload returned by get_upload; never a local path."
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "description": "A YouTube video, article or public document URL. For podcasts use the explicit podcast selector."
          }
        },
        "additionalProperties": false
      },
      "TranscriptFormatParam": {
        "type": "string",
        "enum": [
          "text",
          "segments",
          "srt"
        ]
      },
      "PodcastSelector": {
        "type": "object",
        "required": [
          "feed_url",
          "episode_guid"
        ],
        "properties": {
          "episode_guid": {
            "type": "string",
            "description": "Opaque publisher identity, never an audio or transcript fetch URL."
          },
          "feed_url": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "TranscriptReady": {
        "type": "object",
        "required": [
          "id",
          "status",
          "transcript_source",
          "transcript_source_verified",
          "library_url"
        ],
        "properties": {
          "content": {
            "type": [
              "string",
              "null"
            ],
            "description": "`text` and `srt` formats."
          },
          "id": {
            "type": "string"
          },
          "language": {
            "type": [
              "string",
              "null"
            ]
          },
          "library_url": {
            "type": "string"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as `cursor` (with `id`) for the next page; null on the last page."
          },
          "segments": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/TranscriptSegment"
            },
            "description": "`segments` format."
          },
          "source": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TranscriptSourceInfo",
                "description": "Only on the first page."
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "$ref": "#/components/schemas/ReadyState"
          },
          "transcript_source": {
            "$ref": "#/components/schemas/TranscriptSourceView"
          },
          "transcript_source_verified": {
            "type": "boolean",
            "description": "False when historical processing receipts are unavailable: retain the\nlegacy source projection for compatibility, but its acquisition is unknown."
          }
        }
      },
      "TranscriptSegment": {
        "type": "object",
        "required": [
          "text"
        ],
        "properties": {
          "end_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "speaker": {
            "type": [
              "string",
              "null"
            ]
          },
          "start_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "text": {
            "type": "string"
          }
        }
      },
      "TranscriptSourceInfo": {
        "type": "object",
        "required": [
          "kind"
        ],
        "properties": {
          "duration_sec": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "kind": {
            "$ref": "#/components/schemas/SourceKindView"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "SourceKindView": {
        "type": "string",
        "description": "Coarse source representation: text includes publisher podcast transcripts and verified\nuploads without PDF page evidence. Library source kinds retain their precise identity.",
        "enum": [
          "youtube",
          "article",
          "pdf",
          "text"
        ]
      },
      "ReadyState": {
        "type": "string",
        "enum": [
          "ready"
        ]
      },
      "TranscriptSourceView": {
        "type": "string",
        "description": "Acquisition method when `transcript_source_verified` is true; otherwise the\nhistorical compatibility projection, without a claim about actual processing.",
        "enum": [
          "captions",
          "text",
          "stt"
        ]
      },
      "TranscriptPending": {
        "type": "object",
        "required": [
          "id",
          "status",
          "retry_after_sec"
        ],
        "properties": {
          "eta_sec": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "minimum": 0
          },
          "id": {
            "type": "string"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Plain-English reason when waiting."
          },
          "retry_after_sec": {
            "type": "integer",
            "format": "int32",
            "description": "Call again with `id` and `poll_only: true` after this many seconds.",
            "minimum": 0
          },
          "status": {
            "$ref": "#/components/schemas/PendingState"
          }
        }
      },
      "PendingState": {
        "type": "string",
        "enum": [
          "processing",
          "waiting"
        ]
      },
      "ErrorEnvelope": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "$ref": "#/components/schemas/ErrorBody"
          }
        }
      },
      "ErrorBody": {
        "type": "object",
        "required": [
          "code",
          "message",
          "retryable",
          "request_id"
        ],
        "properties": {
          "action": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ErrorAction"
              },
              {
                "type": "null"
              }
            ]
          },
          "code": {
            "type": "string",
            "description": "A `FailureReason` code or an API error code (`ApiErrorCode`), e.g. `SOURCE_PRIVATE`."
          },
          "details": {
            "type": [
              "object",
              "null"
            ],
            "description": "Code-specific facts, e.g. `{estimate_credits, eta_sec}` for `STT_CONSENT_REQUIRED`."
          },
          "message": {
            "type": "string"
          },
          "request_id": {
            "type": "string"
          },
          "retry_after_sec": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "minimum": 0
          },
          "retryable": {
            "type": "boolean"
          }
        }
      },
      "ErrorAction": {
        "type": "string",
        "description": "The one next step a client offers for this error; unknown values mean none.",
        "enum": [
          "sign_in",
          "upgrade",
          "edit_prompt",
          "add_api_key",
          "retry"
        ],
        "x-extensible-enum": [
          "sign_in",
          "upgrade",
          "edit_prompt",
          "add_api_key",
          "retry"
        ]
      },
      "AccountSummaryView": {
        "type": "object",
        "required": [
          "email",
          "plan",
          "credits_left",
          "free_transcripts_left_today",
          "resets_at"
        ],
        "properties": {
          "credits_left": {
            "type": "integer",
            "format": "int64"
          },
          "email": {
            "type": "string"
          },
          "free_transcripts_left_today": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "plan": {
            "type": "string",
            "description": "Plan id, or `free`."
          },
          "resets_at": {
            "type": "string",
            "description": "RFC 3339 UTC time the daily free transcripts reset."
          }
        }
      },
      "Me": {
        "type": "object",
        "required": [
          "user",
          "workspace_id",
          "workspaces",
          "signup_grant_unlockable"
        ],
        "properties": {
          "signup_grant": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/SignupGrant",
                "description": "The free signup credits of this account: `withheld` for a risky signup (a Google or\nApple sign-in unlocks them); `null` for accounts created before signup checks."
              },
              {
                "type": "null"
              }
            ]
          },
          "signup_grant_unlockable": {
            "type": "boolean",
            "description": "`true` only when `signup_grant` is `withheld`, the account signed up by email and its\naddress doesn't duplicate an account that already got the credits: a Google or Apple\nsign-in with this address would unlock them."
          },
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "workspace_id": {
            "type": "string",
            "format": "uuid",
            "description": "The workspace this request acted in (`X-Workspace-Id`, default: personal)."
          },
          "workspaces": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Workspace"
            }
          }
        }
      },
      "SignupGrant": {
        "type": "string",
        "description": "Where an account's free signup credits stand.",
        "enum": [
          "granted",
          "withheld",
          "unlocked",
          "revoked"
        ]
      },
      "User": {
        "type": "object",
        "required": [
          "id",
          "email"
        ],
        "properties": {
          "avatar_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "Workspace": {
        "type": "object",
        "required": [
          "id",
          "name",
          "kind",
          "role"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "description": "`personal` | `team`"
          },
          "name": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "description": "`owner` | `admin` | `member`"
          }
        }
      },
      "CreateUploadRequest": {
        "type": "object",
        "description": "Immutable metadata for one upload. AI clients cannot select another upload purpose.",
        "required": [
          "declared_size_bytes",
          "content_type"
        ],
        "properties": {
          "content_type": {
            "type": "string"
          },
          "declared_size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "expected_sha256": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_filename": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "additionalProperties": false
      },
      "Created": {
        "type": "object",
        "required": [
          "id",
          "expires_at_ms",
          "grant"
        ],
        "properties": {
          "expires_at_ms": {
            "type": "integer",
            "format": "int64"
          },
          "grant": {
            "$ref": "#/components/schemas/Grant"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "Grant": {
        "type": "object",
        "required": [
          "object_key",
          "upload_url",
          "headers",
          "expires_at_ms"
        ],
        "properties": {
          "expires_at_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "object_key": {
            "type": "string"
          },
          "upload_url": {
            "type": "string"
          }
        }
      },
      "UploadStatus": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Upload"
          },
          {
            "type": "object",
            "required": [
              "retry_after_sec"
            ],
            "properties": {
              "retry_after_sec": {
                "type": "integer",
                "format": "int32",
                "description": "Recheck after this many seconds; zero when verification is terminal.",
                "minimum": 0
              }
            }
          }
        ]
      },
      "Upload": {
        "type": "object",
        "required": [
          "id",
          "declared_size_bytes",
          "content_type",
          "purpose",
          "expires_at_ms",
          "ready"
        ],
        "properties": {
          "content_type": {
            "type": "string"
          },
          "declared_size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "expected_sha256": {
            "type": [
              "string",
              "null"
            ]
          },
          "expires_at_ms": {
            "type": "integer",
            "format": "int64"
          },
          "failure_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "ingest_job_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "job_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_filename": {
            "type": [
              "string",
              "null"
            ]
          },
          "output": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Output"
              },
              {
                "type": "null"
              }
            ]
          },
          "owned_output": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/OwnedOutput"
              },
              {
                "type": "null"
              }
            ]
          },
          "purpose": {
            "$ref": "#/components/schemas/UploadReadPurpose"
          },
          "ready": {
            "type": "boolean"
          }
        }
      },
      "Output": {
        "type": "object",
        "required": [
          "schema_version",
          "source_key",
          "source",
          "input",
          "normalized"
        ],
        "properties": {
          "format": {
            "type": [
              "string",
              "null"
            ],
            "description": "Format identified by the parser. Older persisted results may omit this fact."
          },
          "input": {
            "$ref": "#/components/schemas/ObjectReference"
          },
          "normalized": {
            "$ref": "#/components/schemas/ObjectReference"
          },
          "schema_version": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "source": {
            "$ref": "#/components/schemas/UploadSource"
          },
          "source_key": {
            "type": "string"
          }
        }
      },
      "ObjectReference": {
        "type": "object",
        "required": [
          "object_key",
          "size_bytes",
          "sha256",
          "content_type"
        ],
        "properties": {
          "content_type": {
            "type": "string"
          },
          "object_key": {
            "type": "string"
          },
          "sha256": {
            "type": "string"
          },
          "size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "UploadSource": {
        "type": "object",
        "required": [
          "kind",
          "workspace_id",
          "intent_id",
          "object_key",
          "declared_size_bytes",
          "content_type"
        ],
        "properties": {
          "content_type": {
            "type": "string"
          },
          "declared_size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "expected_sha256": {
            "type": [
              "string",
              "null"
            ]
          },
          "intent_id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "$ref": "#/components/schemas/UploadKind"
          },
          "object_key": {
            "type": "string"
          },
          "workspace_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "UploadKind": {
        "type": "string",
        "enum": [
          "upload"
        ]
      },
      "OwnedOutput": {
        "type": "object",
        "required": [
          "schema_version",
          "source_key",
          "input",
          "prepared"
        ],
        "properties": {
          "image": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ImageFacts"
              },
              {
                "type": "null"
              }
            ]
          },
          "input": {
            "$ref": "#/components/schemas/ObjectReference"
          },
          "media": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MediaFacts"
              },
              {
                "type": "null"
              }
            ]
          },
          "prepared": {
            "$ref": "#/components/schemas/ObjectReference"
          },
          "schema_version": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "source_key": {
            "type": "string"
          },
          "transcription_estimate_credits": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          }
        }
      },
      "ImageFacts": {
        "type": "object",
        "required": [
          "format",
          "width",
          "height",
          "normalized_bytes",
          "sha256"
        ],
        "properties": {
          "format": {
            "$ref": "#/components/schemas/ImageFormat"
          },
          "height": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "normalized_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "pdf": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PdfRenderFacts"
              },
              {
                "type": "null"
              }
            ]
          },
          "sha256": {
            "type": "string"
          },
          "width": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "ImageFormat": {
        "type": "string",
        "enum": [
          "png",
          "jpeg"
        ]
      },
      "PdfRenderFacts": {
        "type": "object",
        "required": [
          "page_count",
          "dpi"
        ],
        "properties": {
          "dpi": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "page_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "MediaFacts": {
        "type": "object",
        "required": [
          "kind",
          "format",
          "codec",
          "duration_ms"
        ],
        "properties": {
          "codec": {
            "type": "string"
          },
          "duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "format": {
            "$ref": "#/components/schemas/MediaFormat"
          },
          "kind": {
            "$ref": "#/components/schemas/MediaKind"
          }
        }
      },
      "MediaFormat": {
        "type": "string",
        "enum": [
          "mp3",
          "wav",
          "m4a",
          "aac",
          "flac",
          "ogg",
          "opus",
          "mp4",
          "mov",
          "webm",
          "mkv"
        ]
      },
      "MediaKind": {
        "type": "string",
        "enum": [
          "audio",
          "video"
        ]
      },
      "UploadReadPurpose": {
        "type": "string",
        "enum": [
          "library",
          "brand_guide"
        ]
      },
      "Completed": {
        "type": "object",
        "required": [
          "id",
          "ingest_job_id"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "ingest_job_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "DiscoverBody": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "DiscoveryStatus": {
        "type": "object",
        "required": [
          "id",
          "status"
        ],
        "properties": {
          "discovery": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DiscoveryChoices"
              },
              {
                "type": "null"
              }
            ]
          },
          "failure_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "retry_after_sec": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "minimum": 0
          },
          "status": {
            "type": "string"
          }
        }
      },
      "DiscoveryChoices": {
        "type": "object",
        "required": [
          "requested_url",
          "feed_urls"
        ],
        "properties": {
          "feed": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/FeedChoices"
              },
              {
                "type": "null"
              }
            ]
          },
          "feed_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "feed_urls": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "requested_url": {
            "type": "string"
          }
        }
      },
      "FeedChoices": {
        "type": "object",
        "required": [
          "episodes"
        ],
        "properties": {
          "episodes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EpisodeChoice"
            }
          },
          "language": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "EpisodeChoice": {
        "type": "object",
        "required": [
          "transcripts"
        ],
        "properties": {
          "guid": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "transcripts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TranscriptChoice"
            }
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "TranscriptChoice": {
        "type": "object",
        "required": [
          "format",
          "content_type"
        ],
        "properties": {
          "content_type": {
            "type": "string"
          },
          "format": {
            "type": "string"
          },
          "language": {
            "type": [
              "string",
              "null"
            ]
          },
          "rel": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ResolveBody": {
        "type": "object",
        "required": [
          "input"
        ],
        "properties": {
          "input": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "FollowResolutionAccepted": {
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "FollowResolution": {
        "type": "object",
        "required": [
          "id",
          "status",
          "preview_item_ids",
          "feed_urls"
        ],
        "properties": {
          "failure_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "feed_urls": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "fixed_follow_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "moved_to_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "preview_item_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "source": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/FollowSource"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "$ref": "#/components/schemas/FollowResolutionStatus"
          },
          "verdict": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "FollowSource": {
        "type": "object",
        "required": [
          "id",
          "kind",
          "title",
          "feed_url",
          "status"
        ],
        "properties": {
          "avatar_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "failure_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "feed_url": {
            "type": "string"
          },
          "handle": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string"
          },
          "metadata_failure_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "moved_to_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "posts_per_week": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Cached publisher-dated uploads observed in the past week; unknown until measured."
          },
          "site_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "subscriber_count": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "title": {
            "type": "string"
          },
          "typical_views": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          }
        }
      },
      "FollowResolutionStatus": {
        "type": "string",
        "enum": [
          "pending",
          "ready",
          "failed"
        ]
      },
      "FollowList": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Follow"
            }
          }
        }
      },
      "Follow": {
        "type": "object",
        "required": [
          "id",
          "source_id",
          "source",
          "topic",
          "digest",
          "auto_summary",
          "paused",
          "rules",
          "notify",
          "revision",
          "unseen_count"
        ],
        "properties": {
          "auto_summary": {
            "type": "boolean",
            "deprecated": true
          },
          "digest": {
            "type": "boolean"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "notify": {
            "type": "boolean",
            "description": "Alert me about new uploads (in-app, one notice per poll)."
          },
          "paused": {
            "type": "boolean"
          },
          "revision": {
            "type": "integer",
            "format": "int64"
          },
          "rules": {
            "$ref": "#/components/schemas/FollowRules"
          },
          "source": {
            "$ref": "#/components/schemas/FollowSource"
          },
          "source_id": {
            "type": "string",
            "format": "uuid"
          },
          "topic": {
            "type": "string"
          },
          "unseen_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "FollowRules": {
        "type": "object",
        "required": [
          "skip_shorts",
          "min_length_min",
          "keywords"
        ],
        "properties": {
          "keywords": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "min_length_min": {
            "type": "integer",
            "format": "int64"
          },
          "skip_shorts": {
            "type": "boolean"
          }
        }
      },
      "CreateFollowBody": {
        "type": "object",
        "properties": {
          "auto_summary": {
            "type": "boolean",
            "description": "Deprecated and ignored: following never summarizes by itself (Phase 10).\nUse an Automation with a Channel trigger instead.",
            "deprecated": true
          },
          "digest": {
            "type": "boolean"
          },
          "resolution_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "source_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "topic": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "FollowCreated": {
        "type": "object",
        "required": [
          "id",
          "source_id",
          "created"
        ],
        "properties": {
          "created": {
            "type": "boolean"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "source_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "PatchFollowBody": {
        "type": "object",
        "required": [
          "expected_revision"
        ],
        "properties": {
          "auto_summary": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Deprecated and ignored (Phase 10).",
            "deprecated": true
          },
          "digest": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64"
          },
          "keywords": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "min_length_min": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "notify": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Alert me about new uploads: one in-app notification per poll that brings items this\nfollow's rules keep. Omitted leaves it unchanged; never spends credits."
          },
          "paused": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "skip_shorts": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "topic": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "additionalProperties": false
      },
      "FollowRemoved": {
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "restore_until_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          }
        }
      },
      "LibraryList": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LibraryEntry"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as `cursor` for the next page; null on the last page."
          }
        }
      },
      "LibraryEntry": {
        "type": "object",
        "required": [
          "id",
          "kind",
          "status",
          "transcript_available",
          "library_url"
        ],
        "properties": {
          "failure_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string",
            "description": "Pass as `id` to get_transcript (with `poll_only: true` while pending) or get_library_item."
          },
          "kind": {
            "$ref": "#/components/schemas/SourceKind"
          },
          "library_url": {
            "type": "string",
            "description": "The item in the TubeOnAI web app."
          },
          "source_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "The original link, when the source has one."
          },
          "status": {
            "$ref": "#/components/schemas/ItemStatus"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "transcript_available": {
            "type": "boolean",
            "description": "The transcript or full text can be read now with get_transcript."
          }
        }
      },
      "SourceKind": {
        "type": "string",
        "description": "Source kind, in the Library's vocabulary.",
        "enum": [
          "youtube",
          "article",
          "podcast",
          "media",
          "upload",
          "text"
        ]
      },
      "ItemStatus": {
        "type": "string",
        "description": "Where an item is: `ready` (its transcript can be read), `processing`, `waiting` (for\ncaptions or a live stream to end) or `failed` (see `failure_reason`).",
        "enum": [
          "ready",
          "processing",
          "waiting",
          "failed"
        ]
      },
      "AddToLibraryRequest": {
        "type": "object",
        "required": [
          "urls"
        ],
        "properties": {
          "allow_paid_transcription": {
            "type": "boolean",
            "description": "Paid speech-to-text for videos without captions. Only after the user's explicit yes to\nthe quoted cost."
          },
          "urls": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "1 to 20 YouTube, article or public document URLs."
          }
        },
        "additionalProperties": false
      },
      "AddedToLibrary": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AddedEntry"
            }
          }
        }
      },
      "AddedEntry": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "error": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/EntryError"
              },
              {
                "type": "null"
              }
            ]
          },
          "failure_reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the item failed, when `status` is `failed`."
          },
          "id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The library item id; null when this URL failed (`error`)."
          },
          "retry_after_sec": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Poll get_transcript with this id and `poll_only: true` after this many seconds.",
            "minimum": 0
          },
          "status": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ItemStatus",
                "description": "The item's own state (as get_library_item reports it), not whether shared text exists."
              },
              {
                "type": "null"
              }
            ]
          },
          "url": {
            "type": "string"
          }
        }
      },
      "EntryError": {
        "type": "object",
        "description": "A per-URL failure, in the error envelope's terms.",
        "required": [
          "code",
          "message",
          "retryable"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "details": {
            "type": [
              "object",
              "null"
            ]
          },
          "message": {
            "type": "string"
          },
          "retry_after_sec": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "minimum": 0
          },
          "retryable": {
            "type": "boolean"
          }
        }
      },
      "LibraryItemDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/LibraryEntry"
          },
          {
            "type": "object",
            "required": [
              "projects"
            ],
            "properties": {
              "projects": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ProjectRef"
                },
                "description": "The projects this source is in."
              }
            }
          }
        ]
      },
      "ProjectRef": {
        "type": "object",
        "required": [
          "id",
          "name"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        }
      },
      "LibraryItemDeleted": {
        "type": "object",
        "required": [
          "id",
          "deletion_id"
        ],
        "properties": {
          "deletion_id": {
            "type": "string",
            "description": "The deletion runs in the background; the user can undo it in the web app for a short time."
          },
          "id": {
            "type": "string"
          }
        }
      },
      "ProjectList": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectSummary"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as `cursor` for the next page; null on the last page."
          }
        }
      },
      "ProjectSummary": {
        "type": "object",
        "required": [
          "id",
          "name",
          "source_count",
          "ready_source_count",
          "failed_source_count",
          "project_url"
        ],
        "properties": {
          "failed_source_count": {
            "type": "integer",
            "format": "int64"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "project_url": {
            "type": "string",
            "description": "The project in the TubeOnAI web app."
          },
          "ready_source_count": {
            "type": "integer",
            "format": "int64"
          },
          "source_count": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "CreateProjectBody": {
        "type": "object",
        "required": [
          "name",
          "sources"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "2 to 20 sources, in order: each a URL (added transcript-only) or a library item id."
          }
        },
        "additionalProperties": false
      },
      "ProjectCreated": {
        "type": "object",
        "required": [
          "id",
          "name",
          "source_ids",
          "duplicate_count",
          "project_url"
        ],
        "properties": {
          "duplicate_count": {
            "type": "integer",
            "description": "Repeated sources counted once.",
            "minimum": 0
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "project_url": {
            "type": "string"
          },
          "source_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Library item ids of the sources, in order. Poll each with get_library_item."
          }
        }
      },
      "ProjectInfo": {
        "type": "object",
        "required": [
          "id",
          "name",
          "source_count",
          "ready_count",
          "processing_count",
          "failed_count",
          "sources",
          "project_url"
        ],
        "properties": {
          "failed_count": {
            "type": "integer",
            "minimum": 0
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "processing_count": {
            "type": "integer",
            "minimum": 0
          },
          "project_url": {
            "type": "string"
          },
          "ready_count": {
            "type": "integer",
            "minimum": 0
          },
          "source_count": {
            "type": "integer",
            "minimum": 0
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectSourceView"
            },
            "description": "In project order."
          }
        }
      },
      "ProjectSourceView": {
        "type": "object",
        "required": [
          "id",
          "position",
          "status",
          "transcript_available"
        ],
        "properties": {
          "failure_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string",
            "description": "The library item id; read its transcript with get_transcript."
          },
          "position": {
            "type": "integer",
            "format": "int64"
          },
          "source_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "$ref": "#/components/schemas/ItemStatus"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "transcript_available": {
            "type": "boolean"
          }
        }
      },
      "RenameProjectBody": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "ProjectRenamed": {
        "type": "object",
        "required": [
          "id",
          "name"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        }
      },
      "ProjectDeleted": {
        "type": "object",
        "required": [
          "id",
          "deletion_id",
          "status"
        ],
        "properties": {
          "deletion_id": {
            "type": "string",
            "description": "The deletion operation; it identifies the work while dependent tasks stop."
          },
          "id": {
            "type": "string"
          },
          "restore_deadline_at_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Until then the user can restore it in the web app."
          },
          "status": {
            "type": "string",
            "description": "`cancelling` while dependent work stops, then `deleted`."
          }
        }
      },
      "AddToProjectBody": {
        "type": "object",
        "required": [
          "sources"
        ],
        "properties": {
          "sources": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "1 or more sources: each a URL (added transcript-only) or a library item id."
          }
        },
        "additionalProperties": false
      },
      "AddedToProject": {
        "type": "object",
        "required": [
          "id",
          "source_ids",
          "duplicate_count"
        ],
        "properties": {
          "duplicate_count": {
            "type": "integer",
            "minimum": 0
          },
          "id": {
            "type": "string"
          },
          "source_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Library item ids of the added sources."
          }
        }
      },
      "RemovedFromProject": {
        "type": "object",
        "required": [
          "id",
          "source_id"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "source_id": {
            "type": "string"
          }
        }
      },
      "DestinationList": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Destination"
            }
          }
        }
      },
      "Destination": {
        "type": "object",
        "required": [
          "id",
          "provider",
          "can_publish",
          "text_only_ok"
        ],
        "properties": {
          "can_publish": {
            "type": "boolean",
            "description": "False when a post can't go here now; `reason` says why."
          },
          "handle": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string",
            "description": "Pass in create_post `destinations`."
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account, page, channel, chat or site name."
          },
          "provider": {
            "type": "string",
            "description": "`x`, `linkedin`, `facebook`, `instagram`, `threads`, `bluesky`, `youtube`, `tiktok`,\n`telegram`, `wordpress`, …"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Set when `can_publish` is false: `provider_paused` (publishing to this platform is turned\noff in TubeOnAI for now) or `reconnect_required` (reconnect or finish setup in the web app)."
          },
          "text_only_ok": {
            "type": "boolean",
            "description": "False for media-only platforms (Instagram, TikTok, YouTube): create_post sends text only,\nso these refuse it."
          }
        }
      },
      "PostList": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PostDelivery"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as `cursor` for the next page of the same window; null on the last page."
          }
        }
      },
      "PostDelivery": {
        "type": "object",
        "required": [
          "id",
          "post_id",
          "destination_id",
          "provider",
          "label",
          "status",
          "due_at_ms",
          "local_time",
          "timezone",
          "revision"
        ],
        "properties": {
          "destination_id": {
            "type": "string"
          },
          "due_at_ms": {
            "type": "integer",
            "format": "int64",
            "description": "Unix milliseconds the delivery is or was due."
          },
          "failure_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string",
            "description": "Pass as `delivery_id` to reschedule_post or cancel_post."
          },
          "label": {
            "type": "string"
          },
          "local_time": {
            "type": "string"
          },
          "post_id": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "published_at_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "published_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "The published post on the platform."
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "description": "Pass as `expected_revision` to reschedule_post or cancel_post."
          },
          "status": {
            "type": "string",
            "description": "`scheduled`, `queued`, `publishing`, `published`, `failed`, `cancelled`, …"
          },
          "timezone": {
            "type": "string"
          }
        }
      },
      "CreatePostRequest": {
        "type": "object",
        "required": [
          "text",
          "destinations"
        ],
        "properties": {
          "confirm": {
            "type": "boolean",
            "description": "Must be true, sent only after the user's explicit yes to this text, these destinations\nand this time."
          },
          "destinations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PostDestination"
            },
            "description": "1 to 5 destinations."
          },
          "offset_minutes": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Minutes east of UTC, only to pick one of the two times a daylight-saving change\nrepeats (e.g. `120` or `60`); omit otherwise."
          },
          "schedule_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "Local time `YYYY-MM-DDTHH:mm` to schedule; omit to publish now."
          },
          "text": {
            "type": "string",
            "description": "The post text."
          },
          "timezone": {
            "type": [
              "string",
              "null"
            ],
            "description": "IANA timezone for `schedule_at`, e.g. `Europe/Berlin`."
          }
        },
        "additionalProperties": false
      },
      "PostDestination": {
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "A destination id from list_publish_destinations."
          },
          "privacy": {
            "type": [
              "string",
              "null"
            ],
            "description": "WordPress: `draft` (default) or `publish`."
          },
          "title": {
            "type": [
              "string",
              "null"
            ],
            "description": "Not needed for text posts (WordPress takes the first line of the text as its title)."
          }
        },
        "additionalProperties": false
      },
      "PostAccepted": {
        "type": "object",
        "required": [
          "post_id",
          "deliveries"
        ],
        "properties": {
          "deliveries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreatedDelivery"
            }
          },
          "post_id": {
            "type": "string",
            "description": "Pass to get_post for delivery status."
          }
        }
      },
      "CreatedDelivery": {
        "type": "object",
        "required": [
          "id",
          "destination_id",
          "status"
        ],
        "properties": {
          "destination_id": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        }
      },
      "PostDetail": {
        "type": "object",
        "required": [
          "post_id",
          "deliveries"
        ],
        "properties": {
          "deliveries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PostDelivery"
            },
            "description": "One per destination."
          },
          "post_id": {
            "type": "string"
          }
        }
      },
      "ReschedulePostBody": {
        "type": "object",
        "required": [
          "expected_revision",
          "schedule_at",
          "timezone"
        ],
        "properties": {
          "confirm": {
            "type": "boolean",
            "description": "Must be true, sent only after the user's explicit yes."
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "description": "The delivery's `revision` from get_post or list_posts."
          },
          "offset_minutes": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Minutes east of UTC, only to pick one of the two times a daylight-saving change\nrepeats (e.g. `120` or `60`); omit otherwise."
          },
          "schedule_at": {
            "type": "string",
            "description": "New local time `YYYY-MM-DDTHH:mm`."
          },
          "timezone": {
            "type": "string",
            "description": "IANA timezone, e.g. `Europe/Berlin`."
          }
        },
        "additionalProperties": false
      },
      "PostDeliveryChanged": {
        "type": "object",
        "required": [
          "id",
          "status",
          "revision",
          "due_at_ms"
        ],
        "properties": {
          "due_at_ms": {
            "type": "integer",
            "format": "int64"
          },
          "id": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "format": "int64"
          },
          "status": {
            "type": "string"
          }
        }
      },
      "CancelPostBody": {
        "type": "object",
        "required": [
          "expected_revision"
        ],
        "properties": {
          "confirm": {
            "type": "boolean",
            "description": "Must be true, sent only after the user's explicit yes."
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "description": "The delivery's `revision` from get_post or list_posts."
          }
        },
        "additionalProperties": false
      }
    }
  }
}
