openapi: 3.1.0
info:
  title: Auto Content Engine API
  description: |
    The GEN Auto Content Engine API takes a raw idea all the way to a published video — agent setup, idea research, vidsheet production, layer composition, render, and publish.

    ## The 5-step journey

    Every operation belongs to one phase of a 5-step user journey. Each operation carries an `x-phase` extension you can filter on:

    | Phase | Meaning |
    |-------|---------|
    | `setup` | Step 1 — Set Up Your Agent (identity, voice, personality, API keys, workspaces) |
    | `ideas` | Step 2 — Generate Content Ideas (trending data, research, refinement, preferences) |
    | `convert` | Step 3 — Convert Idea to Vidsheet (clone template or build custom engine) |
    | `edit` | Step 4 — Edit & Generate (cells, layers, creation cards, trigger + poll) |
    | `export` | Step 5 — Export & Publish (render, download, publish to social) |

    Full journey-oriented docs: https://api.gen.pro

    ## Authentication

    All endpoints require authentication via one of:

    - **API Key** (recommended): Pass your API key in the `X-API-Key` header. Create keys on the agent's API page in the GEN dashboard.
    - **JWT**: Pass a Bearer JWT in the `Authorization: Bearer <token>` header.

    ## Base URLs

    ```
    https://api.gen.pro/v1       — agent setup, vidsheets, generations, renders, publishing
    https://agent.gen.pro/v1     — content ideas, research, conversations, chat
    https://agent-core.gen.pro/v1 — agent core (brand profile, watchlists, scheduled tasks)
    https://python.gen.pro        — social publishing integration (connect, schedule, remove posts)
    ```

    Each operation carries its own `servers` entry, so a generated client or a
    hand-written call goes to the backend that serves the route.

    ## Credits

    All `/v1/vidsheet/` endpoints require an active GEN credit balance.
    If your organization has no usable credits, requests return `422` with error code `usable_gen_credit_required`.

    Credits can be funded with x402 by calling `POST /v1/x402_credit_purchase`
    with `workspace_id` plus `amount_usd` or `credits`. If `network` is omitted,
    GEN returns every configured payment option in `payment_methods` and
    `payment_required.accepts`; show the Sui, Solana, and Base options to the
    user or calling agent and sign one selected accept entry. Workspace funding
    wallets are backend settlement infrastructure; the user-facing payment
    choices are the returned payment methods.

  version: 1.0.0
  contact:
    name: GEN Support
    url: https://gen.pro
  license:
    name: Proprietary

servers:
  - url: https://api.gen.pro/v1
    description: Auto Content Engine API
  - url: https://agent.gen.pro/v1
    description: Agent Chat API
  - url: https://agent-core.gen.pro/v1
    description: Agent Core API (watchlists)
  - url: https://python.gen.pro
    description: Publishing integration API (social connect and scheduling)

security:
  - apiKey: []
  - bearerAuth: []

tags:
  - name: Discovery
    description: Identify the authenticated user, their workspaces, and agents.
  - name: API Keys
    description: Create and manage Personal Access Tokens (PATs) for API authentication.
  - name: Sheets
    description: Create and retrieve Auto Content Engine sheets (vidsheets).
  - name: Rows
    description: Manage rows within a sheet.
  - name: Columns
    description: Manage columns within a sheet.
  - name: Cells
    description: Read and update individual cells.
  - name: Layers
    description: Manage video layers within cells.
  - name: Generations
    description: Trigger AI content generation on cells and layers.
  - name: Variables
    description: Global variables for template substitution.
  - name: Automation
    description: Agent-level webhook and callback configuration.
  - name: Content Monitoring
    description: Monitor and discover social media content across multiple platforms.
  - name: Publishing
    description: Post and schedule content to social media platforms.
  - name: Templates
    description: Browse and clone pre-configured engine templates.
  - name: Agents
    description: Create, read, update, and delete agents and their avatars.
  - name: Characters
    description: A person the agent can appear as, with looks (images) and talking characters (talking videos). Characters were called avatars; the /v1/avatars routes still work as deprecated aliases.
  - name: Organizations
    description: Manage organizations (workspaces).
  - name: Billing
    description: Credit balance, plans, transactions, and credit purchase flows.
  - name: Content Resources
    description: Upload and manage content resources (images, videos, audio).
  - name: Asset Libraries
    description: Browse asset libraries and manage asset folders.
  - name: Direct Upload
    description: Get pre-signed S3 URLs for large file uploads.
  - name: Agent Profile
    description: (Legacy) Manage the agent's identity, voice, and brand profile. Prefer Agent Core for new work.
  - name: Agent Core
    description: |
      **Preferred** single-endpoint read/write for the agent setup canvas. One flat PATCH updates every brand field, personality, and default voice in a single call. Field names mirror what the FE Setup canvas saves, so developers and the FE speak the same language.
  - name: Proof of Genesis
    description: |
      Back up GEN assets to Walrus with verifiable hashes. Base URL `https://agent-core.gen.pro/v1`. Public assets may be uploaded raw; private assets must be encrypted before upload because Walrus blobs are public by default. Default automatic sources are downloaded and published assets; generated/uploaded sources are supported for opt-in or manual flows.
      Storage is monthly: Agent Core writes Walrus blobs for two epochs (~28 days), charges Rails operation `backup_to_blockchain` in GB-month units after upload/readback verification, and marks renewal due three days before expiry.
  - name: Agent Voice
    description: |
      Voice library, ElevenLabs integration, prompt-based design (4-step flow), audio-sample cloning, async TTS preview.
  - name: Agent Chat
    description: |
      Conversational AI agent interface. All endpoints use base URL `https://agent.gen.pro/v1`.
  - name: Song Mixes
    description: |
      Backend/API-first DJ-style song mixing. Base URL `https://agent.gen.pro/v1`.
  - name: Watchlists
    description: |
      Named collections of monitoring sources (accounts, hashtags, keywords) per
      agent. Base URL `https://agent-core.gen.pro/v1`. Scraped data feeds back
      into agent chat and content idea generation. CRUD operations are free;
      downstream scrapes bill normally.
  - name: Recurring Jobs
    description: |
      Scheduled agent runs ("daily tasks"). Base URL
      `https://agent.gen.pro/v1`. Each scheduled run is gated by available
      credits: a job remains configured if credits run out and resumes when
      they return.

paths:
  # gen:mcp-surface-paths:start — generated by scripts/sync_mcp_surface.py; do not edit

  /me:
    get:
      operationId: getMe
      x-mcp-tool: gen_discover
      x-mcp-branch: "platform.me"
      x-phase: setup
      summary: Get current user
      description: Returns the authenticated user's profile. Use this to verify your API key works.
      tags: [Discovery]
      responses:
        '200':
          description: Current user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
              example:
                id: "abc123"
                email: "user@example.com"
                name: "Jane Doe"
                username: "janedoe"
                created_at: "2025-01-15T10:30:00Z"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /workspaces:
    get:
      operationId: listWorkspaces
      x-mcp-tool: gen_discover
      x-mcp-branch: "platform.workspaces"
      x-phase: setup
      summary: List workspaces
      description: Returns organizations where the authenticated user is an owner or manager.
      tags: [Discovery]
      responses:
        '200':
          description: List of workspaces
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Workspace'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /x402_credit_purchase:
    post:
      operationId: createX402CreditPurchase
      x-mcp-tool: gen_billing_action
      x-mcp-branch: "create_x402_credit_purchase"
      x-phase: export
      summary: Create an x402 credit-purchase quote
      description: |
        Create a 402 quote to fund workspace credits with USDC over x402.
        Pass either `amount_usd` or `credits`; x402 credit purchases are not
        limited to fixed credit packs. If `network` is omitted, GEN returns
        every configured payment option in `payment_methods` and
        `payment_required.accepts` instead of silently choosing one chain.

        Show the Sui, Solana, and Base options to the user or calling agent,
        sign one matching `payment_required.accepts[]` entry, then settle/retry
        with `PAYMENT-SIGNATURE`, `checkout_session_id`, and the chosen network.
        Workspace funding wallets are backend settlement/sweeping
        infrastructure; the user-facing choices are the returned payment
        methods.
      tags: [Organizations]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [workspace_id]
              properties:
                workspace_id:
                  type: string
                  description: Workspace/organization receiving credits.
                amount_usd:
                  type: string
                  description: Arbitrary USD amount to convert to credits.
                  example: "1.25"
                credits:
                  type: string
                  description: Arbitrary credit amount to buy.
                  example: "100.0"
                network:
                  type: string
                  enum: [sui, solana, base]
                  description: Optional selected payment network. Omit to receive all configured options.
      responses:
        '402':
          description: x402 payment required. Sign one returned payment method and settle/retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/X402CreditPurchaseQuote'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          description: Missing amount, invalid workspace, or quote failure.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'

  /agents:
    get:
      operationId: listAgents
      x-mcp-tool: gen_discover
      x-mcp-branch: "agent.capabilities"
      x-phase: setup
      summary: List agents
      description: Returns all agents the authenticated user has access to across their workspaces.
      tags: [Discovery]
      parameters:
        - name: workspace_id
          in: query
          description: Filter by workspace (organization) ID
          schema:
            type: string
      responses:
        '200':
          description: List of agents
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Agent'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

    post:
      operationId: createAgent
      x-mcp-tool: gen_agent_action
      x-mcp-branch: "create_agent"
      x-phase: setup
      summary: Create an agent
      description: Creates a new agent in the specified organization.
      tags: [Agents]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                organization_id:
                  type: string
                  description: Organization to create the agent in.
                agent:
                  type: object
                  required: [name]
                  properties:
                    name:
                      type: string
                      example: "My Brand Agent"
                    description:
                      type: string
                    time_zone:
                      type: string
                      example: "America/New_York"
                    eleven_lab_api_key:
                      type: string
                    hume_ai_api_key:
                      type: string
                    agent_avatars_attributes:
                      type: array
                      items:
                        type: object
      responses:
        '201':
          description: Agent created
          content:
            application/json:
              schema:
                type: object
                properties:
                  agent:
                    $ref: '#/components/schemas/AgentDetail'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          description: Agent creation failed or organization not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'

  /agents/{agent_id}:
    get:
      operationId: getAgent
      x-mcp-tool: gen_discover
      x-mcp-branch: "agent.detail"
      x-phase: setup
      summary: Get an agent
      description: Returns detailed information about a specific agent.
      tags: [Agents]
      parameters:
        - $ref: '#/components/parameters/AgentIdPath'
        - name: with_organization_uuid
          in: query
          schema:
            type: boolean
          description: Include organization UUID in response.
      responses:
        '200':
          description: Agent details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentDetail'
        '403':
          description: Permission denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Agent not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'

    patch:
      operationId: updateAgent
      x-mcp-tool: gen_agent_action
      x-mcp-branch: "connect_agent_elevenlabs"
      x-phase: setup
      summary: Update an agent
      description: Updates agent properties including name, description, timezone, API keys, avatars, and default voice.
      tags: [Agents]
      parameters:
        - $ref: '#/components/parameters/AgentIdPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                agent:
                  type: object
                  properties:
                    name:
                      type: string
                    description:
                      type: string
                    time_zone:
                      type: string
                    eleven_lab_api_key:
                      type: string
                    hume_ai_api_key:
                      type: string
                    agent_avatars_attributes:
                      type: array
                      items:
                        type: object
                    default_user_voice_attributes:
                      type: object
                      properties:
                        source:
                          type: string
                        voice_id:
                          type: string
      responses:
        '200':
          description: Updated agent
          content:
            application/json:
              schema:
                type: object
                properties:
                  agent:
                    $ref: '#/components/schemas/AgentDetail'
        '403':
          description: Permission denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Agent not found or validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'

    delete:
      operationId: deleteAgent
      x-mcp-tool: gen_agent_action
      x-mcp-branch: "delete_agent"
      x-phase: setup
      summary: Delete an agent
      description: Permanently deletes an agent and all associated data.
      tags: [Agents]
      parameters:
        - $ref: '#/components/parameters/AgentIdPath'
      responses:
        '200':
          description: Agent deleted
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

    put:
      operationId: putAgentsByAgentId
      x-phase: ideas
      summary: "Create, update, or remove assistants and their profiles — set name"
      tags: [Agent Chat]
      parameters:
      - name: agent_id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              required:
                - "agent"
              properties:
                agent:
                  type: "object"
                  properties:
                    name: {}
                    description: {}
                    eleven_lab_api_key: {}
                    hume_ai_api_key: {}
                    agent_avatars_attributes:
                      type: "array"
                      items:
                        type: "object"
                        properties:
                          degod_avatar_id: {}
                          file: {}
                          is_primary:
                            type: "boolean"
                    default_user_voice_attributes:
                      type: "object"
                      properties:
                        source: {}
                        voice_id: {}
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  agent:
                    type: "object"
                    description: "`app/resources/agent_resource.rb` (extends `agent_for_index_resource.rb`)."
                    properties:
                      id: {}
                      name: {}
                      description: {}
                      organization_id: {}
                      eleven_lab_api_key:
                        description: "The literal \"connected\" when a key is stored; the key itself is never echoed."
                      primary_avatar_url: {}
                      primary_avatar_id: {}
                      agent_setup_project_id: {}
                      tiktok_integration:
                        type: "boolean"
                      degods:
                        type: "boolean"
                      tiktok_social_account:
                        type: "boolean"
                      role: {}
                      organization: {}
                      shared_users:
                        type: "array"
                        items: {}
                      default_user_voice: {}
                      time_zone: {}
                      time_zone_id: {}
                      location: {}
                      organization_uuid: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_agent_action
      x-mcp-branch: "set_name"
  /agents/{agent_id}/avatars:
    get:
      operationId: listAgentAvatars
      x-mcp-tool: gen_discover
      x-mcp-branch: "agent.profile_photos"
      x-phase: setup
      summary: List agent profile photos
      description: Returns all avatars for the agent. Cursor-based pagination (20 per page). Primary avatar listed first.
      tags: [Agents]
      parameters:
        - $ref: '#/components/parameters/AgentIdPath'
        - name: cursor
          in: query
          schema:
            type: string
          description: Pagination cursor.
      responses:
        '200':
          description: List of avatars
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Avatar'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

    post:
      operationId: createAgentAvatar
      x-mcp-tool: gen_agent_action
      x-mcp-branch: "create_agent_avatar"
      x-phase: setup
      summary: Upload agent avatar
      description: Upload one or more avatar images (JPEG, PNG, WebP) or link a DeGod avatar.
      tags: [Agents]
      parameters:
        - $ref: '#/components/parameters/AgentIdPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              properties:
                agent_avatars_attributes:
                  type: "array"
                  items:
                    type: "object"
                    properties:
                      id: {}
                      degod_avatar_id: {}
                      file: {}
                      _destroy: {}
      responses:
        '200':
          description: Avatar(s) created
        '422':
          description: Avatar creation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'

  /agents/{agent_id}/avatars/{id}:
    delete:
      operationId: deleteAgentAvatar
      x-mcp-tool: gen_agent_action
      x-mcp-branch: "delete_agent_avatar"
      x-phase: setup
      summary: Delete avatar(s)
      description: Delete one or more avatars. Pass multiple IDs separated by underscores (e.g. `7_8_9`).
      tags: [Agents]
      parameters:
        - $ref: '#/components/parameters/AgentIdPath'
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: Avatar ID or multiple IDs separated by underscores.
      responses:
        '200':
          description: Avatar(s) deleted
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  # ── API Keys ───────────────────────────────────────────────
  /persisted_tokens:
    get:
      operationId: listApiKeys
      x-mcp-tool: gen_discover
      x-mcp-branch: "platform.api_keys"
      x-phase: setup
      summary: List API keys
      description: Returns all API keys for the authenticated user, including revoked and expired ones.
      tags: [API Keys]
      responses:
        '200':
          description: List of API keys
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ApiKey'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

    post:
      operationId: createApiKey
      x-mcp-tool: gen_platform_action
      x-mcp-branch: "create_api_key"
      x-phase: setup
      summary: Create API key
      description: |
        Creates a new API key. The plain-text key is returned **only once** in the response.
        Store it securely — it cannot be retrieved again.
      tags: [API Keys]
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: Human-readable label. Auto-generated if omitted.
                  example: "My n8n workflow"
                expires_in:
                  type: integer
                  description: Seconds until expiration. Omit for non-expiring keys.
                  example: 2592000
      responses:
        '201':
          description: API key created. The `token` field contains the plain-text key.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ApiKey'
                  - type: object
                    properties:
                      token:
                        type: string
                        description: The plain-text API key. Store it now — it won't be shown again.
                        example: "gen_abc123def456..."
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /persisted_tokens/{id}:
    patch:
      operationId: updateApiKey
      x-mcp-tool: gen_platform_action
      x-mcp-branch: "update_api_key"
      x-phase: setup
      summary: Rename API key
      tags: [API Keys]
      parameters:
        - $ref: '#/components/parameters/TokenId'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required: [persisted_token]
              properties:
                persisted_token:
                  type: object
                  properties:
                    name:
                      type: string
                      example: "Renamed key"
      responses:
        '200':
          description: Updated API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKey'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /persisted_tokens/{id}/revoke:
    delete:
      operationId: revokeApiKey
      x-mcp-tool: gen_platform_action
      x-mcp-branch: "revoke_api_key"
      x-phase: setup
      summary: Revoke API key
      description: Permanently revokes a single API key. This cannot be undone.
      tags: [API Keys]
      parameters:
        - $ref: '#/components/parameters/TokenId'
      responses:
        '200':
          description: Key revoked
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /persisted_tokens/revoke_all:
    delete:
      operationId: revokeAllApiKeys
      x-mcp-tool: gen_platform_action
      x-mcp-branch: "revoke_all_api_keys"
      x-phase: setup
      summary: Revoke all API keys
      description: Revokes every active API key for the authenticated user.
      tags: [API Keys]
      responses:
        '200':
          description: All keys revoked
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: "Successfully revoked 3 tokens"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  # ── Sheets ─────────────────────────────────────────────────
  /vidsheet:
    post:
      operationId: createSheet
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "create_sheet | create_engine"
      x-phase: convert
      summary: Create a sheet
      description: Creates a new Auto Content Engine sheet for the specified agent.
      tags: [Sheets]
      parameters:
        - $ref: '#/components/parameters/AgentId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [spreadsheet]
              properties:
                spreadsheet:
                  type: object
                  properties:
                    title:
                      type: string
                      example: "Q1 TikTok Campaign"
                    is_default:
                      type: boolean
                      default: false
      responses:
        '201':
          description: Sheet created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Sheet'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/CreditRequired'

  /vidsheet/{sheet_id}:
    get:
      operationId: getSheet
      x-mcp-tool: gen_discover
      x-mcp-branch: "vidsheet.sheet"
      x-phase: convert
      summary: Get a sheet
      description: |
        Returns a sheet with all columns, rows, cells, layers, and global variables.
        Pass `with_execution_cost=true` to include credit cost per cell/row.
      tags: [Sheets]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
        - name: with_execution_cost
          in: query
          schema:
            type: boolean
          description: Include execution cost for each cell and row.
      responses:
        '200':
          description: Sheet with full data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Sheet'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/CreditRequired'

  /vidsheet/{sheet_id}/clone:
    post:
      operationId: cloneSheet
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "duplicate_sheet"
      x-phase: convert
      summary: Clone a sheet
      description: Creates a deep copy of the sheet, optionally into a different agent.
      tags: [Sheets]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                target_agent_id:
                  type: string
                  description: Agent to clone into. Defaults to the same agent.
      responses:
        '201':
          description: Cloned sheet
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Sheet'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/CreditRequired'

  # ── Rows ───────────────────────────────────────────────────
  /vidsheet/{sheet_id}/rows:
    get:
      operationId: listRows
      x-mcp-tool: gen_discover
      x-mcp-branch: "vidsheet.rows"
      x-phase: edit
      summary: List rows
      tags: [Rows]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
      responses:
        '200':
          description: List of rows with cells
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Row'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

    post:
      operationId: createRow
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "actions[] create/row"
      x-phase: edit
      summary: Create a row
      tags: [Rows]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                spreadsheet_row:
                  type: object
                  properties:
                    position:
                      type: integer
                      description: Position index for ordering.
      responses:
        '201':
          description: Row created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Row'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /vidsheet/{sheet_id}/rows/{row_id}:
    get:
      operationId: getRow
      x-mcp-tool: gen_discover
      x-mcp-branch: "vidsheet.row"
      x-phase: edit
      summary: Get a row
      tags: [Rows]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
        - $ref: '#/components/parameters/RowId'
      responses:
        '200':
          description: Row with cells
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Row'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /vidsheet/{sheet_id}/rows/{row_id}/duplicate:
    post:
      operationId: duplicateRow
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "actions[] duplicate/row"
      x-phase: edit
      summary: Duplicate a row
      description: Creates a deep copy of the row including all cells and layers.
      tags: [Rows]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
        - $ref: '#/components/parameters/RowId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              properties:
                agent_id:
                  type: "string"
                  description: "Agent context; the controller reads params[:agent_id] (`require_agent!`)."
              required:
                - "agent_id"
      responses:
        '201':
          description: Duplicated row
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Row'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /vidsheet/{sheet_id}/rows/update_positions:
    put:
      operationId: updateRowPositions
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "actions[] reorder/row"
      x-phase: edit
      summary: Reorder rows
      tags: [Rows]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [rows]
              properties:
                rows:
                  type: array
                  items:
                    type: object
                    required: [id, position]
                    properties:
                      id:
                        type: string
                      position:
                        type: integer
      responses:
        '200':
          description: Updated rows
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Row'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /vidsheet/{sheet_id}/columns:
    get:
      operationId: listColumns
      x-mcp-tool: gen_discover
      x-mcp-branch: "vidsheet.columns"
      x-phase: edit
      summary: List columns
      tags: [Columns]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
      responses:
        '200':
          description: List of columns
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Column'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

    post:
      operationId: createColumn
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "add_column | actions[] create/column"
      x-phase: edit
      summary: Create a column
      tags: [Columns]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                spreadsheet_column:
                  type: object
                  properties:
                    title:
                      type: string
                      example: "Video Script"
                    type:
                      type: string
                      example: "text"
                    position:
                      type: integer
      responses:
        '201':
          description: Column created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Column'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /vidsheet/{sheet_id}/columns/{column_id}/duplicate:
    post:
      operationId: duplicateColumn
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "actions[] duplicate/column"
      x-phase: edit
      summary: Duplicate a column
      tags: [Columns]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
        - name: column_id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              properties:
                agent_id:
                  type: "string"
                  description: "Agent context; the controller reads params[:agent_id] (`require_agent!`)."
                with_cells:
                  description: "Also duplicate the column's cells (default true)."
                  type: "boolean"
      responses:
        '201':
          description: Duplicated column
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Column'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /vidsheet/{sheet_id}/columns/update_positions:
    patch:
      operationId: updateColumnPositions
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "actions[] reorder/column"
      x-phase: edit
      summary: Reorder columns
      tags: [Columns]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              properties:
                id_to_position:
                  description: "Map of column id to new position."
                  type: "object"
                  additionalProperties:
                    type: "integer"
      responses:
        '200':
          description: Updated columns
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /vidsheet/{sheet_id}/cells/{cell_id}:
    get:
      operationId: getCell
      x-mcp-tool: gen_discover
      x-mcp-branch: "vidsheet.cell"
      x-phase: edit
      summary: Get a cell
      tags: [Cells]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
        - $ref: '#/components/parameters/CellId'
      responses:
        '200':
          description: Cell with layers and job history
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Cell'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

    patch:
      operationId: updateCell
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "set_cell | actions[] update/cell"
      x-phase: edit
      summary: Update a cell
      description: Update the value or attributes of a cell.
      tags: [Cells]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
        - $ref: '#/components/parameters/CellId'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                spreadsheet_cell:
                  type: object
                  properties:
                    value:
                      type: string
                      description: The cell's text content.
                      example: "A day in the life of a content creator..."
      responses:
        '200':
          description: Updated cell
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Cell'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /vidsheet/{sheet_id}/cells/{cell_id}/set_default_user_job:
    patch:
      operationId: setDefaultUserJob
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "actions[] update/cell (values.take)"
      x-phase: edit
      summary: Set default generation for a cell
      description: Pin a specific generation result as the active/visible one for this cell.
      tags: [Cells]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
        - $ref: '#/components/parameters/CellId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              required:
                - "default_user_job"
              properties:
                default_user_job:
                  type: "object"
                  properties:
                    user_job_id:
                      type: "string"
                      description: "The generation (UserJob) id to pin as the cell's default."
                    is_user_job:
                      type: "boolean"
                      description: "true (default) pins a `UserJob`; false pins a legacy `Job`."
      responses:
        '200':
          description: Updated cell
          content:
            application/json:
              schema:
                type: "object"
                description: "`app/resources/spreadsheet_cell_resource.rb`."
                properties:
                  id: {}
                  value: {}
                  additional_attributes: {}
                  cell_role: {}
                  spreadsheet_column_id: {}
                  default_user_job: {}
                  user_jobs:
                    type: "array"
                    items: {}
                  video_layers:
                    type: "array"
                    items:
                      type: "object"
                      description: "`app/resources/video_layer_resource.rb`."
                      properties:
                        id: {}
                        name: {}
                        position: {}
                        type: {}
                        additional_attributes: {}
                        default_user_job: {}
                        user_jobs:
                          type: "array"
                          items: {}
                        execution_cost: {}
                        created_at_ts:
                          type: "integer"
                        updated_at_ts:
                          type: "integer"
                  execution_cost: {}
                  created_at_ts:
                    type: "integer"
                  updated_at_ts:
                    type: "integer"
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  # ── Layers ─────────────────────────────────────────────────
  /vidsheet/{sheet_id}/cells/{cell_id}/layers:
    post:
      operationId: createLayer
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "add_layer | actions[] create/layer"
      x-phase: edit
      summary: Create a layer
      description: Add a new video layer (text, sound, clip, etc.) to a cell.
      tags: [Layers]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
        - $ref: '#/components/parameters/CellId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                video_layer:
                  type: object
                  properties:
                    name:
                      type: string
                      example: "Background Music"
                    type:
                      type: string
                      example: "sound"
                    position:
                      type: integer
      responses:
        '201':
          description: Layer created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Layer'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /vidsheet/{sheet_id}/cells/{cell_id}/layers/{layer_id}:
    get:
      operationId: getLayer
      x-mcp-tool: gen_discover
      x-mcp-branch: "vidsheet.layer"
      x-phase: edit
      summary: Get a layer
      tags: [Layers]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
        - $ref: '#/components/parameters/CellId'
        - $ref: '#/components/parameters/LayerId'
      responses:
        '200':
          description: Layer detail
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Layer'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

    patch:
      operationId: updateLayer
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "update_layer | actions[] update/layer"
      x-phase: edit
      summary: Update a layer
      tags: [Layers]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
        - $ref: '#/components/parameters/CellId'
        - $ref: '#/components/parameters/LayerId'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                video_layer:
                  type: object
                  properties:
                    name:
                      type: string
                    additional_attributes:
                      type: object
      responses:
        '200':
          description: Updated layer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Layer'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

    delete:
      operationId: deleteLayer
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "actions[] delete/layer"
      x-phase: edit
      summary: Delete a layer
      tags: [Layers]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
        - $ref: '#/components/parameters/CellId'
        - $ref: '#/components/parameters/LayerId'
      responses:
        '204':
          description: Layer deleted
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /vidsheet/{sheet_id}/cells/{cell_id}/layers/{layer_id}/duplicate:
    post:
      operationId: duplicateLayer
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "actions[] duplicate/layer"
      x-phase: edit
      summary: Duplicate a layer
      tags: [Layers]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
        - $ref: '#/components/parameters/CellId'
        - $ref: '#/components/parameters/LayerId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              properties:
                agent_id:
                  type: "string"
                  description: "Agent context; the controller reads params[:agent_id] (`require_agent!`)."
                name: {}
                additional_attributes: {}
      responses:
        '201':
          description: Duplicated layer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Layer'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /vidsheet/{sheet_id}/cells/{cell_id}/layers/update_positions:
    put:
      operationId: updateLayerPositions
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "actions[] reorder/layer"
      x-phase: edit
      summary: Reorder layers
      tags: [Layers]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
        - $ref: '#/components/parameters/CellId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              properties:
                id_to_position:
                  description: "Map of layer id to new position."
                  type: "object"
                  additionalProperties:
                    type: "integer"
      responses:
        '200':
          description: Updated layers
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  # ── Generations ────────────────────────────────────────────
  /vidsheet/{sheet_id}/cells/{cell_id}/generate:
    post:
      operationId: generateCellContent
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "generate (cell)"
      x-phase: edit
      summary: Generate content for a cell
      description: |
        Triggers AI content generation for a cell. Credits are pre-charged.
        Poll the generation status via `GET /v1/generations/{id}`.
      tags: [Generations]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
        - $ref: '#/components/parameters/CellId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [generation_type, data]
              properties:
                generation_type:
                  type: string
                  description: |
                    The type of AI generation to run. Canonical names:
                    text, image_from_text, video_from_text, video_from_image,
                    video_from_ingredients, speech_from_text, lipsync, captions,
                    transcription, song.
                    Use canonical names for new integrations. Uploaded media is a
                    cell value (PATCH the cell), not a generation.
                  enum:
                    - text
                    - image_from_text
                    - video_from_text
                    - video_from_image
                    - video_from_ingredients
                    - speech_from_text
                    - lipsync
                    - captions
                    - transcription
                    - song
                  example: "text"
                data:
                  type: object
                  description: |
                    Generation parameters (varies by type). Video generation card data may include
                    `aspect_ratio`, `duration`, optional `resolution` (`1080p` or `720p` where
                    supported), and optional `native_audio` for models that support native audio.
                    Omitted optional fields use the cell defaults or the closest supported model defaults.

                    Video generation accepts the Veo, Kling, Seedance and Grok models plus
                    `gemini-omni-flash-preview` (Gemini Omni Flash, 1-10s). Image generation with
                    `model: "gemini"` takes `version`: `nano-banana`, `nano-banana-pro`,
                    `nano-banana-2` or `nano-banana-2-lite`. The full per-card model lists are on
                    the card reference pages.

                    Song data (`generation_type: "song"`) takes `prompt`, `model` (`suno-v5-beta`,
                    `suno-v4.5plus-beta` or `suno-v5.5-beta`), `duration`, `instrumental`, `style`,
                    `title`, `negative_tags` and `vocal_gender`, plus optional source audio:
                    `source_audio_resource_id` (an existing audio content resource) or a public
                    HTTPS URL as `source_audio_url` (imported as a content resource first), and
                    `audio_weight` (0.0-1.0) for fidelity to the source. Source audio is capped at
                    8 minutes (480 s); longer input is refused before any charge.
                  example:
                    prompt: "A handheld product demo video"
                    model: "veo-3.1"
                    aspect_ratio: "9:16"
                    resolution: "1080p"
                    duration: 8
                    native_audio: false
      responses:
        '201':
          description: Generation started
          content:
            application/json:
              schema:
                type: object
                properties:
                  generation_id:
                    type: string
                  status:
                    type: string
                    example: "pending"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          description: Insufficient credits or invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'

  /vidsheet/{sheet_id}/cells/{cell_id}/layers/{layer_id}/generate:
    post:
      operationId: generateLayerContent
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "generate (layer)"
      x-phase: edit
      summary: Generate content for a layer
      description: |
        Triggers AI generation for a video layer (voice, music, clip, etc.).
        Credits are pre-charged. Poll status via `GET /v1/generations/{id}`.
      tags: [Generations]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
        - $ref: '#/components/parameters/CellId'
        - $ref: '#/components/parameters/LayerId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [generation_type, data]
              properties:
                generation_type:
                  type: string
                  description: Generation type — see cell generate endpoint for full list.
                  example: "speech_from_text"
                data:
                  type: object
      responses:
        '201':
          description: Generation started
          content:
            application/json:
              schema:
                type: object
                properties:
                  generation_id:
                    type: string
                  status:
                    type: string
                    example: "pending"
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /generations/{generation_id}:
    get:
      operationId: getGeneration
      x-mcp-tool: gen_discover
      x-mcp-branch: "vidsheet.generation"
      x-phase: edit
      summary: Get generation status
      description: Check the status and result of an AI generation job.
      tags: [Generations]
      parameters:
        - name: generation_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Generation details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Generation'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /generations/{generation_id}/stop:
    post:
      operationId: stopGeneration
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "<flat ops>"
      x-phase: edit
      summary: Stop a generation
      description: Cancels a running generation. Credits are refunded.
      tags: [Generations]
      parameters:
        - name: generation_id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              properties:
                agent_id:
                  type: "string"
                  description: "Agent context; the controller reads params[:agent_id] (`require_agent!`)."
              required:
                - "agent_id"
      responses:
        '200':
          description: Generation stopped
          content:
            application/json:
              schema:
                type: object
                properties:
                  generation_id:
                    type: string
                  status:
                    type: string
                    example: "stopped"
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /generations/{generation_id}/continue:
    post:
      operationId: continueGeneration
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "<flat ops>"
      x-phase: edit
      summary: Continue a stopped generation
      description: Resumes a previously stopped generation. Credits are re-charged.
      tags: [Generations]
      parameters:
        - name: generation_id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body. Every field other than the routing keys is forwarded verbatim to `UserJobs::Continue`."
              additionalProperties: true
              properties:
                agent_id:
                  type: "string"
                  description: "Agent context; the controller reads params[:agent_id] (`require_agent!`)."
              required:
                - "agent_id"
      responses:
        '200':
          description: Generation resumed
          content:
            application/json:
              schema:
                type: object
                properties:
                  generation_id:
                    type: string
                  status:
                    type: string
                    example: "pending"
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /transcriptions:
    post:
      operationId: createTranscription
      x-mcp-tool: gen_generate
      x-mcp-branch: "transcribe"
      x-phase: edit
      summary: Transcribe audio or video
      description: |
        Transcribes audio or video to text without a sheet or cell. Pass exactly one
        source in `data`: `audio`, `video`, or `content_resource_id`. Returns a
        generation id — poll `GET /v1/generations/{id}` until status is "completed",
        then read `result`. Uses credits based on the duration of audio transcribed;
        credits are pre-charged and refunded on failure.

        Use the `captions` generation type instead when you need word-level timings
        for subtitle overlays on a video.
      tags: [Generations]
      parameters:
        - $ref: '#/components/parameters/AgentId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [data]
              properties:
                data:
                  $ref: '#/components/schemas/TranscriptionData'
      responses:
        '201':
          description: Transcription job created
          content:
            application/json:
              schema:
                type: object
                properties:
                  generation_id:
                    type: integer
                  status:
                    type: string
                    example: "pending"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          description: |
            Invalid source (`validation_error`) or not enough workspace credits
            (`insufficient_credits_for_job`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'

  # ── Render ────────────────────────────────────────────────
  /vidsheet/{sheet_id}/cells/{cell_id}/render:
    post:
      operationId: renderVideo
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "generate (cell, creation_card_type=final-video)"
      x-phase: export
      summary: Render final video
      description: |
        Composites all layers (video, audio, captions, text overlays) into a final video.
        The result appears in the final_video column cell.
        Returns a generation_id — poll `GET /v1/generations/{id}` until status is "completed".
        Credits are pre-charged and refunded on failure.
      tags: [Generations]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
        - $ref: '#/components/parameters/CellId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              properties:
                generation_type:
                  type: "string"
                  description: "Canonical generation type for the render; resolved through `VidsheetSchema::CanonicalGenerationType`."
                data:
                  type: "object"
                  additionalProperties: true
                  description: "Card inputs; accepted as an object or a JSON-encoded string."
      responses:
        '201':
          description: Render started
          content:
            application/json:
              schema:
                type: object
                properties:
                  generation_id:
                    type: string
                  status:
                    type: string
                    example: "pending"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          description: Insufficient credits
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'

  # ── Variables ──────────────────────────────────────────────
  /vidsheet/{sheet_id}/global_variables:
    get:
      operationId: getGlobalVariables
      x-mcp-tool: gen_discover
      x-mcp-branch: "vidsheet.variables"
      x-phase: edit
      summary: Get global variables
      description: Returns the global variables sheet associated with this sheet.
      tags: [Variables]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SheetId'
      responses:
        '200':
          description: Global variables sheet
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Sheet'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /user_jobs:
    post:
      operationId: createUserJob
      x-mcp-tool: gen_task_action
      x-mcp-branch: "create_monitoring_job"
      x-phase: [ideas, export]
      summary: Create user job (monitoring or publishing)
      description: |
        Create a background job. Use `user_job_type` to select the job kind:

        - **`train_social`** — scrape social media content into the agent's knowledge base. Supports TikTok, Instagram, and YouTube. Send as multipart/form-data with `user_job[user_job_type]` and `user_job[data]` (JSON-stringified).
        - **`publish_content`** — legacy single-platform TikTok publish. Send as JSON with top-level `user_job_type` and `data` fields. New integrations should use `POST /schedule/with-post`, which covers every platform, validates up front and returns the live `post_url`.
      tags: [Content Monitoring, Publishing]
      parameters:
        - $ref: '#/components/parameters/AgentId'
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required: ["user_job[user_job_type]", "user_job[data]"]
              properties:
                "user_job[user_job_type]":
                  type: string
                  enum: [train_social]
                "user_job[data]":
                  type: string
                  description: JSON-stringified object with platform (tiktok|instagram|youtube), type (username|hashtag|keyword), value, days (0|1|7|30|90|180), country, max_results (1-50), monitoring (default false), comment_monitoring.
            example:
              "user_job[user_job_type]": train_social
              "user_job[data]": '{"platform":"instagram","type":"username","value":"@fashionbrand","days":30,"max_results":50,"monitoring":true}'
          application/json:
            schema:
              type: object
              required: [user_job_type, data]
              properties:
                user_job_type:
                  type: string
                  enum: [publish_content]
                data:
                  type: string
                  description: >-
                    JSON-stringified object with platform, media_url, description, schedule_type,
                    scheduled_time, media_type, title, thumbnail_url, timezone_offset. For multiple
                    images use media_urls (array; X allows up to 4 per tweet). X (Twitter) also
                    supports thread (array of {text, media_urls?} segments, posted as a chain) and
                    reply_to_tweet_id (reply to an existing tweet); both are X-only and ignored by
                    other platforms.
            example:
              user_job_type: publish_content
              data: '{"platform":"tiktok","media_url":"https://cdn.example.com/video.mp4","description":"Factory price reveal #sourcing","schedule_type":"now","media_type":"VIDEO"}'
      responses:
        '201':
          description: Job created
          content:
            application/json:
              schema:
                type: object
                properties:
                  user_job_id:
                    type: integer
              example:
                user_job_id: 12345
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          description: Validation error, unsupported platform/type combination, or no active credit purchase.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'

    get:
      operationId: getUserJobs
      x-phase: setup
      summary: "Schedule, publish, or remove posts — publish content"
      tags: [Generations]
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "array"
                items:
                  type: "object"
                  description: "A UserJob (`app/resources/user_job_resource.rb`)."
                  properties:
                    id: {}
                    status: {}
                    user_job_type: {}
                    failed_reason: {}
                    user_message: {}
                    container_id: {}
                    container_type: {}
                    result: {}
                    object_type:
                      description: "Always the literal \"UserJob\"."
                      const: "UserJob"
                    seed: {}
                    raw_data: {}
                    input_nodes:
                      type: "array"
                      items: {}
                    output_nodes:
                      type: "array"
                      items: {}
                    output_resources:
                      type: "array"
                      items: {}
                    child_jobs:
                      type: "array"
                      items: {}
                    credit_outcome:
                      enum:
                        - "refunded"
                        - "charged"
                        - "not_charged"
                    retryable:
                      type: "boolean"
                    stage: {}
                    processing_started_at: {}
                    execution_cost:
                      description: "Stringified credit cost."
                      type: "string"
                description: "`head :ok`-style list; `UserJobResource` per job."
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_publish_action
      x-mcp-branch: "publish_content"
  /user_jobs/{id}:
    get:
      operationId: getUserJob
      x-mcp-tool: gen_discover
      x-mcp-branch: "vidsheet.audio_matches"
      x-phase: [ideas, export]
      summary: Get user job status
      description: |
        Poll an async user job. Works for both `train_social` (content monitoring) and `publish_content` (social publishing) jobs. Returns current status, progress, and the final `result` on completion.
      tags: [Content Monitoring, Publishing]
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
        - $ref: '#/components/parameters/AgentId'
      responses:
        '200':
          description: User job status
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                  user_job_type:
                    type: string
                  status:
                    type: string
                    enum: [pending, processing, completed, failed]
                  result:
                    type: object
                    description: Populated on `completed`. For `publish_content`, contains `post_id`.
                  failed_reason:
                    type: string
                    description: Populated on `failed`.
              example:
                id: 138860
                user_job_type: publish_content
                status: completed
                result:
                  post_id: "7459234123456"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
    put:
      operationId: updateMonitoringJob
      x-mcp-tool: gen_task_action
      x-mcp-branch: "update_monitoring_job"
      x-phase: ideas
      summary: Update monitoring job
      description: Update an existing `train_social` job. Only jobs with `pending` or `processing` status can be updated. Send fields as flat form params (not nested).
      tags: [Content Monitoring]
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
        - $ref: '#/components/parameters/AgentId'
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                platform:
                  type: string
                  enum: [tiktok, instagram, youtube]
                type:
                  type: string
                  enum: [username, hashtag, keyword]
                value:
                  type: string
                days:
                  type: integer
                  enum: [0, 1, 7, 30, 90, 180]
                country:
                  type: string
                max_results:
                  type: integer
                  minimum: 1
                  maximum: 50
                monitoring:
                  type: boolean
                comment_monitoring:
                  type: boolean
      responses:
        '200':
          description: Monitoring job updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  user_job_id:
                    type: integer
              example:
                user_job_id: 12345
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          description: Job status invalid or validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'

  # ── Templates ─────────────────────────────────────────────
  /schedule/with-post:
    post:
      operationId: createScheduledPost
      servers:
        - url: https://python.gen.pro
      x-mcp-tool: gen_publish_action
      x-mcp-branch: "schedule_post_<platform>"
      x-phase: [export]
      summary: Publish now or schedule a post (all platforms)
      description: |
        Post content to one or more connected social accounts — TikTok, Instagram, Facebook Page, YouTube, X, LinkedIn — immediately (`schedule_type: now`), at a time (`specific_time`), or in the agent's next free calendar slot (`next_available`, default). Instagram takes 2-10 items as a carousel (optional `instagram_music`), YouTube uploads `thumbnail_url` and takes `youtube_options` (visibility, shorts, tags, ...), LinkedIn takes a PDF/PPTX/DOCX document or up to 9 images and `linkedin_options` (visibility, alt_text).

        The request is validated per platform before anything is queued (media type and count, caption/title limits, required fields such as the YouTube title); a violation is a `422 platform_validation_failed` naming the platform and field. Publishing is asynchronous even for `now`: a `200` means accepted and queued. Poll `GET /schedule/post/{post_id}` for the per-platform outcome and the live `post_url`.

        The agent must have connected each target platform first (GEN app → Setup → Accounts).
      tags: [Publishing]
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          description: |
            Any string up to 128 characters, unique per agent. A retry with the same key returns the original post (`idempotent_replay: true`) instead of creating a duplicate.
          schema:
            type: string
            maxLength: 128
        - name: X-Timezone-Offset
          in: header
          required: false
          description: Local UTC offset in hours (e.g. `-7`) used to render times in the response. Defaults to the agent's time zone.
          schema:
            type: number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SchedulePostRequest'
            examples:
              youtubeNow:
                summary: YouTube video, now
                value:
                  agent_id: "agent_abc123"
                  platform: [youtube]
                  schedule_type: now
                  media_url: "https://cdn.gen.pro/outputs/render_xyz.mp4"
                  title: "Factory price reveal"
                  description: "What your $12 beauty sponge really costs."
                  strict: true
              linkedinText:
                summary: LinkedIn, text only
                value:
                  agent_id: "agent_abc123"
                  platform: [linkedin]
                  schedule_type: now
                  description: "Three things we learned shipping our publishing API this week..."
                  strict: true
              xThread:
                summary: X thread
                value:
                  agent_id: "agent_abc123"
                  platform: [x]
                  schedule_type: now
                  thread:
                    - text: "1/ Here is a thread about our launch."
                    - text: "2/ With a screenshot"
                      media_urls: ["https://cdn.example.com/shot.jpg"]
                    - text: "3/ Wrapping up."
              instagramCarousel:
                summary: Instagram carousel with auto music
                value:
                  agent_id: "agent_abc123"
                  platform: [instagram]
                  schedule_type: now
                  media_url: "https://cdn.gen.pro/outputs/clip_1.mp4"
                  media_urls: ["https://cdn.gen.pro/outputs/still_2.jpg", "https://cdn.gen.pro/outputs/still_3.png"]
                  description: "Three looks, one drop #carousel"
                  instagram_music: { mode: auto }
                  strict: true
              youtubeShort:
                summary: YouTube Short with a custom thumbnail
                value:
                  agent_id: "agent_abc123"
                  platform: [youtube]
                  schedule_type: now
                  media_url: "https://cdn.gen.pro/outputs/render_xyz.mp4"
                  thumbnail_url: "https://cdn.gen.pro/outputs/cover.jpg"
                  title: "Factory price reveal"
                  youtube_options: { visibility: public, shorts: true, tags: [sourcing, beauty] }
                  strict: true
              linkedinDocument:
                summary: LinkedIn PDF document, connections only
                value:
                  agent_id: "agent_abc123"
                  platform: [linkedin]
                  schedule_type: now
                  media_url: "https://cdn.gen.pro/outputs/q3-deck.pdf"
                  title: "Q3 in ten slides"
                  description: "Our Q3 numbers, one slide at a time."
                  linkedin_options: { visibility: connections }
                  strict: true
              multiScheduled:
                summary: One video to several platforms, scheduled
                value:
                  agent_id: "agent_abc123"
                  platform: [tiktok, instagram, youtube, x, linkedin]
                  schedule_type: specific_time
                  scheduled_time: "2026-09-20T15:00:00Z"
                  media_url: "https://cdn.gen.pro/outputs/render_xyz.mp4"
                  title: "Factory price reveal"
                  description: "What your $12 beauty sponge really costs. #sourcing"
                  tiktok_privacy_level: PUBLIC_TO_EVERYONE
                  tiktok_disable_comment: false
                  tiktok_disable_duet: false
                  tiktok_disable_stitch: false
      responses:
        '200':
          description: Accepted and queued (or replayed for a matching Idempotency-Key).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduleCreateResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          description: A platform would reject this content, or the body is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformValidationError'
              example:
                detail:
                  error: "YouTube requires a title"
                  error_code: platform_validation_failed
                  platform: youtube
                  field: title
                  errors:
                    - platform: youtube
                      field: title
                      error: "YouTube requires a title"

  /schedule/posts:
    get:
      operationId: listScheduledPosts
      servers:
        - url: https://python.gen.pro
      x-mcp-tool: gen_discover
      x-mcp-branch: "publish.scheduled"
      x-phase: [export]
      summary: List scheduled posts (content calendar)
      tags: [Publishing]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - name: start_date
          in: query
          required: true
          description: Start of the window (ISO 8601 date).
          schema:
            type: string
        - name: end_date
          in: query
          required: true
          description: End of the window (ISO 8601 date). At most 60 days after `start_date`.
          schema:
            type: string
        - name: X-Timezone-Offset
          in: header
          required: false
          description: Local UTC offset in hours used to interpret the dates and render times.
          schema:
            type: number
      responses:
        '200':
          description: Posts in the window, each with `platforms_status`.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ScheduledPost'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/PythonValidationError'

  /schedule/post/{post_id}:
    parameters:
      - name: post_id
        in: path
        required: true
        description: The `post_id` returned by `POST /schedule/with-post`.
        schema:
          type: integer
    get:
      operationId: getScheduledPost
      servers:
        - url: https://python.gen.pro
      x-mcp-tool: gen_discover
      x-mcp-branch: "publish.post_status"
      x-phase: [export]
      summary: Post outcome per platform (did it publish? where is it?)
      description: |
        The post with `platforms_status`: one entry per platform with `normalized_status` (`accepted` → `publishing` → `published` | `failed`), `platform_post_id`, the live `post_url` when published, and `error` / `error_code` / `failed_step` when failed.
      tags: [Publishing]
      responses:
        '200':
          description: The post and its per-platform outcome.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduledPost'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/PythonValidationError'
    patch:
      operationId: updateScheduledPost
      servers:
        - url: https://python.gen.pro
      x-mcp-tool: gen_publish_action
      x-mcp-branch: "update_scheduled_post"
      x-phase: [export]
      summary: Update a scheduled post before it goes out
      description: |
        Sparse update of the content fields, `scheduled_time` and `schedule_type`. Refused once the post has been sent or when it was created with `schedule_type: now`.
      tags: [Publishing]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SchedulePostUpdate'
      responses:
        '200':
          description: The updated post.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduledPost'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/PythonValidationError'
    delete:
      operationId: deleteScheduledPost
      servers:
        - url: https://python.gen.pro
      x-mcp-tool: gen_publish_action
      x-mcp-branch: "delete_scheduled_post"
      x-phase: [export]
      summary: Delete a scheduled post
      tags: [Publishing]
      responses:
        '200':
          description: Deleted.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  message:
                    type: "string"
                required:
                  - "message"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/PythonValidationError'

  /schedule/post/{post_id}/published:
    parameters:
      - name: post_id
        in: path
        required: true
        description: The `post_id` of a post that has already published.
        schema:
          type: integer
    patch:
      operationId: updatePublishedPost
      servers:
        - url: https://python.gen.pro
      x-mcp-tool: gen_publish_action
      x-mcp-branch: "update_published_post"
      x-phase: [export]
      summary: Edit the metadata of a post that is already live
      description: |
        Change a published post's metadata where the destination network supports it — today, a YouTube video's `title`, `description`, `tags` and `category_id`. `GET /schedule/platforms` names the editable fields per platform in `editable_after_publish`.

        The edit is **sparse**: only the fields in the request body change. GEN reads the platform's current metadata, merges your change onto it, writes it back, and returns what the platform held afterwards — so a title you did not send is not cleared, and the same request sent twice converges on the same result rather than stacking edits.

        The response is `200` with one result per platform the post went out on, each `updated`, `unsupported_after_publish`, `reauthorization_required` or `failed`. A network with no edit path is reported as `unsupported_after_publish` and nothing is touched; it is never an authentication error. A `422` means the body itself is wrong — a field the platform cannot change after publishing, or one that breaks the platform's limits.

        Use `PATCH /schedule/post/{post_id}` for a post that has **not** gone out yet; that endpoint still refuses published posts.

        Each YouTube update consumes 50 units of the connected channel's YouTube API quota.
      tags: [Publishing]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PublishedPostUpdate'
            examples:
              fixDescription:
                summary: Fix a typo in a live YouTube description
                value:
                  description: "What your $12 beauty sponge really costs — corrected sourcing figures in the pinned comment."
              retitleAndRetag:
                summary: Retitle, retag and recategorise
                value:
                  title: "Factory price reveal (2026 update)"
                  tags: [sourcing, beauty, supply chain]
                  category_id: 24
      responses:
        '200':
          description: One result per platform the post published to.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublishedPostUpdateResponse'
              examples:
                updated:
                  summary: YouTube accepted the edit
                  value:
                    post_id: 120750
                    results:
                      - platform: youtube
                        platform_post_id: "dQw4w9WgXcQ"
                        result: updated
                        updated_fields: [description]
                        metadata:
                          title: "Factory price reveal"
                          description: "What your $12 beauty sponge really costs — corrected sourcing figures in the pinned comment."
                          tags: [sourcing, beauty]
                          category_id: 22
                        quota_units: 50
                unsupported:
                  summary: The platform has no post-publication edit
                  value:
                    post_id: 120751
                    results:
                      - platform: tiktok
                        platform_post_id: "7412..."
                        result: unsupported_after_publish
                        message: "tiktok has no supported post-publication edit for this content."
                reauthorization:
                  summary: The connected account must be reconnected
                  value:
                    post_id: 120750
                    results:
                      - platform: youtube
                        platform_post_id: "dQw4w9WgXcQ"
                        result: reauthorization_required
                        message: "Reconnect the YouTube account: GEN's saved authorization is no longer usable."
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: You do not have permission to edit this post.
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          description: |
            The post has not published yet (`post_not_published`), the body is empty, or a field is not editable after publishing / breaks the platform's limits (`platform_validation_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformValidationError'
              example:
                detail:
                  error: "YouTube cannot change visibility after publishing"
                  error_code: platform_validation_failed
                  platform: youtube
                  field: visibility
                  errors:
                    - platform: youtube
                      field: visibility
                      error: "YouTube cannot change visibility after publishing"

    delete:
      operationId: deleteSchedulePostByPostIdPublished
      servers:
        - url: https://python.gen.pro
      x-phase: export
      summary: "Schedule, publish, or remove posts — delete published post"
      tags: [Publishing]
      parameters:
      - name: post_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  post_id:
                    type: "integer"
                  results:
                    type: "array"
                    items:
                      type: "object"
                      properties:
                        platform:
                          type: "string"
                        outcome:
                          type: "string"
                        message:
                          type: "string"
                      required:
                        - "platform"
                        - "outcome"
                      additionalProperties: true
                required:
                  - "post_id"
                  - "results"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/PythonValidationError'
      x-mcp-tool: gen_publish_action
      x-mcp-branch: "delete_published_post"
  /templates/projects:
    get:
      operationId: listTemplates
      x-mcp-tool: gen_discover
      x-mcp-branch: "vidsheet.templates"
      x-phase: convert
      summary: List templates
      description: Returns paginated list of pre-configured engine templates. 20 per page.
      tags: [Templates]
      parameters:
        - name: page
          in: query
          schema:
            type: integer
          description: Page number (starts at 1).
      responses:
        '200':
          description: List of templates
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Template'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /templates/projects/{slug}:
    get:
      operationId: getTemplate
      x-mcp-tool: gen_discover
      x-mcp-branch: "vidsheet.template"
      x-phase: convert
      summary: Get a template
      description: Returns a single template by slug, UUID, or numeric ID.
      tags: [Templates]
      parameters:
        - name: slug
          in: path
          required: true
          schema:
            type: string
          description: URL slug, UUID, or numeric ID.
      responses:
        '200':
          description: Template details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Template'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /templates/spreadsheets/{slug}/clone:
    post:
      operationId: cloneTemplate
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "clone_template"
      x-phase: convert
      summary: Clone a template
      description: Clones the template into the specified agent's workspace. Returns the new engine with columns, rows, and cells.
      tags: [Templates]
      parameters:
        - name: slug
          in: path
          required: true
          schema:
            type: string
          description: Template slug, UUID, or numeric ID.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [agent_id]
              properties:
                agent_id:
                  type: string
                  description: Agent to clone the template into.
      responses:
        '201':
          description: Cloned engine
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Sheet'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/CreditRequired'

  # ── Organizations ─────────────────────────────────────────
  /organizations:
    get:
      operationId: listOrganizations
      x-mcp-tool: gen_discover
      x-mcp-branch: "platform.organizations"
      x-phase: setup
      summary: List organizations
      description: Returns all organizations the authenticated user belongs to.
      tags: [Organizations]
      responses:
        '200':
          description: List of organizations
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Organization'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

    post:
      operationId: createOrganization
      x-mcp-tool: gen_platform_action
      x-mcp-branch: "create_organization"
      x-phase: setup
      summary: Create an organization
      tags: [Organizations]
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required: [organization]
              properties:
                "organization[name]":
                  type: string
                  example: "My Company"
                "organization[avatar]":
                  type: string
                  format: binary
                  description: Organization avatar image.
      responses:
        '201':
          description: Organization created
          content:
            application/json:
              schema:
                type: object
                properties:
                  organization_id:
                    type: string
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'

  /organizations/{organization_id}:
    get:
      operationId: getOrganization
      x-mcp-tool: gen_discover
      x-mcp-branch: "platform.organization"
      x-phase: setup
      summary: Get an organization
      tags: [Organizations]
      parameters:
        - name: organization_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Organization details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Organization'
        '422':
          description: Organization not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'

    patch:
      operationId: updateOrganization
      x-mcp-tool: gen_platform_action
      x-mcp-branch: "update_organization"
      x-phase: setup
      summary: Update an organization
      description: Requires owner or manager role.
      tags: [Organizations]
      parameters:
        - name: organization_id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                "organization[name]":
                  type: string
                "organization[avatar]":
                  type: string
                  format: binary
      responses:
        '200':
          description: Organization updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  organization_id:
                    type: string
        '403':
          description: Forbidden (not owner or manager)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Organization not found or validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'

    delete:
      operationId: deleteOrganization
      x-mcp-tool: gen_platform_action
      x-mcp-branch: "delete_organization"
      x-phase: setup
      summary: Delete an organization
      description: Permanently deletes the organization and all associated data. Requires owner role. Irreversible.
      tags: [Organizations]
      parameters:
        - name: organization_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Organization deleted
        '403':
          description: Forbidden (not owner)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Organization not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'

  # ── Content Resources ─────────────────────────────────────
  /content_resources:
    get:
      operationId: listContentResources
      x-mcp-tool: gen_discover
      x-mcp-branch: "asset.list"
      x-phase: edit
      summary: List content resources
      description: Returns paginated content resources. 20 items per page (page starts at 0).
      tags: [Content Resources]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - name: type
          in: query
          schema:
            type: string
            enum: [image, video, audio, zip, safe_tensors]
          description: Filter by resource type.
        - name: project_id
          in: query
          schema:
            type: string
          description: Filter by project (engine) ID.
        - name: ids[]
          in: query
          schema:
            type: array
            items:
              type: string
          description: Filter by specific resource IDs.
        - name: page
          in: query
          schema:
            type: integer
          description: Page number (starts at 0).
      responses:
        '200':
          description: List of content resources
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ContentResource'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

    post:
      operationId: createContentResource
      x-mcp-tool: gen_asset_action
      x-mcp-branch: "complete_asset_upload"
      x-phase: edit
      summary: Upload a content resource
      description: Upload a file as a content resource. Optionally assign to an asset folder.
      tags: [Content Resources]
      parameters:
        - $ref: '#/components/parameters/AgentId'
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required: ["content_resource[file]"]
              properties:
                "content_resource[file]":
                  type: string
                  format: binary
                  description: The file to upload.
                "asset_folder[id]":
                  type: string
                  description: Optional asset folder ID.
      responses:
        '201':
          description: Content resource created
          content:
            application/json:
              schema:
                type: object
                properties:
                  content_resource:
                    $ref: '#/components/schemas/ContentResource'
                  generator:
                    type: object
                    nullable: true
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Creation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'

  /content_resources/{id}:
    get:
      operationId: getContentResource
      x-mcp-tool: gen_discover
      x-mcp-branch: "asset.detail"
      x-phase: edit
      summary: Get a content resource
      tags: [Content Resources]
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/AgentId'
      responses:
        '200':
          description: Content resource details
          content:
            application/json:
              schema:
                type: object
                properties:
                  content_resource:
                    $ref: '#/components/schemas/ContentResource'
                  generator:
                    type: object
                    nullable: true
                    description: Null for manual uploads; contains job info for AI-generated resources.
                    properties:
                      id:
                        type: string
                      status:
                        type: string
                      type:
                        type: string
        '404':
          description: Content resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

    patch:
      operationId: updateContentResource
      x-mcp-tool: gen_content_action
      x-mcp-branch: "update_content_resource"
      x-phase: edit
      summary: Rename a content resource
      tags: [Content Resources]
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/AgentId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              required:
                - "content_resource"
              properties:
                content_resource:
                  type: "object"
                  required:
                    - "filename"
                  properties:
                    filename:
                      type: "string"
      responses:
        '200':
          description: Content resource updated
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          $ref: '#/components/responses/NotFound'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

    delete:
      operationId: deleteContentResource
      x-mcp-tool: gen_asset_action
      x-mcp-branch: "delete_asset"
      x-phase: edit
      summary: Delete a content resource
      tags: [Content Resources]
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/AgentId'
      responses:
        '200':
          description: Content resource deleted
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          $ref: '#/components/responses/NotFound'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  # ── Asset Libraries ───────────────────────────────────────
  /asset_libraries:
    get:
      operationId: listAssetLibraries
      x-mcp-tool: gen_discover
      x-mcp-branch: "asset.libraries"
      x-phase: edit
      summary: Browse asset library
      description: |
        Unified view of files and folders. Polymorphic response — items have
        `type: "AssetFolder"` or `type: "ContentResource"`.
      tags: [Asset Libraries]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - name: folder_id
          in: query
          schema:
            type: string
          description: Browse inside a specific folder.
        - name: asset_type
          in: query
          schema:
            type: string
            enum: [image, video, audio, folder]
          description: Filter by asset type.
        - name: search
          in: query
          schema:
            type: string
          description: Search by file name.
        - name: order
          in: query
          schema:
            type: string
            enum: [recent]
          description: Sort order.
        - name: page
          in: query
          schema:
            type: integer
        - name: page_size
          in: query
          schema:
            type: integer
      responses:
        '200':
          description: List of assets and folders
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                    type:
                      type: string
                      enum: [AssetFolder, ContentResource]
                    name:
                      type: string
                      description: Folder name (AssetFolder only).
                    url:
                      type: string
                      format: uri
                      description: File URL (ContentResource only).
                    thumbnail_url:
                      type: string
                      format: uri
                      nullable: true
                    file_name:
                      type: string
                    content_type:
                      type: string
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'

  /direct_upload:
    post:
      operationId: createDirectUpload
      x-mcp-tool: gen_asset_action
      x-mcp-branch: "create_direct_upload"
      x-phase: edit
      summary: Get pre-signed upload URL
      description: |
        Returns a pre-signed S3 URL for uploading large files (up to 1 GB).

        **Workflow:**
        1. Call this endpoint with file metadata
        2. PUT the file to the returned URL with the specified headers
        3. Use the `signed_id` as `content_resource[file]` in a content resource creation call

        **Compute checksum:** `openssl md5 -binary file | base64`
      tags: [Direct Upload]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [blob]
              properties:
                blob:
                  type: object
                  required: [filename, byte_size, checksum, content_type]
                  properties:
                    filename:
                      type: string
                      example: "hero-video.mp4"
                    byte_size:
                      type: integer
                      description: File size in bytes (max 1 GB).
                      example: 52428800
                    checksum:
                      type: string
                      description: Base64-encoded MD5 checksum.
                      example: "rL0Y20zC+Fzt72VPzMSk2A=="
                    content_type:
                      type: string
                      example: "video/mp4"
                    metadata:
                      type: object
      responses:
        '200':
          description: Pre-signed upload details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DirectUpload'
        '422':
          description: Invalid content type, file size exceeded, or upload failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'

  # ── Agent Profile ─────────────────────────────────────────
  /agent/run:
    post:
      operationId: startAgentRun
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_ask
      x-mcp-branch: "ask"
      x-phase: ideas
      summary: Start an agent run
      description: |
        Sends a message to the agent and starts a new run. Returns immediately with a run ID.
        Poll `GET /agent/runs/{run_id}` for status and messages, or use the returned progress path for live updates.

        **Base URL:** `https://agent.gen.pro/v1`

        **Querying a watchlist with typed filters.** The MCP `gen_query_watchlist`
        tool takes this same call as typed fields: it references a watchlist by
        id with a `@list:<watchlist_id>` token in `message` and lets you pass
        structured filters instead of
        hand-building a prompt. Example message:
        `"top 30 videos from @list:<watchlist_id> by engagement rate in the last 90 days"`.
        The chat layer parses the filters and applies them byte-identically
        across all of the watchlist's sources, and returns a `run_id` whose
        completed answer carries a video grid plus a summary. Supported typed
        filters: `question` (analysis kind — top videos / top hooks / top creators
        / trending music / comment themes), `days` (1-365), `limit` (1-1000),
        `sort_by` (`engagement_rate`, `watch_count`, `like_count`, `comment_count`,
        `share_count`, `save_count`, `posted_at`, `trending_score`),
        `min_engagement_rate` (0.0-1.0), and `return_all`. No silent caps: every
        stated filter is honored across every source; omitted filters fall to one
        default policy (`limit` → 100); out-of-range values return a clarifier.
      tags: [Agent Chat]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [message, agent_id]
              properties:
                message:
                  type: string
                  description: The user's message to the agent.
                  example: "Generate 5 TikTok video ideas about morning routines"
                agent_id:
                  type: string
                  description: The agent to chat with.
                conversation_id:
                  type: string
                  description: Continue an existing conversation. Omit to start a new one.
                attachments:
                  type: array
                  items:
                    type: object
                  description: File attachments for the message.
                context:
                  type: object
                  description: Additional context for the agent.
                debug:
                  type: boolean
                  description: Enable debug mode for verbose logging.
      responses:
        '202':
          description: Run started
          content:
            application/json:
              schema:
                type: object
                properties:
                  run_id:
                    type: string
                  conversation_id:
                    type: string
                  status:
                    type: string
                    example: "running"
                  progress_stream_url:
                    type: string
                    description: Opaque, run-specific URL for live progress updates. Treat as sensitive; or poll GET /agent/runs/{run_id} for an authenticated status path.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          description: Invalid parameters or agent not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'

  /audio/mixes:
    post:
      operationId: createSongMix
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_generate
      x-mcp-branch: "create_song_mix"
      x-phase: ideas
      summary: Create a song-mix job
      description: |
        Creates a backend song-mix job/status object that combines multiple songs
        into one long DJ-style audio output. The default prompt asks GEN to mix
        the songs in optimal order by BPM, key, and mood with professional
        transitions.

        **Base URL:** `https://agent.gen.pro/v1`

        The contract is live now. Until the Mixxx-compatible renderer worker is
        installed, responses return `status: pending_engine` and `output_url:
        null` rather than fabricating a final audio file.
      tags: [Song Mixes]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SongMixRequest'
      responses:
        '202':
          description: Song-mix job/status object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SongMixJob'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          description: Invalid song-mix request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'

  /agent/runs/{run_id}:
    get:
      operationId: getAgentRun
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_discover
      x-mcp-branch: "task.run_status"
      x-phase: ideas
      summary: Get agent run status
      description: |
        Poll this endpoint to check run status and retrieve messages.

        **Base URL:** `https://agent.gen.pro/v1`
      tags: [Agent Chat]
      parameters:
        - name: run_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Run status and messages
          content:
            application/json:
              schema:
                type: object
                properties:
                  run_id:
                    type: string
                  conversation_id:
                    type: string
                  status:
                    type: string
                    enum: [running, completed, failed, awaiting_approval]
                  messages:
                    type: array
                    items:
                      type: object
                      properties:
                        role:
                          type: string
                          enum: [user, assistant, system]
                        content:
                          type: string
                        created_at:
                          type: string
                          format: date-time
        '404':
          $ref: '#/components/responses/NotFound'
        '401':
          $ref: '#/components/responses/AgentUnauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'

  /agent/runs/{run_id}/approve:
    post:
      operationId: approveAgentAction
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_task_action
      x-mcp-branch: "decide_agent_run"
      x-phase: ideas
      summary: Approve or reject a pending agent action
      description: |
        When a run has status `awaiting_approval`, approve the proposed action to continue.
        Send `approved: false` to reject the action and fail the run.

        **Base URL:** `https://agent.gen.pro/v1`
      tags: [Agent Chat]
      parameters:
        - name: run_id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [approved]
              properties:
                approved:
                  type: boolean
                  description: "`true` approves and continues the run; `false` rejects the pending action."
      responses:
        '200':
          description: Action decision accepted
          content:
            application/json:
              schema:
                type: object
                properties:
                  run_id:
                    type: string
                  status:
                    type: string
                    enum: [running, failed]
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          description: Run not in awaiting_approval state
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/AgentUnauthorized'

  /agent/runs/{run_id}/stop:
    post:
      operationId: postAgentRunsByRunIdStop
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_ask
      x-mcp-branch: "stop"
      x-phase: ideas
      summary: Stop a run and return its queued messages
      description: |
        Stops the run and returns every message its conversation still had
        queued. The stop takes effect at the run's next step boundary.

        **Base URL:** `https://agent.gen.pro/v1`
      tags: [Agent Chat]
      parameters:
        - name: run_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Run stopped
          content:
            application/json:
              schema:
                type: object
                properties:
                  run_id:
                    type: string
                  status:
                    type: string
                  returned:
                    type: array
                    items:
                      type: object
                      properties:
                        pending_id:
                          type: string
                        body:
                          type: string
                      required: [pending_id, body]
                required: [run_id, status, returned]
              example:
                run_id: "8b5c1d3e-2a4f-4c6d-9e0f-1a2b3c4d5e6f"
                status: "stopped"
                returned:
                  - pending_id: "3f0a0d2c-5f24-4b3e-8a1c-9d7e6f5a4b3c"
                    body: "add captions to the second clip"
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/AgentValidationError'
        '401':
          $ref: '#/components/responses/AgentUnauthorized'

  /agent/conversations:
    get:
      operationId: listConversations
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_discover
      x-mcp-branch: "platform.conversations"
      x-phase: ideas
      summary: List conversations
      description: |
        Returns all conversations for the authenticated user.

        **Base URL:** `https://agent.gen.pro/v1`
      tags: [Agent Chat]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - name: limit
          in: query
          schema:
            type: integer
            default: 20
          description: Maximum conversations to return.
        - name: after
          in: query
          schema:
            type: string
          description: Pagination cursor - the `next_cursor` of the previous page.
      responses:
        '200':
          description: List of conversations
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Conversation'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'

  /agent/conversations/{id}:
    get:
      operationId: getConversation
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_discover
      x-mcp-branch: "platform.conversation"
      x-phase: ideas
      summary: Get a conversation
      description: |
        Returns a conversation with its messages.

        **Base URL:** `https://agent.gen.pro/v1`
      tags: [Agent Chat]
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: limit
          in: query
          schema:
            type: integer
            default: 50
          description: Maximum messages to return.
        - name: before
          in: query
          schema:
            type: string
          description: Pagination cursor - return messages older than this message id.
      responses:
        '200':
          description: Conversation with messages
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Conversation'
        '404':
          $ref: '#/components/responses/NotFound'
        '401':
          $ref: '#/components/responses/AgentUnauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'

  /agent/conversations/{id}/pending:
    get:
      operationId: getAgentConversationsByIdPending
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_discover
      x-mcp-branch: "platform.conversation_pending"
      x-phase: ideas
      summary: Read the queued messages behind a run
      description: |
        Returns the messages queued behind the conversation's live run, oldest
        first. A message sent while a run is in flight is queued; it leaves the
        queue when it is steered into the run, dispatched as the next run, or
        cancelled.

        **Base URL:** `https://agent.gen.pro/v1`
      tags: [Agent Chat]
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Queued messages
          content:
            application/json:
              schema:
                type: object
                properties:
                  pending:
                    type: array
                    items:
                      type: object
                      properties:
                        pending_id:
                          type: string
                        body:
                          type: string
                        status:
                          type: string
                        position:
                          type: integer
                        created_at:
                          type: string
                      required: [pending_id, body, status, position, created_at]
              example:
                pending:
                  - pending_id: "3f0a0d2c-5f24-4b3e-8a1c-9d7e6f5a4b3c"
                    body: "add captions to the second clip"
                    status: "queued"
                    position: 1
                    created_at: "2026-04-03T10:30:00Z"
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: Queue full
          content:
            application/json:
              example:
                error_code: "queue_full"
                error: "Queue is full (10). Remove one first."
        '422':
          $ref: '#/components/responses/AgentValidationError'
        '401':
          $ref: '#/components/responses/AgentUnauthorized'

  /agent/conversations/{id}/pending/{pending_id}:
    patch:
      operationId: patchAgentConversationsByIdPendingByPendingId
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_ask
      x-mcp-branch: "steer"
      x-phase: ideas
      summary: Promote a queued message into the live run
      description: |
        Promotes a queued message so the active run consumes it at its next step
        boundary. `steering` is the only accepted status; a message that has
        already run is refused.

        **Base URL:** `https://agent.gen.pro/v1`
      tags: [Agent Chat]
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: pending_id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [status]
              properties:
                status:
                  type: string
                  enum: [steering]
            example:
              status: steering
      responses:
        '200':
          description: Queued message promoted
          content:
            application/json:
              schema:
                type: object
                properties:
                  pending_id:
                    type: string
                  body:
                    type: string
                  status:
                    type: string
                  position:
                    type: integer
                  created_at:
                    type: string
                required: [pending_id, body, status, position, created_at]
              example:
                pending_id: "3f0a0d2c-5f24-4b3e-8a1c-9d7e6f5a4b3c"
                body: "add captions to the second clip"
                status: "steering"
                position: 0
                created_at: "2026-04-03T10:30:00Z"
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: The message is no longer queued
          content:
            application/json:
              example:
                error_code: "invalid_transition"
                error: "That message is no longer queued."
        '422':
          $ref: '#/components/responses/AgentValidationError'
        '401':
          $ref: '#/components/responses/AgentUnauthorized'

    delete:
      operationId: deleteAgentConversationsByIdPendingByPendingId
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_ask
      x-mcp-branch: "cancel_pending"
      x-phase: ideas
      summary: Cancel a queued message
      description: |
        Takes a queued message back before it runs. A message that has already
        been sent to the run is refused.

        **Base URL:** `https://agent.gen.pro/v1`
      tags: [Agent Chat]
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: pending_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: Queued message cancelled
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: The message was already sent
          content:
            application/json:
              example:
                error_code: "already_sent"
                error: "That message was already sent."
        '422':
          $ref: '#/components/responses/AgentValidationError'
        '401':
          $ref: '#/components/responses/AgentUnauthorized'

  /agent/conversations/{id}/session-preferences:
    get:
      operationId: getSessionPreferences
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_discover
      x-mcp-branch: "platform.preferences"
      x-phase: ideas
      summary: Get session preferences
      description: |
        Returns the per-conversation session preferences — temporary creative
        rules scoped to this one conversation, distinct from the agent's
        long-term preferences. `preferences` is null if none are set.

        **Base URL:** `https://agent.gen.pro/v1`
      tags: [Agent Chat]
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Current session preferences
          content:
            application/json:
              schema:
                type: object
                properties:
                  preferences: { type: string, nullable: true }
        '404':
          $ref: '#/components/responses/NotFound'
        '401':
          $ref: '#/components/responses/AgentUnauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'
    patch:
      operationId: updateSessionPreferences
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_platform_action
      x-mcp-branch: "update_session_preferences"
      x-phase: ideas
      summary: Update session preferences
      description: |
        Sets the per-conversation session preferences (applied only within this
        conversation; does not change the agent's saved long-term preferences).
        Replaces the existing value.

        **Base URL:** `https://agent.gen.pro/v1`
      tags: [Agent Chat]
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [preferences]
              properties:
                preferences: { type: string }
      responses:
        '200':
          description: Updated session preferences
          content:
            application/json:
              schema:
                type: object
                properties:
                  preferences: { type: string, nullable: true }
        '404':
          $ref: '#/components/responses/NotFound'
        '401':
          $ref: '#/components/responses/AgentUnauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'

  /ideas/{idea_id}/expand:
    post:
      operationId: expandIdea
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_content_action
      x-mcp-branch: "expand_idea"
      x-schema-status: missing
      x-phase: ideas
      summary: Expand an idea into a project manifest
      description: |
        Expands a single content idea into a full `project_manifest` (the
        structured layer/scene plan a vidsheet is built from). Use before
        cloning an idea into a vidsheet when it was generated without a
        manifest. Idempotent — returns the cached manifest if already expanded.
        Note: the path has no `/agent/` segment.

        **Base URL:** `https://agent.gen.pro/v1`
      tags: [Agent Chat]
      parameters:
        - name: idea_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Idea expanded (project_manifest in the response)
        '404':
          $ref: '#/components/responses/NotFound'
        '401':
          $ref: '#/components/responses/AgentUnauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'

  /agent/ideas:
    get:
      operationId: listIdeas
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_discover
      x-mcp-branch: "content.ideas"
      x-phase: ideas
      summary: List content ideas
      description: |
        Returns content ideas for the agent. Requires `agent_id`.

        **Base URL:** `https://agent.gen.pro/v1`
      tags: [Agent Chat]
      parameters:
        - $ref: '#/components/parameters/AgentId'
        - name: status
          in: query
          schema:
            type: string
            enum: [generated, approve_to_create, ready_for_review, change_idea, change_video, rejected, approved_to_post, posted]
          description: Filter by idea status.
      responses:
        '200':
          description: List of ideas
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Idea'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'

  /agent/ideas/{id}/status/{status}:
    put:
      operationId: setIdeaStatus
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_content_action
      x-mcp-branch: "set_idea_status"
      x-schema-status: missing
      x-phase: ideas
      summary: Set idea status explicitly
      description: |
        Sets the idea to a specific status.

        **Base URL:** `https://agent.gen.pro/v1`
      tags: [Agent Chat]
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: status
          in: path
          required: true
          schema:
            type: string
            enum: [generated, approve_to_create, ready_for_review, change_idea, change_video, rejected, approved_to_post, posted]
      responses:
        '200':
          description: Status set
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Idea'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          description: Invalid status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/AgentUnauthorized'

  # ── Research (agent.gen.pro) ──────────────────────────────
  /agents/{agent_id}/core:
    get:
      operationId: getAgentCore
      x-mcp-tool: gen_discover
      x-mcp-branch: "agent.core"
      x-phase: setup
      summary: Get the full agent setup
      description: |
        Returns the agent's full setup as a flat object whose field names mirror
        exactly what the GEN Setup canvas FE reads and writes. Merges brand
        setup, voice association, and personality into a single response — you
        get the whole agent in one call.
      tags: [Agent Core]
      parameters:
        - name: agent_id
          in: path
          required: true
          schema: { type: string }
      responses:
        '200':
          description: Full agent setup
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentCore'
        '401': { $ref: '#/components/responses/Unauthorized' }
        '404': { $ref: '#/components/responses/NotFound' }
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
    patch:
      operationId: patchAgentCore
      x-mcp-tool: gen_agent_action
      x-mcp-branch: "update_agent_core"
      x-phase: setup
      summary: Update any combination of setup fields
      description: |
        Flat merge-patch. Send only the fields you want to change — missing
        fields are not forwarded. Field names map 1:1 to the GEN Setup canvas
        FE — no wrappers, no sections.

        **Field groups:**
        - Brand setup — `brand_name`, `description`, `identity_type`, `goal`,
          `keywords`, `monitored`, `target_platforms`, `shortform`, `longform`,
          `onboarding_status`, `linked_accounts`.
        - Personality — `personality` (full persona/backstory, max 20000 chars).
        - Voice — `default_user_voice`.

        **Guardrails:**
        - Unknown fields return 422 — typos fail fast.
        - `description` is capped at 500 chars. Full persona text belongs in
          `personality` (max 20000 chars).
        - `identity_type` is a strict enum: `"brand"` or `"character"`.
        - `monitored[].item_type` is a strict enum: `"account"`, `"hashtag"`,
          or `"keyword"`.

        **Semantics:** `linked_accounts` and `monitored` use full-list
        replacement. To add one row without touching others, read the current
        list via GET first, append, then PATCH.

        Returns 200 on full success, 207 Multi-Status with per-target results
        on partial failure. See `AgentCorePatchResult` for target keys.
      tags: [Agent Core]
      parameters:
        - name: agent_id
          in: path
          required: true
          schema: { type: string }
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentCorePatch'
      responses:
        '200':
          description: All fields updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentCorePatchResult'
        '207':
          description: Partial success — inspect per-target status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentCorePatchResult'
        '401': { $ref: '#/components/responses/Unauthorized' }
        '422':
          description: Validation error — unknown field, bad enum, or length cap exceeded
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
        '401':
          $ref: '#/components/responses/ApiUnauthorized'

  # ── Agent Voice ───────────────────────────────────────────
    delete:
      operationId: deleteAgentsByAgentIdCore
      servers:
        - url: https://agent-core.gen.pro/v1
      x-phase: ideas
      summary: "Create, update, or remove assistants and their profiles — reset agent profile"
      tags: [Agent Chat]
      parameters:
      - name: agent_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  status:
                    type: "string"
                  agent_id:
                    type: "string"
                required:
                  - "status"
                  - "agent_id"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/AgentCoreValidationError'
      x-mcp-tool: gen_agent_action
      x-mcp-branch: "reset_agent_profile"
  /agents/{agent_id}/proof-of-genesis/backups:
    get:
      operationId: listProofOfGenesisBackups
      servers:
        - url: https://agent-core.gen.pro/v1
      x-mcp-tool: gen_discover
      x-mcp-branch: "platform.backups"
      x-phase: edit
      summary: List Proof of Genesis backups for an agent
      description: |
        Returns Proof of Genesis backup rows newest first. Removed rows are
        hidden by default; pass `include_removed=true` for audit views.
      tags: [Proof of Genesis]
      parameters:
        - { name: agent_id, in: path, required: true, schema: { type: string } }
        - name: include_removed
          in: query
          required: false
          schema: { type: boolean, default: false }
      responses:
        '200':
          description: Backup list
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProofOfGenesisBackupList'
        '401': { $ref: '#/components/responses/Unauthorized' }
        '404': { $ref: '#/components/responses/NotFound' }
        '401':
          $ref: '#/components/responses/AgentCoreUnauthorized'
        '422':
          $ref: '#/components/responses/AgentCoreValidationError'
    post:
      operationId: createProofOfGenesisBackup
      servers:
        - url: https://agent-core.gen.pro/v1
      x-mcp-tool: gen_platform_action
      x-mcp-branch: "create_proof_of_genesis_backup"
      x-phase: edit
      summary: Back up an asset to Walrus
      description: |
        Creates a manual or event-triggered Proof of Genesis backup for an
        image or video asset. Agent Core checks credits before Walrus work and
        charges operation `backup_to_blockchain` after successful upload and
        readback verification.

        Walrus blobs are public by default. Public assets may be uploaded raw.
        Private assets must be encrypted before upload. Raw private requests
        are rejected before billing or Walrus work.
      tags: [Proof of Genesis]
      parameters:
        - { name: agent_id, in: path, required: true, schema: { type: string } }
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProofOfGenesisBackupCreate'
      responses:
        '201':
          description: Backup created or existing idempotent backup returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProofOfGenesisBackup'
        '402':
          description: Insufficient credits or charge rejected
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
        '503':
          description: Proof of Genesis disabled or pricing not configured
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '404': { $ref: '#/components/responses/NotFound' }
        '401':
          $ref: '#/components/responses/AgentCoreUnauthorized'
        '422':
          $ref: '#/components/responses/AgentCoreValidationError'

  /agents/{agent_id}/proof-of-genesis/backups/{backup_id}:
    delete:
      operationId: removeProofOfGenesisBackup
      servers:
        - url: https://agent-core.gen.pro/v1
      x-mcp-tool: gen_platform_action
      x-mcp-branch: "remove_proof_of_genesis_backup"
      x-phase: edit
      summary: Remove a Proof of Genesis backup from the default asset view
      description: |
        Soft-removes a backup row by setting `removed_at`. This hides it from
        the default assets-page list but does not guarantee deletion from Walrus
        or Sui.
      tags: [Proof of Genesis]
      parameters:
        - { name: agent_id, in: path, required: true, schema: { type: string } }
        - { name: backup_id, in: path, required: true, schema: { type: integer } }
      responses:
        '200':
          description: Removed backup row
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProofOfGenesisBackup'
        '401': { $ref: '#/components/responses/Unauthorized' }
        '404': { $ref: '#/components/responses/NotFound' }
        '401':
          $ref: '#/components/responses/AgentCoreUnauthorized'
        '422':
          $ref: '#/components/responses/AgentCoreValidationError'

  # ── Agent Voice ───────────────────────────────────────────
  /agents/{agent_id}/watchlists:
    get:
      operationId: listWatchlists
      servers:
        - url: https://agent-core.gen.pro/v1
      x-mcp-tool: gen_discover
      x-mcp-branch: "watchlist.list"
      x-phase: monitoring
      summary: List active watchlists for an agent
      tags: [Watchlists]
      parameters:
        - { name: agent_id, in: path, required: true, schema: { type: string } }
      responses:
        '200':
          description: Active watchlists, newest first
          content:
            application/json:
              schema:
                type: array
                items: { $ref: '#/components/schemas/Watchlist' }
        '401':
          $ref: '#/components/responses/AgentCoreUnauthorized'
        '422':
          $ref: '#/components/responses/AgentCoreValidationError'
    post:
      operationId: createWatchlist
      servers:
        - url: https://agent-core.gen.pro/v1
      x-mcp-tool: gen_watchlist_action
      x-mcp-branch: "create_watchlist"
      x-phase: monitoring
      summary: Create a watchlist (idempotent on name)
      description: |
        Create a new watchlist with optional initial sources. Idempotent on
        `name` (case-insensitive): if a watchlist with the same name already
        exists for this agent, the provided sources are merged into the
        existing watchlist instead of creating a duplicate.
      tags: [Watchlists]
      parameters:
        - { name: agent_id, in: path, required: true, schema: { type: string } }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/WatchlistCreateRequest' }
      responses:
        '201':
          description: Watchlist created or merged
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Watchlist' }
        '401':
          $ref: '#/components/responses/AgentCoreUnauthorized'
        '422':
          $ref: '#/components/responses/AgentCoreValidationError'

  /agents/{agent_id}/watchlists/{watchlist_id}:
    get:
      operationId: getWatchlist
      servers:
        - url: https://agent-core.gen.pro/v1
      x-mcp-tool: gen_discover
      x-mcp-branch: "watchlist.detail"
      x-phase: monitoring
      summary: Get a single watchlist with sources
      tags: [Watchlists]
      parameters:
        - { name: agent_id, in: path, required: true, schema: { type: string } }
        - { name: watchlist_id, in: path, required: true, schema: { type: string } }
      responses:
        '200':
          description: Watchlist record
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Watchlist' }
        '404': { $ref: '#/components/responses/NotFound' }
        '401':
          $ref: '#/components/responses/AgentCoreUnauthorized'
        '422':
          $ref: '#/components/responses/AgentCoreValidationError'
    patch:
      operationId: updateWatchlist
      servers:
        - url: https://agent-core.gen.pro/v1
      x-mcp-tool: gen_watchlist_action
      x-mcp-branch: "pause_watchlist"
      x-phase: monitoring
      summary: Update a watchlist (also used for pause/resume)
      description: |
        Update mutable fields. Set `intent_active=false` to pause monitoring
        without deleting the watchlist; `true` to resume. Only fields you
        send are updated.
      tags: [Watchlists]
      parameters:
        - { name: agent_id, in: path, required: true, schema: { type: string } }
        - { name: watchlist_id, in: path, required: true, schema: { type: string } }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/WatchlistUpdateRequest' }
      responses:
        '200':
          description: Updated watchlist
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Watchlist' }
        '404': { $ref: '#/components/responses/NotFound' }
        '401':
          $ref: '#/components/responses/AgentCoreUnauthorized'
        '422':
          $ref: '#/components/responses/AgentCoreValidationError'
    delete:
      operationId: deleteWatchlist
      servers:
        - url: https://agent-core.gen.pro/v1
      x-mcp-tool: gen_watchlist_action
      x-mcp-branch: "delete_watchlist"
      x-phase: monitoring
      summary: Soft-delete a watchlist
      description: |
        Marks the watchlist and all its sources inactive and deleted. The
        rows are retained in the database. Use PATCH with `intent_active=false`
        for a reversible pause.
      tags: [Watchlists]
      parameters:
        - { name: agent_id, in: path, required: true, schema: { type: string } }
        - { name: watchlist_id, in: path, required: true, schema: { type: string } }
      responses:
        '200':
          description: Watchlist deleted
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok: { type: boolean }
                  deleted: { type: boolean }
        '401':
          $ref: '#/components/responses/AgentCoreUnauthorized'
        '422':
          $ref: '#/components/responses/AgentCoreValidationError'

  /agents/{agent_id}/watchlists/{watchlist_id}/sources:
    post:
      operationId: addWatchlistSource
      servers:
        - url: https://agent-core.gen.pro/v1
      x-mcp-tool: gen_watchlist_action
      x-mcp-branch: "add_watchlist_source"
      x-phase: monitoring
      summary: Add or restore a source on a watchlist
      description: |
        Idempotent on (platform, target_type, target_value). Re-adding the
        same source returns the existing row (restored if it had been
        soft-deleted).
      tags: [Watchlists]
      parameters:
        - { name: agent_id, in: path, required: true, schema: { type: string } }
        - { name: watchlist_id, in: path, required: true, schema: { type: string } }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/WatchSourceInput' }
      responses:
        '201':
          description: Source added or restored
          content:
            application/json:
              schema: { $ref: '#/components/schemas/WatchSource' }
        '401':
          $ref: '#/components/responses/AgentCoreUnauthorized'
        '422':
          $ref: '#/components/responses/AgentCoreValidationError'
    delete:
      operationId: removeWatchlistSourceByKey
      servers:
        - url: https://agent-core.gen.pro/v1
      x-mcp-tool: gen_watchlist_action
      x-mcp-branch: "remove_watchlist_source"
      x-phase: monitoring
      summary: Remove a source by (platform, target_type, target_value)
      tags: [Watchlists]
      parameters:
        - { name: agent_id, in: path, required: true, schema: { type: string } }
        - { name: watchlist_id, in: path, required: true, schema: { type: string } }
        - { name: platform, in: query, required: true, schema: { type: string } }
        - { name: target_type, in: query, required: true, schema: { type: string, enum: [account, hashtag, keyword] } }
        - { name: target_value, in: query, required: true, schema: { type: string } }
      responses:
        '200':
          description: Source removed
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok: { type: boolean }
                  removed: { type: boolean }
        '401':
          $ref: '#/components/responses/AgentCoreUnauthorized'
        '422':
          $ref: '#/components/responses/AgentCoreValidationError'

  /agents/{agent_id}/watchlists/{watchlist_id}/sources/{source_id}:
    delete:
      operationId: removeWatchlistSource
      servers:
        - url: https://agent-core.gen.pro/v1
      x-mcp-tool: gen_watchlist_action
      x-mcp-branch: "remove_watchlist_source"
      x-phase: monitoring
      summary: Remove a source by id
      tags: [Watchlists]
      parameters:
        - { name: agent_id, in: path, required: true, schema: { type: string } }
        - { name: watchlist_id, in: path, required: true, schema: { type: string } }
        - { name: source_id, in: path, required: true, schema: { type: string } }
      responses:
        '200':
          description: Source removed
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok: { type: boolean }
                  removed: { type: boolean }
        '401':
          $ref: '#/components/responses/AgentCoreUnauthorized'
        '422':
          $ref: '#/components/responses/AgentCoreValidationError'

  # ── Recurring Jobs / Daily Tasks (agent.gen.pro) ──────────────────────────
  /agents/{agent_id}/recurring-jobs:
    get:
      operationId: listRecurringJobs
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_discover
      x-mcp-branch: "task.list"
      x-phase: monitoring
      summary: List recurring jobs (daily tasks) for an agent
      tags: [Recurring Jobs]
      parameters:
        - { name: agent_id, in: path, required: true, schema: { type: string } }
      responses:
        '200':
          description: Recurring jobs, newest first
          content:
            application/json:
              schema:
                type: object
                properties:
                  recurring_jobs:
                    type: array
                    items: { $ref: '#/components/schemas/RecurringJob' }
        '401':
          $ref: '#/components/responses/AgentUnauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'
    post:
      operationId: createRecurringJob
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_task_action
      x-mcp-branch: "create_recurring_job"
      x-phase: monitoring
      summary: Create a recurring agent job
      tags: [Recurring Jobs]
      parameters:
        - { name: agent_id, in: path, required: true, schema: { type: string } }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/RecurringJobCreate' }
      responses:
        '201':
          description: Created recurring job
          content:
            application/json:
              schema: { $ref: '#/components/schemas/RecurringJob' }
        '401':
          $ref: '#/components/responses/AgentUnauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'

    patch:
      operationId: patchAgentsByAgentIdRecurringJobs
      servers:
        - url: https://agent.gen.pro/v1
      x-phase: ideas
      summary: "Manage recurring jobs and monitoring tasks — update recurring job"
      tags: [Agent Chat]
      parameters:
      - name: agent_id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                name:
                  anyOf:
                    - type: "string"
                      maxLength: 200
                      minLength: 1
                    - type: "null"
                job_type:
                  anyOf:
                    - type: "string"
                      maxLength: 100
                      minLength: 1
                    - type: "null"
                prompt:
                  anyOf:
                    - type: "string"
                      maxLength: 20000
                      minLength: 1
                    - type: "null"
                vidsheet_url:
                  anyOf:
                    - type: "string"
                      maxLength: 2000
                      minLength: 1
                    - type: "null"
                schedule:
                  anyOf:
                    - properties:
                        cadence:
                          type: "string"
                          enum:
                            - "minutely"
                            - "hourly"
                            - "daily"
                            - "weekly"
                            - "monthly"
                        timezone:
                          type: "string"
                        time_of_day:
                          anyOf:
                            - type: "string"
                              pattern: "^\\d{2}:\\d{2}$"
                            - type: "null"
                        days_of_week:
                          anyOf:
                            - items:
                                type: "integer"
                              type: "array"
                            - type: "null"
                        day_of_month:
                          anyOf:
                            - type: "integer"
                            - type: "null"
                        interval_value:
                          anyOf:
                            - type: "integer"
                            - type: "null"
                        freshness_window_minutes:
                          anyOf:
                            - type: "integer"
                              maximum: 1440.0
                              minimum: 1.0
                            - type: "null"
                      type: "object"
                      required:
                        - "cadence"
                        - "timezone"
                    - type: "null"
                delivery:
                  anyOf:
                    - properties:
                        type:
                          type: "string"
                          enum:
                            - "chat_only"
                            - "email"
                          default: "email"
                        email:
                          anyOf:
                            - type: "string"
                            - type: "null"
                        recipients:
                          anyOf:
                            - items:
                                type: "string"
                              type: "array"
                            - type: "null"
                        preferences:
                          anyOf:
                            - $ref: "#/components/schemas/RecurringJobDeliveryPreferences"
                            - type: "null"
                      type: "object"
                    - type: "null"
                status:
                  anyOf:
                    - type: "string"
                      enum:
                        - "active"
                        - "paused"
                    - type: "null"
                auto_publish:
                  anyOf:
                    - type: "boolean"
                    - type: "null"
                actions:
                  anyOf:
                    - items:
                        properties:
                          position:
                            type: "integer"
                            minimum: 1.0
                          kind:
                            type: "string"
                            enum:
                              - "update_element"
                              - "update_track"
                            default: "update_element"
                          target:
                            $ref: "#/components/schemas/AutomationActionTarget"
                          update_with:
                            type: "string"
                            maxLength: 4000
                            default: ""
                          model:
                            anyOf:
                              - type: "string"
                                maxLength: 100
                                minLength: 1
                              - type: "null"
                        additionalProperties: false
                        type: "object"
                        required:
                          - "position"
                          - "target"
                      type: "array"
                    - type: "null"
                actions_parallel:
                  anyOf:
                    - type: "boolean"
                    - type: "null"
                auto_generate_video:
                  anyOf:
                    - type: "boolean"
                    - type: "null"
                next_run_at:
                  anyOf:
                    - type: "string"
                      format: "date-time"
                    - type: "null"
                row_strategy:
                  anyOf:
                    - type: "string"
                      enum:
                        - "duplicate_last_row"
                        - "add_new_row"
                    - type: "null"
              type: "object"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                additionalProperties: true
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/AgentValidationError'
      x-mcp-tool: gen_task_action
      x-mcp-branch: "update_recurring_job"
    delete:
      operationId: deleteAgentsByAgentIdRecurringJobs
      servers:
        - url: https://agent.gen.pro/v1
      x-phase: ideas
      summary: "Manage recurring jobs and monitoring tasks — delete recurring job"
      tags: [Agent Chat]
      parameters:
      - name: agent_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/AgentValidationError'
      x-mcp-tool: gen_task_action
      x-mcp-branch: "delete_recurring_job"
      x-schema-status: missing
  /agents/{agent_id}/recurring-jobs/defaults:
    post:
      operationId: ensureDefaultRecurringJob
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_task_action
      x-mcp-branch: "ensure_default_recurring_job"
      x-schema-status: missing
      x-phase: monitoring
      summary: Idempotently ensure the default daily content-ideas job
      description: |
        Returns the agent's existing default content-ideas recurring job if
        one exists, otherwise creates it with the standard prompt, daily
        cadence at 09:00 UTC, and `chat_only` delivery. The response `created`
        boolean indicates whether a new job was created.
      tags: [Recurring Jobs]
      parameters:
        - { name: agent_id, in: path, required: true, schema: { type: string } }
      responses:
        '201':
          description: Default job ensured
          content:
            application/json:
              schema:
                type: object
                properties:
                  recurring_jobs:
                    type: array
                    items: { $ref: '#/components/schemas/RecurringJob' }
                  created: { type: boolean }
        '401':
          $ref: '#/components/responses/AgentUnauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'

  /agents/{agent_id}/recurring-jobs/{job_id}:
    get:
      operationId: getRecurringJob
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_discover
      x-mcp-branch: "task.job"
      x-phase: monitoring
      summary: Get one recurring job
      tags: [Recurring Jobs]
      parameters:
        - { name: agent_id, in: path, required: true, schema: { type: string } }
        - { name: job_id, in: path, required: true, schema: { type: string } }
      responses:
        '200':
          description: Recurring job
          content:
            application/json:
              schema: { $ref: '#/components/schemas/RecurringJob' }
        '404': { $ref: '#/components/responses/NotFound' }
        '401':
          $ref: '#/components/responses/AgentUnauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'
    patch:
      operationId: updateRecurringJob
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_task_action
      x-mcp-branch: "update_recurring_job"
      x-phase: monitoring
      summary: Update a recurring job's mutable fields
      tags: [Recurring Jobs]
      parameters:
        - { name: agent_id, in: path, required: true, schema: { type: string } }
        - { name: job_id, in: path, required: true, schema: { type: string } }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/RecurringJobUpdate' }
      responses:
        '200':
          description: Updated job
          content:
            application/json:
              schema: { $ref: '#/components/schemas/RecurringJob' }
        '404': { $ref: '#/components/responses/NotFound' }
        '401':
          $ref: '#/components/responses/AgentUnauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'
    delete:
      operationId: deleteRecurringJob
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_task_action
      x-mcp-branch: "delete_recurring_job"
      x-phase: monitoring
      summary: Soft-delete a recurring job
      tags: [Recurring Jobs]
      parameters:
        - { name: agent_id, in: path, required: true, schema: { type: string } }
        - { name: job_id, in: path, required: true, schema: { type: string } }
      responses:
        '204':
          description: Deleted (no content)
        '404': { $ref: '#/components/responses/NotFound' }
        '401':
          $ref: '#/components/responses/AgentUnauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'

  /agents/{agent_id}/recurring-jobs/{job_id}/pause:
    post:
      operationId: pauseRecurringJob
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_task_action
      x-mcp-branch: "pause_recurring_job"
      x-schema-status: missing
      x-phase: monitoring
      summary: Pause a recurring job
      tags: [Recurring Jobs]
      parameters:
        - { name: agent_id, in: path, required: true, schema: { type: string } }
        - { name: job_id, in: path, required: true, schema: { type: string } }
      responses:
        '200':
          description: Paused job
          content:
            application/json:
              schema: { $ref: '#/components/schemas/RecurringJob' }
        '401':
          $ref: '#/components/responses/AgentUnauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'

  /agents/{agent_id}/recurring-jobs/{job_id}/resume:
    post:
      operationId: resumeRecurringJob
      servers:
        - url: https://agent.gen.pro/v1
      x-mcp-tool: gen_task_action
      x-mcp-branch: "resume_recurring_job"
      x-schema-status: missing
      x-phase: monitoring
      summary: Resume a paused recurring job
      tags: [Recurring Jobs]
      parameters:
        - { name: agent_id, in: path, required: true, schema: { type: string } }
        - { name: job_id, in: path, required: true, schema: { type: string } }
      responses:
        '200':
          description: Resumed job
          content:
            application/json:
              schema: { $ref: '#/components/schemas/RecurringJob' }
        '401':
          $ref: '#/components/responses/AgentUnauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'


  /agent/ideas/{idea_id}:
    get:
      operationId: getAgentIdeasByIdeaId
      servers:
        - url: https://agent.gen.pro/v1
      x-phase: ideas
      summary: "Discover — idea"
      tags: [Agent Chat]
      parameters:
      - name: idea_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/AgentValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "content.idea"
      x-schema-status: missing
  /agents/{agent_id}/core/complete-profile:
    post:
      operationId: postAgentsByAgentIdCoreCompleteProfile
      servers:
        - url: https://agent-core.gen.pro/v1
      x-phase: ideas
      summary: "Create, update, or remove assistants and their profiles — complete profile"
      tags: [Agent Chat]
      parameters:
      - name: agent_id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                linked_accounts:
                  anyOf:
                    - items:
                        properties:
                          url:
                            type: "string"
                          platform:
                            anyOf:
                              - type: "string"
                              - type: "null"
                          display_name:
                            anyOf:
                              - type: "string"
                              - type: "null"
                        additionalProperties: false
                        type: "object"
                        required:
                          - "url"
                      type: "array"
                    - type: "null"
                video_type:
                  anyOf:
                    - items:
                        type: "string"
                        enum:
                          - "talking_head"
                          - "faceless"
                          - "animation"
                          - "clips"
                          - "montages"
                          - "other"
                      type: "array"
                    - type: "null"
              additionalProperties: false
              type: "object"
      responses:
        '200':
          description: Success.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/AgentCoreValidationError'
      x-mcp-tool: gen_agent_action
      x-mcp-branch: "complete_profile"
      x-schema-status: missing
  /agents/{agent_id}/core/linked-accounts:
    post:
      operationId: postAgentsByAgentIdCoreLinkedAccounts
      servers:
        - url: https://agent-core.gen.pro/v1
      x-phase: ideas
      summary: "Create, update, or remove assistants and their profiles — add agent account"
      tags: [Agent Chat]
      parameters:
      - name: agent_id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                url:
                  type: "string"
                  maxLength: 2000
                  minLength: 1
                display_name:
                  anyOf:
                    - type: "string"
                    - type: "null"
              additionalProperties: false
              type: "object"
              required:
                - "url"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                properties:
                  id:
                    type: "integer"
                  url:
                    type: "string"
                  platform:
                    type: "string"
                  display_name:
                    anyOf:
                      - type: "string"
                      - type: "null"
                type: "object"
                required:
                  - "id"
                  - "url"
                  - "platform"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/AgentCoreValidationError'
      x-mcp-tool: gen_agent_action
      x-mcp-branch: "add_agent_account"
  /agents/{agent_id}/core/linked-accounts/{linked_account_id}:
    delete:
      operationId: deleteAgentsByAgentIdCoreLinkedAccountsByLinkedAccountId
      servers:
        - url: https://agent-core.gen.pro/v1
      x-phase: ideas
      summary: "Create, update, or remove assistants and their profiles — remove linked account"
      tags: [Agent Chat]
      parameters:
      - name: agent_id
        in: path
        required: true
        schema:
          type: string
      - name: linked_account_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/AgentCoreValidationError'
      x-mcp-tool: gen_agent_action
      x-mcp-branch: "remove_linked_account"
      x-schema-status: missing
  /agents/{agent_id}/core/reference-images:
    post:
      operationId: postAgentsByAgentIdCoreReferenceImages
      servers:
        - url: https://agent-core.gen.pro/v1
      x-phase: ideas
      summary: "Create, update, or remove assistants and their profiles — add agent look"
      tags: [Agent Chat]
      parameters:
      - name: agent_id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                content_resource_ids:
                  anyOf:
                    - items:
                        type: "integer"
                      type: "array"
                    - type: "null"
                images:
                  anyOf:
                    - items:
                        properties:
                          content_resource_id:
                            type: "integer"
                          url:
                            anyOf:
                              - type: "string"
                              - type: "null"
                          thumbnail_url:
                            anyOf:
                              - type: "string"
                              - type: "null"
                          added_at:
                            anyOf:
                              - type: "string"
                                maxLength: 100
                              - type: "null"
                        additionalProperties: false
                        type: "object"
                        required:
                          - "content_resource_id"
                      type: "array"
                    - type: "null"
              additionalProperties: false
              type: "object"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "array"
                items:
                  properties:
                    content_resource_id:
                      type: "integer"
                    url:
                      anyOf:
                        - type: "string"
                        - type: "null"
                    thumbnail_url:
                      anyOf:
                        - type: "string"
                        - type: "null"
                    added_at:
                      anyOf:
                        - type: "string"
                        - type: "null"
                  type: "object"
                  required:
                    - "content_resource_id"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/AgentCoreValidationError'
      x-mcp-tool: gen_agent_action
      x-mcp-branch: "add_agent_look"
    delete:
      operationId: deleteAgentsByAgentIdCoreReferenceImages
      servers:
        - url: https://agent-core.gen.pro/v1
      x-phase: ideas
      summary: "Create, update, or remove assistants and their profiles — add agent look"
      tags: [Agent Chat]
      parameters:
      - name: agent_id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                ids:
                  items:
                    type: "integer"
                  type: "array"
                  maxItems: 50
                  minItems: 1
              additionalProperties: false
              type: "object"
              required:
                - "ids"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "array"
                items:
                  properties:
                    content_resource_id:
                      type: "integer"
                    url:
                      anyOf:
                        - type: "string"
                        - type: "null"
                    thumbnail_url:
                      anyOf:
                        - type: "string"
                        - type: "null"
                    added_at:
                      anyOf:
                        - type: "string"
                        - type: "null"
                  type: "object"
                  required:
                    - "content_resource_id"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/AgentCoreValidationError'
      x-mcp-tool: gen_agent_action
      x-mcp-branch: "add_agent_look"
  /agents/{agent_id}/monitoring/effective:
    get:
      operationId: getAgentsByAgentIdMonitoringEffective
      servers:
        - url: https://agent-core.gen.pro/v1
      x-phase: ideas
      summary: "Discover — monitoring"
      tags: [Agent Chat]
      parameters:
      - name: agent_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/AgentCoreValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "agent.monitoring"
      x-schema-status: missing
  /agents/{agent_id}/recurring-jobs/{job_id}/duplicate:
    post:
      operationId: postAgentsByAgentIdRecurringJobsByJobIdDuplicate
      servers:
        - url: https://agent.gen.pro/v1
      x-phase: ideas
      summary: "Manage recurring jobs and monitoring tasks — duplicate recurring job"
      tags: [Agent Chat]
      parameters:
      - name: agent_id
        in: path
        required: true
        schema:
          type: string
      - name: job_id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                vidsheet_url:
                  type: "string"
                  maxLength: 2000
                  minLength: 1
                name:
                  anyOf:
                    - type: "string"
                      maxLength: 200
                      minLength: 1
                    - type: "null"
                activate:
                  type: "boolean"
                  default: true
              additionalProperties: false
              type: "object"
              required:
                - "vidsheet_url"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                additionalProperties: true
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/AgentValidationError'
      x-mcp-tool: gen_task_action
      x-mcp-branch: "duplicate_recurring_job"
  /agents/{agent_id}/recurring-jobs/{job_id}/test-run:
    post:
      operationId: postAgentsByAgentIdRecurringJobsByJobIdTestRun
      servers:
        - url: https://agent.gen.pro/v1
      x-phase: ideas
      summary: "Manage recurring jobs and monitoring tasks — run recurring job now"
      tags: [Agent Chat]
      parameters:
      - name: agent_id
        in: path
        required: true
        schema:
          type: string
      - name: job_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                additionalProperties: true
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/AgentValidationError'
      x-mcp-tool: gen_task_action
      x-mcp-branch: "run_recurring_job_now"
      x-schema-status: missing
  /analyze/clip_moments:
    post:
      operationId: postAnalyzeClipMoments
      servers:
        - url: https://agent.gen.pro/v1
      x-phase: ideas
      summary: "Analyze social trends, comments, hooks, and creators — clip moments"
      tags: [Agent Chat]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                agent_id:
                  type: "string"
                  maxLength: 128
                  minLength: 1
                sources:
                  items:
                    type: "string"
                  type: "array"
                  maxItems: 10
                  minItems: 1
                clip_count:
                  type: "integer"
                  maximum: 10.0
                  minimum: 1.0
                  default: 1
                min_duration_s:
                  anyOf:
                    - type: "number"
                      exclusiveMinimum: 0.0
                    - type: "null"
                max_duration_s:
                  anyOf:
                    - type: "number"
                      exclusiveMinimum: 0.0
                    - type: "null"
                mode:
                  anyOf:
                    - type: "string"
                      enum:
                        - "viral_moments"
                        - "summarize"
                    - type: "null"
                presentation:
                  anyOf:
                    - type: "string"
                      enum:
                        - "source_clip"
                        - "floating_head"
                        - "split_screen"
                    - type: "null"
                output_aspect_ratio:
                  anyOf:
                    - type: "string"
                      enum:
                        - "9:16"
                        - "16:9"
                        - "1:1"
                    - type: "null"
                smart_reframe:
                  anyOf:
                    - type: "boolean"
                    - type: "null"
                playback_speed:
                  anyOf:
                    - type: "number"
                      exclusiveMinimum: 0.0
                    - type: "null"
                target_final_max_duration_s:
                  anyOf:
                    - type: "number"
                      exclusiveMinimum: 0.0
                    - type: "null"
                enrich:
                  anyOf:
                    - type: "boolean"
                    - type: "null"
              additionalProperties: false
              type: "object"
              required:
                - "agent_id"
                - "sources"
      responses:
        '200':
          description: Success.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'
      x-mcp-tool: gen_analyze
      x-mcp-branch: "clip_moments"
      x-schema-status: missing
  /analyze/jobs/{job_id}:
    get:
      operationId: getAnalyzeJobsByJobId
      servers:
        - url: https://agent.gen.pro/v1
      x-phase: ideas
      summary: "Analyze social trends, comments, hooks, and creators — comment mining"
      tags: [Agent Chat]
      parameters:
      - name: job_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  job_id:
                    type: "string"
                  status:
                    type: "string"
                  kind:
                    type:
                      - "string"
                      - "null"
                  agent_id:
                    type:
                      - "string"
                      - "null"
                  error:
                    type: "string"
                  result:
                    type: "object"
                    additionalProperties: true
                required:
                  - "job_id"
                  - "status"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/AgentValidationError'
      x-mcp-tool: gen_analyze
      x-mcp-branch: "comment_mining"
  /analyze/research:
    post:
      operationId: postAnalyzeResearch
      servers:
        - url: https://agent.gen.pro/v1
      x-phase: ideas
      summary: "Analyze social trends, comments, hooks, and creators — comment mining"
      tags: [Agent Chat]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                agent_id:
                  type: "string"
                  minLength: 1
                query:
                  type: "string"
                  minLength: 1
                mode:
                  anyOf:
                    - type: "string"
                      enum:
                        - "news"
                        - "social"
                        - "web"
                        - "all"
                    - type: "null"
                platforms:
                  anyOf:
                    - items:
                        type: "string"
                        enum:
                          - "x"
                          - "news"
                          - "web"
                      type: "array"
                    - type: "null"
                days:
                  anyOf:
                    - type: "integer"
                      maximum: 365.0
                      minimum: 1.0
                    - type: "null"
                limit:
                  anyOf:
                    - type: "integer"
                      maximum: 1000.0
                      minimum: 1.0
                    - type: "null"
                idempotency_key:
                  anyOf:
                    - type: "string"
                    - type: "null"
              type: "object"
              required:
                - "agent_id"
                - "query"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  job_id:
                    type: "string"
                  status:
                    type: "string"
                  kind:
                    type: "string"
                required:
                  - "job_id"
                  - "status"
                  - "kind"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'
      x-mcp-tool: gen_analyze
      x-mcp-branch: "comment_mining"
  /analyze/synthesis:
    post:
      operationId: postAnalyzeSynthesis
      servers:
        - url: https://agent.gen.pro/v1
      x-phase: ideas
      summary: "Analyze social trends, comments, hooks, and creators — comment mining"
      tags: [Agent Chat]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                agent_id:
                  type: "string"
                  maxLength: 128
                  minLength: 1
                kind:
                  type: "string"
                  enum:
                    - "comments"
                    - "video"
                platform:
                  type: "string"
                  enum:
                    - "tiktok"
                    - "instagram"
                    - "youtube"
                  default: "tiktok"
                query:
                  type: "string"
                  maxLength: 2000
                  default: ""
                target:
                  anyOf:
                    - type: "string"
                      maxLength: 2048
                    - type: "null"
                video_url:
                  anyOf:
                    - type: "string"
                      maxLength: 2048
                    - type: "null"
                limit:
                  type: "integer"
                  maximum: 200.0
                  minimum: 1.0
                  default: 50
                days:
                  type: "integer"
                  maximum: 365.0
                  minimum: 1.0
                  default: 30
                include_video_analysis:
                  type: "boolean"
                  default: false
                idempotency_key:
                  anyOf:
                    - type: "string"
                    - type: "null"
              additionalProperties: false
              type: "object"
              required:
                - "agent_id"
                - "kind"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  job_id:
                    type: "string"
                  status:
                    type: "string"
                  kind:
                    type: "string"
                required:
                  - "job_id"
                  - "status"
                  - "kind"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'
      x-mcp-tool: gen_analyze
      x-mcp-branch: "comment_mining"
  /analyze/trends:
    post:
      operationId: postAnalyzeTrends
      servers:
        - url: https://agent.gen.pro/v1
      x-phase: ideas
      summary: "Analyze social trends, comments, hooks, and creators — comment mining"
      tags: [Agent Chat]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                agent_id:
                  type: "string"
                  minLength: 1
                branch:
                  type: "string"
                  enum:
                    - "trends"
                    - "hooks"
                    - "creators"
                  default: "trends"
                query:
                  type: "string"
                  default: ""
                mode:
                  anyOf:
                    - type: "string"
                      enum:
                        - "hashtag"
                        - "keyword"
                        - "niche"
                        - "handle"
                    - type: "null"
                target:
                  anyOf:
                    - type: "string"
                    - items:
                      type: "array"
                    - type: "null"
                creator:
                  anyOf:
                    - type: "string"
                    - type: "null"
                platform:
                  anyOf:
                    - type: "string"
                      enum:
                        - "tiktok"
                        - "instagram"
                        - "youtube"
                        - "kick"
                        - "all"
                    - type: "null"
                filters:
                  anyOf:
                    - additionalProperties: True
                      type: "object"
                    - type: "null"
                relevance_query:
                  anyOf:
                    - type: "string"
                    - type: "null"
                raw:
                  anyOf:
                    - type: "boolean"
                    - type: "null"
                idempotency_key:
                  anyOf:
                    - type: "string"
                    - type: "null"
              type: "object"
              required:
                - "agent_id"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  job_id:
                    type: "string"
                  status:
                    type: "string"
                  kind:
                    type: "string"
                required:
                  - "job_id"
                  - "status"
                  - "kind"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'
      x-mcp-tool: gen_analyze
      x-mcp-branch: "comment_mining"
  /audio_matching_jobs:
    post:
      operationId: postAudioMatchingJobs
      x-phase: ideas
      summary: "Vidsheet action — <flat ops>"
      tags: [Song Mixes]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              required:
                - "agent_id"
                - "user_job"
              properties:
                agent_id:
                  type: "string"
                  description: "Agent context; the controller reads params[:agent_id] (`require_agent!`)."
                user_job:
                  type: "object"
                  properties:
                    data: {}
                    project_id: {}
                    container_id: {}
                    container_type: {}
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  user_job_id: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "<flat ops>"
  /aura/proxy-locations/cities:
    get:
      operationId: getAuraProxyLocationsCities
      x-phase: setup
      summary: "Discover — cities"
      tags: [Agent Profile]
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  catalog_version: {}
                  cities:
                    type: "array"
                    items:
                      type: "object"
                      properties:
                        id: {}
                        name: {}
                        region: {}
                        time_zone: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "location.cities"
  /aura/proxy-locations/countries:
    get:
      operationId: getAuraProxyLocationsCountries
      x-phase: setup
      summary: "Discover — countries"
      tags: [Agent Profile]
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  catalog_version: {}
                  countries:
                    type: "array"
                    items:
                      type: "object"
                      properties:
                        code: {}
                        name: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "location.countries"
  /characters:
    get:
      operationId: getCharacters
      x-phase: setup
      summary: "Manage characters, looks, and talking characters — list"
      description: "GET /v1/avatars is the deprecated name of this route. It still works and answers with avatar field names; use this /v1/characters route."
      tags: [Characters]
      parameters:
      - name: "agent_id"
        in: "query"
        required: True
        description: "The agent whose characters these are."
        schema:
          type: "integer"
      - name: "has_looks"
        in: "query"
        description: "true lists only characters with at least one look."
        schema:
          default: false
          type: "boolean"
      - name: "search"
        in: "query"
        description: "Only characters whose name contains this text (case-insensitive)."
        schema:
          type: "string"
      - name: "source"
        in: "query"
        description: "my lists the agent's own and workspace-granted characters, library the shared character library, all all three (own first)."
        schema:
          default: "my"
          enum:
            - "my"
            - "library"
            - "all"
          type: "string"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "array"
                items:
                  additionalProperties: false
                  description: "One row of GET /v1/characters (the index list)."
                  properties:
                    availability:
                      additionalProperties: false
                      properties:
                        missing:
                          items:
                            enum:
                              - "looks.url"
                              - "primary_voice.voice_id"
                          type: "array"
                        speaking:
                          type: "boolean"
                        visual:
                          type: "boolean"
                      required:
                        - "visual"
                        - "speaking"
                        - "missing"
                      type: "object"
                    character_id:
                      minimum: 1
                      type: "integer"
                    character_public_id:
                      description: "Random public id for URLs; every character endpoint accepts it in place of character_id."
                      pattern: "^[2-9A-HJ-NP-Z]{8}$"
                      type: "string"
                    cover_url:
                      type:
                        - "string"
                        - "null"
                    default_talking_character:
                      additionalProperties: false
                      description: "A ready talking character: url plays it with its voice, latest_generated_video_url is its latest voiced video."
                      properties:
                        aspect_ratio:
                          type:
                            - "string"
                            - "null"
                        character_id:
                          type:
                            - "integer"
                            - "null"
                        duration:
                          type:
                            - "integer"
                            - "null"
                        kind:
                          enum:
                            - "generated"
                            - "uploaded"
                        latest_generated_video_url:
                          type:
                            - "string"
                            - "null"
                        look_id:
                          type:
                            - "integer"
                            - "null"
                        made_from_talking_character_id:
                          type:
                            - "integer"
                            - "null"
                        name:
                          type:
                            - "string"
                            - "null"
                        status:
                          enum:
                            - "ready"
                        talking_character_id:
                          minimum: 1
                          type: "integer"
                        thumbnail_url:
                          type:
                            - "string"
                            - "null"
                        url:
                          type:
                            - "string"
                            - "null"
                      required:
                        - "talking_character_id"
                        - "name"
                        - "kind"
                        - "status"
                        - "url"
                        - "thumbnail_url"
                        - "duration"
                        - "character_id"
                        - "look_id"
                        - "made_from_talking_character_id"
                        - "latest_generated_video_url"
                        - "aspect_ratio"
                      type:
                        - "object"
                        - "null"
                    is_agent_character:
                      type: "boolean"
                    latest_generated_video_url:
                      type:
                        - "string"
                        - "null"
                    look_count:
                      minimum: 0
                      type: "integer"
                    name:
                      type: "string"
                    permissions:
                      items:
                        enum:
                          - "read"
                          - "use"
                      type: "array"
                    preview_url:
                      type:
                        - "string"
                        - "null"
                    primary_voice:
                      type:
                        - "object"
                        - "null"
                    profile:
                      additionalProperties: false
                      description: "What the cover image shows (description and tags) and the prompt that made it; {} until described."
                      properties:
                        age:
                          type: "string"
                        art_style:
                          type: "string"
                        description:
                          type: "string"
                        ethnicity:
                          type: "string"
                        gender:
                          type: "string"
                        realism:
                          type: "string"
                        source_prompt:
                          type: "string"
                        species:
                          type: "string"
                      type: "object"
                    read_only:
                      description: "True when source is shared."
                      type: "boolean"
                    source:
                      enum:
                        - "my"
                        - "library"
                        - "shared"
                    source_agent_id:
                      description: "The owning agent when source is shared."
                      type: "string"
                    talking_character_count:
                      minimum: 0
                      type: "integer"
                    updated_at:
                      type: "string"
                  required:
                    - "character_id"
                    - "character_public_id"
                    - "name"
                    - "profile"
                    - "source"
                    - "is_agent_character"
                    - "cover_url"
                    - "preview_url"
                    - "latest_generated_video_url"
                    - "look_count"
                    - "talking_character_count"
                    - "primary_voice"
                    - "availability"
                    - "default_talking_character"
                    - "updated_at"
                  type: "object"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_characters
      x-mcp-branch: "list"
    post:
      operationId: postCharacters
      x-phase: setup
      summary: "Manage characters, looks, and talking characters — create"
      description: "POST /v1/avatars is the deprecated name of this route. It still works and answers with avatar field names; use this /v1/characters route."
      tags: [Characters]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                agent_id:
                  description: "The agent whose characters these are."
                  type: "integer"
                clone_voice:
                  default: true
                  description: "Videos only. Clones the person's voice from the video into the character's primary voice; this uses credits. Left out, a video that cannot be cloned is still uploaded, without a voice, and voice_clone_message says why. false skips the clone. true refuses a video without audio, with unreadable audio or shorter than 30 seconds (422, param content_resource_id) instead of uploading it without a voice."
                  type: "boolean"
                content_resource_id:
                  description: "An uploaded image or video of a person. An image becomes the character's original look. A video becomes its first talking character, its first frame the first look (the cover), and its audio a cloned voice unless clone_voice is false. Send an Idempotency-Key header to retry safely."
                  type: "integer"
                name:
                  description: "Character name. Defaults to the file name, else \"New character\"."
                  type: "string"
                profile:
                  description: "What the character's cover image shows, read by planners choosing a character: a one-line description, its tags and the prompt that made the image (when it was generated). Sent keys replace saved ones."
                  properties:
                    age:
                      type:
                        - "string"
                        - "null"
                    art_style:
                      type:
                        - "string"
                        - "null"
                    description:
                      type:
                        - "string"
                        - "null"
                    ethnicity:
                      type:
                        - "string"
                        - "null"
                    gender:
                      type:
                        - "string"
                        - "null"
                    realism:
                      type:
                        - "string"
                        - "null"
                    source_prompt:
                      type:
                        - "string"
                        - "null"
                    species:
                      type:
                        - "string"
                        - "null"
                  type: "object"
                voice_gender:
                  default: "female"
                  description: "Gender of the cloned voice."
                  enum:
                    - "male"
                    - "female"
                  type: "string"
                voice_language:
                  default: "english"
                  description: "Language the person speaks in the video, as a lowercase English name (for example english or spanish)."
                  type: "string"
              required:
                - "agent_id"
                - "content_resource_id"
              type: "object"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                additionalProperties: false
                description: "POST /v1/characters (create): the detail plus the look, talking character and voice-clone job it made. A video also gets a cloned voice unless clone_voice is false; voice_id is null until the clone job finishes, after which the voice is the character's primary_voice."
                properties:
                  availability:
                    additionalProperties: false
                    properties:
                      missing:
                        items:
                          enum:
                            - "looks.url"
                            - "primary_voice.voice_id"
                        type: "array"
                      speaking:
                        type: "boolean"
                      visual:
                        type: "boolean"
                    required:
                      - "visual"
                      - "speaking"
                      - "missing"
                    type: "object"
                  character_id:
                    minimum: 1
                    type: "integer"
                  character_public_id:
                    description: "Random public id for URLs; every character endpoint accepts it in place of character_id."
                    pattern: "^[2-9A-HJ-NP-Z]{8}$"
                    type: "string"
                  cover_url:
                    type:
                      - "string"
                      - "null"
                  default_talking_character:
                    additionalProperties: false
                    description: "A ready talking character: url plays it with its voice, latest_generated_video_url is its latest voiced video."
                    properties:
                      aspect_ratio:
                        type:
                          - "string"
                          - "null"
                      character_id:
                        type:
                          - "integer"
                          - "null"
                      duration:
                        type:
                          - "integer"
                          - "null"
                      kind:
                        enum:
                          - "generated"
                          - "uploaded"
                      latest_generated_video_url:
                        type:
                          - "string"
                          - "null"
                      look_id:
                        type:
                          - "integer"
                          - "null"
                      made_from_talking_character_id:
                        type:
                          - "integer"
                          - "null"
                      name:
                        type:
                          - "string"
                          - "null"
                      status:
                        enum:
                          - "ready"
                      talking_character_id:
                        minimum: 1
                        type: "integer"
                      thumbnail_url:
                        type:
                          - "string"
                          - "null"
                      url:
                        type:
                          - "string"
                          - "null"
                    required:
                      - "talking_character_id"
                      - "name"
                      - "kind"
                      - "status"
                      - "url"
                      - "thumbnail_url"
                      - "duration"
                      - "character_id"
                      - "look_id"
                      - "made_from_talking_character_id"
                      - "latest_generated_video_url"
                      - "aspect_ratio"
                    type:
                      - "object"
                      - "null"
                  generating_talking_characters:
                    items:
                      additionalProperties: false
                      description: "A talking character still being generated, before its row exists."
                      properties:
                        look_id:
                          type:
                            - "integer"
                            - "null"
                        status:
                          enum:
                            - "pending"
                            - "processing"
                        user_job_id:
                          minimum: 1
                          type: "integer"
                      required:
                        - "user_job_id"
                        - "look_id"
                        - "status"
                      type: "object"
                    type: "array"
                  is_agent_character:
                    type: "boolean"
                  latest_generated_video_url:
                    type:
                      - "string"
                      - "null"
                  look_count:
                    minimum: 0
                    type: "integer"
                  look_id:
                    type:
                      - "integer"
                      - "null"
                  looks:
                    items:
                      additionalProperties: false
                      description: "An character look with the ready talking characters made from it."
                      properties:
                        content_resource_id:
                          minimum: 1
                          type: "integer"
                        from_agent_core:
                          type: "boolean"
                        look_id:
                          minimum: 1
                          type: "integer"
                        name:
                          type:
                            - "string"
                            - "null"
                        origin:
                          enum:
                            - "original"
                            - "uploaded"
                            - "generated"
                        talking_characters:
                          items:
                            additionalProperties: false
                            description: "A ready talking character: url plays it with its voice, latest_generated_video_url is its latest voiced video."
                            properties:
                              aspect_ratio:
                                type:
                                  - "string"
                                  - "null"
                              character_id:
                                type:
                                  - "integer"
                                  - "null"
                              duration:
                                type:
                                  - "integer"
                                  - "null"
                              kind:
                                enum:
                                  - "generated"
                                  - "uploaded"
                              latest_generated_video_url:
                                type:
                                  - "string"
                                  - "null"
                              look_id:
                                type:
                                  - "integer"
                                  - "null"
                              made_from_talking_character_id:
                                type:
                                  - "integer"
                                  - "null"
                              name:
                                type:
                                  - "string"
                                  - "null"
                              status:
                                enum:
                                  - "ready"
                              talking_character_id:
                                minimum: 1
                                type: "integer"
                              thumbnail_url:
                                type:
                                  - "string"
                                  - "null"
                              url:
                                type:
                                  - "string"
                                  - "null"
                            required:
                              - "talking_character_id"
                              - "name"
                              - "kind"
                              - "status"
                              - "url"
                              - "thumbnail_url"
                              - "duration"
                              - "character_id"
                              - "look_id"
                              - "made_from_talking_character_id"
                              - "latest_generated_video_url"
                              - "aspect_ratio"
                            type: "object"
                          type: "array"
                        thumbnail_url:
                          type:
                            - "string"
                            - "null"
                        url:
                          type:
                            - "string"
                            - "null"
                      required:
                        - "look_id"
                        - "content_resource_id"
                        - "name"
                        - "origin"
                        - "from_agent_core"
                        - "url"
                        - "thumbnail_url"
                        - "talking_characters"
                      type: "object"
                    type: "array"
                  name:
                    type: "string"
                  permissions:
                    items:
                      enum:
                        - "read"
                        - "use"
                    type: "array"
                  preview_url:
                    type:
                      - "string"
                      - "null"
                  primary_voice:
                    type:
                      - "object"
                      - "null"
                  profile:
                    additionalProperties: false
                    description: "What the cover image shows (description and tags) and the prompt that made it; {} until described."
                    properties:
                      age:
                        type: "string"
                      art_style:
                        type: "string"
                      description:
                        type: "string"
                      ethnicity:
                        type: "string"
                      gender:
                        type: "string"
                      realism:
                        type: "string"
                      source_prompt:
                        type: "string"
                      species:
                        type: "string"
                    type: "object"
                  read_only:
                    description: "True when source is shared."
                    type: "boolean"
                  source:
                    enum:
                      - "my"
                      - "library"
                      - "shared"
                  source_agent_id:
                    description: "The owning agent when source is shared."
                    type: "string"
                  talking_character_count:
                    minimum: 0
                    type: "integer"
                  talking_character_id:
                    type:
                      - "integer"
                      - "null"
                  updated_at:
                    type: "string"
                  uploaded_talking_characters:
                    items:
                      additionalProperties: false
                      description: "A ready talking character: url plays it with its voice, latest_generated_video_url is its latest voiced video."
                      properties:
                        aspect_ratio:
                          type:
                            - "string"
                            - "null"
                        character_id:
                          type:
                            - "integer"
                            - "null"
                        duration:
                          type:
                            - "integer"
                            - "null"
                        kind:
                          enum:
                            - "generated"
                            - "uploaded"
                        latest_generated_video_url:
                          type:
                            - "string"
                            - "null"
                        look_id:
                          type:
                            - "integer"
                            - "null"
                        made_from_talking_character_id:
                          type:
                            - "integer"
                            - "null"
                        name:
                          type:
                            - "string"
                            - "null"
                        status:
                          enum:
                            - "ready"
                        talking_character_id:
                          minimum: 1
                          type: "integer"
                        thumbnail_url:
                          type:
                            - "string"
                            - "null"
                        url:
                          type:
                            - "string"
                            - "null"
                      required:
                        - "talking_character_id"
                        - "name"
                        - "kind"
                        - "status"
                        - "url"
                        - "thumbnail_url"
                        - "duration"
                        - "character_id"
                        - "look_id"
                        - "made_from_talking_character_id"
                        - "latest_generated_video_url"
                        - "aspect_ratio"
                      type: "object"
                    type: "array"
                  user_job_ids:
                    items:
                      minimum: 1
                      type: "integer"
                    type: "array"
                  voice_clone_message:
                    type:
                      - "string"
                      - "null"
                  voice_clone_status:
                    enum:
                      - "pending"
                      - "skipped"
                      - "not_requested"
                      - "not_applicable"
                  voice_id:
                    type:
                      - "string"
                      - "null"
                required:
                  - "character_id"
                  - "character_public_id"
                  - "name"
                  - "profile"
                  - "source"
                  - "is_agent_character"
                  - "cover_url"
                  - "preview_url"
                  - "latest_generated_video_url"
                  - "look_count"
                  - "talking_character_count"
                  - "primary_voice"
                  - "availability"
                  - "default_talking_character"
                  - "updated_at"
                  - "looks"
                  - "uploaded_talking_characters"
                  - "generating_talking_characters"
                  - "look_id"
                  - "talking_character_id"
                  - "voice_id"
                  - "user_job_ids"
                  - "voice_clone_status"
                  - "voice_clone_message"
                type: "object"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_characters
      x-mcp-branch: "create"
  /characters/{character_id}/looks:
    post:
      operationId: postCharactersByCharacterIdLooks
      x-phase: setup
      summary: "Manage characters, looks, and talking characters — upload look"
      description: "POST /v1/avatars/{avatar_id}/looks is the deprecated name of this route. It still works and answers with avatar field names; use this /v1/characters route."
      tags: [Characters]
      parameters:
      - name: character_id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                agent_id:
                  description: "The agent whose characters these are."
                  type: "integer"
                content_resource_id:
                  description: "An uploaded image of the person."
                  type: "integer"
                name:
                  description: "Look name."
                  type: "string"
              required:
                - "agent_id"
                - "content_resource_id"
              type: "object"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                additionalProperties: false
                description: "An character look with the ready talking characters made from it."
                properties:
                  content_resource_id:
                    minimum: 1
                    type: "integer"
                  from_agent_core:
                    type: "boolean"
                  look_id:
                    minimum: 1
                    type: "integer"
                  name:
                    type:
                      - "string"
                      - "null"
                  origin:
                    enum:
                      - "original"
                      - "uploaded"
                      - "generated"
                  talking_characters:
                    items:
                      additionalProperties: false
                      description: "A ready talking character: url plays it with its voice, latest_generated_video_url is its latest voiced video."
                      properties:
                        aspect_ratio:
                          type:
                            - "string"
                            - "null"
                        character_id:
                          type:
                            - "integer"
                            - "null"
                        duration:
                          type:
                            - "integer"
                            - "null"
                        kind:
                          enum:
                            - "generated"
                            - "uploaded"
                        latest_generated_video_url:
                          type:
                            - "string"
                            - "null"
                        look_id:
                          type:
                            - "integer"
                            - "null"
                        made_from_talking_character_id:
                          type:
                            - "integer"
                            - "null"
                        name:
                          type:
                            - "string"
                            - "null"
                        status:
                          enum:
                            - "ready"
                        talking_character_id:
                          minimum: 1
                          type: "integer"
                        thumbnail_url:
                          type:
                            - "string"
                            - "null"
                        url:
                          type:
                            - "string"
                            - "null"
                      required:
                        - "talking_character_id"
                        - "name"
                        - "kind"
                        - "status"
                        - "url"
                        - "thumbnail_url"
                        - "duration"
                        - "character_id"
                        - "look_id"
                        - "made_from_talking_character_id"
                        - "latest_generated_video_url"
                        - "aspect_ratio"
                      type: "object"
                    type: "array"
                  thumbnail_url:
                    type:
                      - "string"
                      - "null"
                  url:
                    type:
                      - "string"
                      - "null"
                required:
                  - "look_id"
                  - "content_resource_id"
                  - "name"
                  - "origin"
                  - "from_agent_core"
                  - "url"
                  - "thumbnail_url"
                  - "talking_characters"
                type: "object"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_characters
      x-mcp-branch: "upload_look"
  /characters/{character_id}/talking_characters:
    post:
      operationId: postCharactersByCharacterIdTalkingCharacters
      x-phase: setup
      summary: "Manage characters, looks, and talking characters — upload talking character"
      description: "POST /v1/avatars/{avatar_id}/talking_loops is the deprecated name of this route. It still works and answers with avatar field names; use this /v1/characters route."
      tags: [Characters]
      parameters:
      - name: character_id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                agent_id:
                  description: "The agent whose characters these are."
                  type: "integer"
                clone_voice:
                  default: false
                  description: "Also clones the person's voice from the video; it becomes the character's primary voice once the clone finishes. This uses credits. true refuses a video without audio, with unreadable audio or shorter than 30 seconds (422, param content_resource_id) instead of uploading it without a voice."
                  type: "boolean"
                content_resource_id:
                  description: "An uploaded video of the person speaking."
                  type: "integer"
                name:
                  description: "Talking character name. Defaults to the character's name."
                  type: "string"
                voice_gender:
                  default: "female"
                  description: "Gender of the cloned voice."
                  enum:
                    - "male"
                    - "female"
                  type: "string"
                voice_language:
                  default: "english"
                  description: "Language the person speaks in the video, as a lowercase English name (for example english or spanish)."
                  type: "string"
              required:
                - "agent_id"
                - "content_resource_id"
              type: "object"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                additionalProperties: false
                description: "POST /v1/characters/:character_id/talking_characters (create): the uploaded talking character plus its voice-clone job. With clone_voice true the video's voice is cloned and becomes the character's primary_voice once the job finishes; off by default."
                properties:
                  aspect_ratio:
                    type:
                      - "string"
                      - "null"
                  character_id:
                    type:
                      - "integer"
                      - "null"
                  duration:
                    type:
                      - "integer"
                      - "null"
                  kind:
                    enum:
                      - "generated"
                      - "uploaded"
                  latest_generated_video_url:
                    type:
                      - "string"
                      - "null"
                  look_id:
                    type:
                      - "integer"
                      - "null"
                  made_from_talking_character_id:
                    type:
                      - "integer"
                      - "null"
                  name:
                    type:
                      - "string"
                      - "null"
                  status:
                    enum:
                      - "ready"
                  talking_character_id:
                    minimum: 1
                    type: "integer"
                  thumbnail_url:
                    type:
                      - "string"
                      - "null"
                  url:
                    type:
                      - "string"
                      - "null"
                  user_job_ids:
                    items:
                      minimum: 1
                      type: "integer"
                    type: "array"
                  voice_clone_message:
                    type:
                      - "string"
                      - "null"
                  voice_clone_status:
                    enum:
                      - "pending"
                      - "skipped"
                      - "not_requested"
                      - "not_applicable"
                required:
                  - "talking_character_id"
                  - "name"
                  - "kind"
                  - "status"
                  - "url"
                  - "thumbnail_url"
                  - "duration"
                  - "character_id"
                  - "look_id"
                  - "made_from_talking_character_id"
                  - "latest_generated_video_url"
                  - "aspect_ratio"
                  - "user_job_ids"
                  - "voice_clone_status"
                  - "voice_clone_message"
                type: "object"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_characters
      x-mcp-branch: "upload_talking_character"
  /characters/{character_id}/talking_characters/{id}:
    get:
      operationId: getCharactersByCharacterIdTalkingCharactersById
      x-phase: setup
      summary: "Manage characters, looks, and talking characters — get talking character"
      description: "GET /v1/avatars/{avatar_id}/talking_loops/{id} is the deprecated name of this route. It still works and answers with avatar field names; use this /v1/characters route."
      tags: [Characters]
      parameters:
      - name: character_id
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: "agent_id"
        in: "query"
        required: True
        description: "The agent whose characters these are."
        schema:
          type: "integer"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                additionalProperties: false
                description: "A ready talking character: url plays it with its voice, latest_generated_video_url is its latest voiced video."
                properties:
                  aspect_ratio:
                    type:
                      - "string"
                      - "null"
                  character_id:
                    type:
                      - "integer"
                      - "null"
                  duration:
                    type:
                      - "integer"
                      - "null"
                  kind:
                    enum:
                      - "generated"
                      - "uploaded"
                  latest_generated_video_url:
                    type:
                      - "string"
                      - "null"
                  look_id:
                    type:
                      - "integer"
                      - "null"
                  made_from_talking_character_id:
                    type:
                      - "integer"
                      - "null"
                  name:
                    type:
                      - "string"
                      - "null"
                  status:
                    enum:
                      - "ready"
                  talking_character_id:
                    minimum: 1
                    type: "integer"
                  thumbnail_url:
                    type:
                      - "string"
                      - "null"
                  url:
                    type:
                      - "string"
                      - "null"
                required:
                  - "talking_character_id"
                  - "name"
                  - "kind"
                  - "status"
                  - "url"
                  - "thumbnail_url"
                  - "duration"
                  - "character_id"
                  - "look_id"
                  - "made_from_talking_character_id"
                  - "latest_generated_video_url"
                  - "aspect_ratio"
                type: "object"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_characters
      x-mcp-branch: "get_talking_character"
  /characters/{id}:
    get:
      operationId: getCharactersById
      x-phase: setup
      summary: "Manage characters, looks, and talking characters — get"
      description: "GET /v1/avatars/{id} is the deprecated name of this route. It still works and answers with avatar field names; use this /v1/characters route."
      tags: [Characters]
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: "agent_id"
        in: "query"
        required: True
        description: "The agent whose characters these are."
        schema:
          type: "integer"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                additionalProperties: false
                description: "GET /v1/characters/:id (show): the summary plus looks and talking characters."
                properties:
                  availability:
                    additionalProperties: false
                    properties:
                      missing:
                        items:
                          enum:
                            - "looks.url"
                            - "primary_voice.voice_id"
                        type: "array"
                      speaking:
                        type: "boolean"
                      visual:
                        type: "boolean"
                    required:
                      - "visual"
                      - "speaking"
                      - "missing"
                    type: "object"
                  character_id:
                    minimum: 1
                    type: "integer"
                  character_public_id:
                    description: "Random public id for URLs; every character endpoint accepts it in place of character_id."
                    pattern: "^[2-9A-HJ-NP-Z]{8}$"
                    type: "string"
                  cover_url:
                    type:
                      - "string"
                      - "null"
                  default_talking_character:
                    additionalProperties: false
                    description: "A ready talking character: url plays it with its voice, latest_generated_video_url is its latest voiced video."
                    properties:
                      aspect_ratio:
                        type:
                          - "string"
                          - "null"
                      character_id:
                        type:
                          - "integer"
                          - "null"
                      duration:
                        type:
                          - "integer"
                          - "null"
                      kind:
                        enum:
                          - "generated"
                          - "uploaded"
                      latest_generated_video_url:
                        type:
                          - "string"
                          - "null"
                      look_id:
                        type:
                          - "integer"
                          - "null"
                      made_from_talking_character_id:
                        type:
                          - "integer"
                          - "null"
                      name:
                        type:
                          - "string"
                          - "null"
                      status:
                        enum:
                          - "ready"
                      talking_character_id:
                        minimum: 1
                        type: "integer"
                      thumbnail_url:
                        type:
                          - "string"
                          - "null"
                      url:
                        type:
                          - "string"
                          - "null"
                    required:
                      - "talking_character_id"
                      - "name"
                      - "kind"
                      - "status"
                      - "url"
                      - "thumbnail_url"
                      - "duration"
                      - "character_id"
                      - "look_id"
                      - "made_from_talking_character_id"
                      - "latest_generated_video_url"
                      - "aspect_ratio"
                    type:
                      - "object"
                      - "null"
                  generating_talking_characters:
                    items:
                      additionalProperties: false
                      description: "A talking character still being generated, before its row exists."
                      properties:
                        look_id:
                          type:
                            - "integer"
                            - "null"
                        status:
                          enum:
                            - "pending"
                            - "processing"
                        user_job_id:
                          minimum: 1
                          type: "integer"
                      required:
                        - "user_job_id"
                        - "look_id"
                        - "status"
                      type: "object"
                    type: "array"
                  is_agent_character:
                    type: "boolean"
                  latest_generated_video_url:
                    type:
                      - "string"
                      - "null"
                  look_count:
                    minimum: 0
                    type: "integer"
                  looks:
                    items:
                      additionalProperties: false
                      description: "An character look with the ready talking characters made from it."
                      properties:
                        content_resource_id:
                          minimum: 1
                          type: "integer"
                        from_agent_core:
                          type: "boolean"
                        look_id:
                          minimum: 1
                          type: "integer"
                        name:
                          type:
                            - "string"
                            - "null"
                        origin:
                          enum:
                            - "original"
                            - "uploaded"
                            - "generated"
                        talking_characters:
                          items:
                            additionalProperties: false
                            description: "A ready talking character: url plays it with its voice, latest_generated_video_url is its latest voiced video."
                            properties:
                              aspect_ratio:
                                type:
                                  - "string"
                                  - "null"
                              character_id:
                                type:
                                  - "integer"
                                  - "null"
                              duration:
                                type:
                                  - "integer"
                                  - "null"
                              kind:
                                enum:
                                  - "generated"
                                  - "uploaded"
                              latest_generated_video_url:
                                type:
                                  - "string"
                                  - "null"
                              look_id:
                                type:
                                  - "integer"
                                  - "null"
                              made_from_talking_character_id:
                                type:
                                  - "integer"
                                  - "null"
                              name:
                                type:
                                  - "string"
                                  - "null"
                              status:
                                enum:
                                  - "ready"
                              talking_character_id:
                                minimum: 1
                                type: "integer"
                              thumbnail_url:
                                type:
                                  - "string"
                                  - "null"
                              url:
                                type:
                                  - "string"
                                  - "null"
                            required:
                              - "talking_character_id"
                              - "name"
                              - "kind"
                              - "status"
                              - "url"
                              - "thumbnail_url"
                              - "duration"
                              - "character_id"
                              - "look_id"
                              - "made_from_talking_character_id"
                              - "latest_generated_video_url"
                              - "aspect_ratio"
                            type: "object"
                          type: "array"
                        thumbnail_url:
                          type:
                            - "string"
                            - "null"
                        url:
                          type:
                            - "string"
                            - "null"
                      required:
                        - "look_id"
                        - "content_resource_id"
                        - "name"
                        - "origin"
                        - "from_agent_core"
                        - "url"
                        - "thumbnail_url"
                        - "talking_characters"
                      type: "object"
                    type: "array"
                  name:
                    type: "string"
                  permissions:
                    items:
                      enum:
                        - "read"
                        - "use"
                    type: "array"
                  preview_url:
                    type:
                      - "string"
                      - "null"
                  primary_voice:
                    type:
                      - "object"
                      - "null"
                  profile:
                    additionalProperties: false
                    description: "What the cover image shows (description and tags) and the prompt that made it; {} until described."
                    properties:
                      age:
                        type: "string"
                      art_style:
                        type: "string"
                      description:
                        type: "string"
                      ethnicity:
                        type: "string"
                      gender:
                        type: "string"
                      realism:
                        type: "string"
                      source_prompt:
                        type: "string"
                      species:
                        type: "string"
                    type: "object"
                  read_only:
                    description: "True when source is shared."
                    type: "boolean"
                  source:
                    enum:
                      - "my"
                      - "library"
                      - "shared"
                  source_agent_id:
                    description: "The owning agent when source is shared."
                    type: "string"
                  talking_character_count:
                    minimum: 0
                    type: "integer"
                  updated_at:
                    type: "string"
                  uploaded_talking_characters:
                    items:
                      additionalProperties: false
                      description: "A ready talking character: url plays it with its voice, latest_generated_video_url is its latest voiced video."
                      properties:
                        aspect_ratio:
                          type:
                            - "string"
                            - "null"
                        character_id:
                          type:
                            - "integer"
                            - "null"
                        duration:
                          type:
                            - "integer"
                            - "null"
                        kind:
                          enum:
                            - "generated"
                            - "uploaded"
                        latest_generated_video_url:
                          type:
                            - "string"
                            - "null"
                        look_id:
                          type:
                            - "integer"
                            - "null"
                        made_from_talking_character_id:
                          type:
                            - "integer"
                            - "null"
                        name:
                          type:
                            - "string"
                            - "null"
                        status:
                          enum:
                            - "ready"
                        talking_character_id:
                          minimum: 1
                          type: "integer"
                        thumbnail_url:
                          type:
                            - "string"
                            - "null"
                        url:
                          type:
                            - "string"
                            - "null"
                      required:
                        - "talking_character_id"
                        - "name"
                        - "kind"
                        - "status"
                        - "url"
                        - "thumbnail_url"
                        - "duration"
                        - "character_id"
                        - "look_id"
                        - "made_from_talking_character_id"
                        - "latest_generated_video_url"
                        - "aspect_ratio"
                      type: "object"
                    type: "array"
                required:
                  - "character_id"
                  - "character_public_id"
                  - "name"
                  - "profile"
                  - "source"
                  - "is_agent_character"
                  - "cover_url"
                  - "preview_url"
                  - "latest_generated_video_url"
                  - "look_count"
                  - "talking_character_count"
                  - "primary_voice"
                  - "availability"
                  - "default_talking_character"
                  - "updated_at"
                  - "looks"
                  - "uploaded_talking_characters"
                  - "generating_talking_characters"
                type: "object"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_characters
      x-mcp-branch: "get | get_talking_character"
    patch:
      operationId: patchCharactersById
      x-phase: setup
      summary: "Manage characters, looks, and talking characters — rename"
      description: "PATCH /v1/avatars/{id} is the deprecated name of this route. It still works and answers with avatar field names; use this /v1/characters route."
      tags: [Characters]
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                agent_id:
                  description: "The agent whose characters these are."
                  type: "integer"
                name:
                  description: "Renames the character. Renaming the agent's own character also renames the agent."
                  type: "string"
                primary_voice:
                  description: "Sets the character's primary voice, the voice its talking characters speak with by default: one of the agent's voices or a library voice, as listed by the voices endpoints. null or {} clears it."
                  properties:
                    billing_source:
                      type:
                        - "string"
                        - "integer"
                    id:
                      type:
                        - "string"
                        - "integer"
                    name:
                      type:
                        - "string"
                        - "integer"
                    ownership:
                      type:
                        - "string"
                        - "integer"
                    provider:
                      type:
                        - "string"
                        - "integer"
                    voice_id:
                      type:
                        - "string"
                        - "integer"
                  type:
                    - "object"
                    - "null"
                profile:
                  description: "What the character's cover image shows, read by planners choosing a character: a one-line description, its tags and the prompt that made the image (when it was generated). Sent keys replace saved ones."
                  properties:
                    age:
                      type:
                        - "string"
                        - "null"
                    art_style:
                      type:
                        - "string"
                        - "null"
                    description:
                      type:
                        - "string"
                        - "null"
                    ethnicity:
                      type:
                        - "string"
                        - "null"
                    gender:
                      type:
                        - "string"
                        - "null"
                    realism:
                      type:
                        - "string"
                        - "null"
                    source_prompt:
                      type:
                        - "string"
                        - "null"
                    species:
                      type:
                        - "string"
                        - "null"
                  type: "object"
              required:
                - "agent_id"
              type: "object"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                additionalProperties: false
                description: "GET /v1/characters/:id (show): the summary plus looks and talking characters."
                properties:
                  availability:
                    additionalProperties: false
                    properties:
                      missing:
                        items:
                          enum:
                            - "looks.url"
                            - "primary_voice.voice_id"
                        type: "array"
                      speaking:
                        type: "boolean"
                      visual:
                        type: "boolean"
                    required:
                      - "visual"
                      - "speaking"
                      - "missing"
                    type: "object"
                  character_id:
                    minimum: 1
                    type: "integer"
                  character_public_id:
                    description: "Random public id for URLs; every character endpoint accepts it in place of character_id."
                    pattern: "^[2-9A-HJ-NP-Z]{8}$"
                    type: "string"
                  cover_url:
                    type:
                      - "string"
                      - "null"
                  default_talking_character:
                    additionalProperties: false
                    description: "A ready talking character: url plays it with its voice, latest_generated_video_url is its latest voiced video."
                    properties:
                      aspect_ratio:
                        type:
                          - "string"
                          - "null"
                      character_id:
                        type:
                          - "integer"
                          - "null"
                      duration:
                        type:
                          - "integer"
                          - "null"
                      kind:
                        enum:
                          - "generated"
                          - "uploaded"
                      latest_generated_video_url:
                        type:
                          - "string"
                          - "null"
                      look_id:
                        type:
                          - "integer"
                          - "null"
                      made_from_talking_character_id:
                        type:
                          - "integer"
                          - "null"
                      name:
                        type:
                          - "string"
                          - "null"
                      status:
                        enum:
                          - "ready"
                      talking_character_id:
                        minimum: 1
                        type: "integer"
                      thumbnail_url:
                        type:
                          - "string"
                          - "null"
                      url:
                        type:
                          - "string"
                          - "null"
                    required:
                      - "talking_character_id"
                      - "name"
                      - "kind"
                      - "status"
                      - "url"
                      - "thumbnail_url"
                      - "duration"
                      - "character_id"
                      - "look_id"
                      - "made_from_talking_character_id"
                      - "latest_generated_video_url"
                      - "aspect_ratio"
                    type:
                      - "object"
                      - "null"
                  generating_talking_characters:
                    items:
                      additionalProperties: false
                      description: "A talking character still being generated, before its row exists."
                      properties:
                        look_id:
                          type:
                            - "integer"
                            - "null"
                        status:
                          enum:
                            - "pending"
                            - "processing"
                        user_job_id:
                          minimum: 1
                          type: "integer"
                      required:
                        - "user_job_id"
                        - "look_id"
                        - "status"
                      type: "object"
                    type: "array"
                  is_agent_character:
                    type: "boolean"
                  latest_generated_video_url:
                    type:
                      - "string"
                      - "null"
                  look_count:
                    minimum: 0
                    type: "integer"
                  looks:
                    items:
                      additionalProperties: false
                      description: "An character look with the ready talking characters made from it."
                      properties:
                        content_resource_id:
                          minimum: 1
                          type: "integer"
                        from_agent_core:
                          type: "boolean"
                        look_id:
                          minimum: 1
                          type: "integer"
                        name:
                          type:
                            - "string"
                            - "null"
                        origin:
                          enum:
                            - "original"
                            - "uploaded"
                            - "generated"
                        talking_characters:
                          items:
                            additionalProperties: false
                            description: "A ready talking character: url plays it with its voice, latest_generated_video_url is its latest voiced video."
                            properties:
                              aspect_ratio:
                                type:
                                  - "string"
                                  - "null"
                              character_id:
                                type:
                                  - "integer"
                                  - "null"
                              duration:
                                type:
                                  - "integer"
                                  - "null"
                              kind:
                                enum:
                                  - "generated"
                                  - "uploaded"
                              latest_generated_video_url:
                                type:
                                  - "string"
                                  - "null"
                              look_id:
                                type:
                                  - "integer"
                                  - "null"
                              made_from_talking_character_id:
                                type:
                                  - "integer"
                                  - "null"
                              name:
                                type:
                                  - "string"
                                  - "null"
                              status:
                                enum:
                                  - "ready"
                              talking_character_id:
                                minimum: 1
                                type: "integer"
                              thumbnail_url:
                                type:
                                  - "string"
                                  - "null"
                              url:
                                type:
                                  - "string"
                                  - "null"
                            required:
                              - "talking_character_id"
                              - "name"
                              - "kind"
                              - "status"
                              - "url"
                              - "thumbnail_url"
                              - "duration"
                              - "character_id"
                              - "look_id"
                              - "made_from_talking_character_id"
                              - "latest_generated_video_url"
                              - "aspect_ratio"
                            type: "object"
                          type: "array"
                        thumbnail_url:
                          type:
                            - "string"
                            - "null"
                        url:
                          type:
                            - "string"
                            - "null"
                      required:
                        - "look_id"
                        - "content_resource_id"
                        - "name"
                        - "origin"
                        - "from_agent_core"
                        - "url"
                        - "thumbnail_url"
                        - "talking_characters"
                      type: "object"
                    type: "array"
                  name:
                    type: "string"
                  permissions:
                    items:
                      enum:
                        - "read"
                        - "use"
                    type: "array"
                  preview_url:
                    type:
                      - "string"
                      - "null"
                  primary_voice:
                    type:
                      - "object"
                      - "null"
                  profile:
                    additionalProperties: false
                    description: "What the cover image shows (description and tags) and the prompt that made it; {} until described."
                    properties:
                      age:
                        type: "string"
                      art_style:
                        type: "string"
                      description:
                        type: "string"
                      ethnicity:
                        type: "string"
                      gender:
                        type: "string"
                      realism:
                        type: "string"
                      source_prompt:
                        type: "string"
                      species:
                        type: "string"
                    type: "object"
                  read_only:
                    description: "True when source is shared."
                    type: "boolean"
                  source:
                    enum:
                      - "my"
                      - "library"
                      - "shared"
                  source_agent_id:
                    description: "The owning agent when source is shared."
                    type: "string"
                  talking_character_count:
                    minimum: 0
                    type: "integer"
                  updated_at:
                    type: "string"
                  uploaded_talking_characters:
                    items:
                      additionalProperties: false
                      description: "A ready talking character: url plays it with its voice, latest_generated_video_url is its latest voiced video."
                      properties:
                        aspect_ratio:
                          type:
                            - "string"
                            - "null"
                        character_id:
                          type:
                            - "integer"
                            - "null"
                        duration:
                          type:
                            - "integer"
                            - "null"
                        kind:
                          enum:
                            - "generated"
                            - "uploaded"
                        latest_generated_video_url:
                          type:
                            - "string"
                            - "null"
                        look_id:
                          type:
                            - "integer"
                            - "null"
                        made_from_talking_character_id:
                          type:
                            - "integer"
                            - "null"
                        name:
                          type:
                            - "string"
                            - "null"
                        status:
                          enum:
                            - "ready"
                        talking_character_id:
                          minimum: 1
                          type: "integer"
                        thumbnail_url:
                          type:
                            - "string"
                            - "null"
                        url:
                          type:
                            - "string"
                            - "null"
                      required:
                        - "talking_character_id"
                        - "name"
                        - "kind"
                        - "status"
                        - "url"
                        - "thumbnail_url"
                        - "duration"
                        - "character_id"
                        - "look_id"
                        - "made_from_talking_character_id"
                        - "latest_generated_video_url"
                        - "aspect_ratio"
                      type: "object"
                    type: "array"
                required:
                  - "character_id"
                  - "character_public_id"
                  - "name"
                  - "profile"
                  - "source"
                  - "is_agent_character"
                  - "cover_url"
                  - "preview_url"
                  - "latest_generated_video_url"
                  - "look_count"
                  - "talking_character_count"
                  - "primary_voice"
                  - "availability"
                  - "default_talking_character"
                  - "updated_at"
                  - "looks"
                  - "uploaded_talking_characters"
                  - "generating_talking_characters"
                type: "object"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_characters
      x-mcp-branch: "rename | set_primary_voice"
    delete:
      operationId: deleteCharactersById
      x-phase: setup
      summary: "Manage characters, looks, and talking characters — delete character"
      description: "DELETE /v1/avatars/{id} is the deprecated name of this route. It still works and answers with avatar field names; use this /v1/characters route."
      tags: [Characters]
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: "agent_id"
        in: "query"
        required: True
        description: "The agent whose characters these are."
        schema:
          type: "integer"
      - name: "confirm_token"
        in: "query"
        description: "Confirms a permanent delete. Without it, an API-key request that would delete content is answered 428 with what would be deleted and a confirm_token; send the same request again with that token to delete."
        schema:
          type: "string"
      responses:
        '204':
          description: Success.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_characters
      x-mcp-branch: "delete_character | delete_look | delete_talking_character"
  /characters/{id}/copy:
    post:
      operationId: postCharactersByIdCopy
      x-phase: setup
      summary: "Manage characters, looks, and talking characters — copy to mine"
      description: "POST /v1/avatars/{id}/copy is the deprecated name of this route. It still works and answers with avatar field names; use this /v1/characters route."
      tags: [Characters]
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                agent_id:
                  description: "The agent whose characters these are."
                  type: "integer"
              required:
                - "agent_id"
              type: "object"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                additionalProperties: false
                description: "GET /v1/characters/:id (show): the summary plus looks and talking characters."
                properties:
                  availability:
                    additionalProperties: false
                    properties:
                      missing:
                        items:
                          enum:
                            - "looks.url"
                            - "primary_voice.voice_id"
                        type: "array"
                      speaking:
                        type: "boolean"
                      visual:
                        type: "boolean"
                    required:
                      - "visual"
                      - "speaking"
                      - "missing"
                    type: "object"
                  character_id:
                    minimum: 1
                    type: "integer"
                  character_public_id:
                    description: "Random public id for URLs; every character endpoint accepts it in place of character_id."
                    pattern: "^[2-9A-HJ-NP-Z]{8}$"
                    type: "string"
                  cover_url:
                    type:
                      - "string"
                      - "null"
                  default_talking_character:
                    additionalProperties: false
                    description: "A ready talking character: url plays it with its voice, latest_generated_video_url is its latest voiced video."
                    properties:
                      aspect_ratio:
                        type:
                          - "string"
                          - "null"
                      character_id:
                        type:
                          - "integer"
                          - "null"
                      duration:
                        type:
                          - "integer"
                          - "null"
                      kind:
                        enum:
                          - "generated"
                          - "uploaded"
                      latest_generated_video_url:
                        type:
                          - "string"
                          - "null"
                      look_id:
                        type:
                          - "integer"
                          - "null"
                      made_from_talking_character_id:
                        type:
                          - "integer"
                          - "null"
                      name:
                        type:
                          - "string"
                          - "null"
                      status:
                        enum:
                          - "ready"
                      talking_character_id:
                        minimum: 1
                        type: "integer"
                      thumbnail_url:
                        type:
                          - "string"
                          - "null"
                      url:
                        type:
                          - "string"
                          - "null"
                    required:
                      - "talking_character_id"
                      - "name"
                      - "kind"
                      - "status"
                      - "url"
                      - "thumbnail_url"
                      - "duration"
                      - "character_id"
                      - "look_id"
                      - "made_from_talking_character_id"
                      - "latest_generated_video_url"
                      - "aspect_ratio"
                    type:
                      - "object"
                      - "null"
                  generating_talking_characters:
                    items:
                      additionalProperties: false
                      description: "A talking character still being generated, before its row exists."
                      properties:
                        look_id:
                          type:
                            - "integer"
                            - "null"
                        status:
                          enum:
                            - "pending"
                            - "processing"
                        user_job_id:
                          minimum: 1
                          type: "integer"
                      required:
                        - "user_job_id"
                        - "look_id"
                        - "status"
                      type: "object"
                    type: "array"
                  is_agent_character:
                    type: "boolean"
                  latest_generated_video_url:
                    type:
                      - "string"
                      - "null"
                  look_count:
                    minimum: 0
                    type: "integer"
                  looks:
                    items:
                      additionalProperties: false
                      description: "An character look with the ready talking characters made from it."
                      properties:
                        content_resource_id:
                          minimum: 1
                          type: "integer"
                        from_agent_core:
                          type: "boolean"
                        look_id:
                          minimum: 1
                          type: "integer"
                        name:
                          type:
                            - "string"
                            - "null"
                        origin:
                          enum:
                            - "original"
                            - "uploaded"
                            - "generated"
                        talking_characters:
                          items:
                            additionalProperties: false
                            description: "A ready talking character: url plays it with its voice, latest_generated_video_url is its latest voiced video."
                            properties:
                              aspect_ratio:
                                type:
                                  - "string"
                                  - "null"
                              character_id:
                                type:
                                  - "integer"
                                  - "null"
                              duration:
                                type:
                                  - "integer"
                                  - "null"
                              kind:
                                enum:
                                  - "generated"
                                  - "uploaded"
                              latest_generated_video_url:
                                type:
                                  - "string"
                                  - "null"
                              look_id:
                                type:
                                  - "integer"
                                  - "null"
                              made_from_talking_character_id:
                                type:
                                  - "integer"
                                  - "null"
                              name:
                                type:
                                  - "string"
                                  - "null"
                              status:
                                enum:
                                  - "ready"
                              talking_character_id:
                                minimum: 1
                                type: "integer"
                              thumbnail_url:
                                type:
                                  - "string"
                                  - "null"
                              url:
                                type:
                                  - "string"
                                  - "null"
                            required:
                              - "talking_character_id"
                              - "name"
                              - "kind"
                              - "status"
                              - "url"
                              - "thumbnail_url"
                              - "duration"
                              - "character_id"
                              - "look_id"
                              - "made_from_talking_character_id"
                              - "latest_generated_video_url"
                              - "aspect_ratio"
                            type: "object"
                          type: "array"
                        thumbnail_url:
                          type:
                            - "string"
                            - "null"
                        url:
                          type:
                            - "string"
                            - "null"
                      required:
                        - "look_id"
                        - "content_resource_id"
                        - "name"
                        - "origin"
                        - "from_agent_core"
                        - "url"
                        - "thumbnail_url"
                        - "talking_characters"
                      type: "object"
                    type: "array"
                  name:
                    type: "string"
                  permissions:
                    items:
                      enum:
                        - "read"
                        - "use"
                    type: "array"
                  preview_url:
                    type:
                      - "string"
                      - "null"
                  primary_voice:
                    type:
                      - "object"
                      - "null"
                  profile:
                    additionalProperties: false
                    description: "What the cover image shows (description and tags) and the prompt that made it; {} until described."
                    properties:
                      age:
                        type: "string"
                      art_style:
                        type: "string"
                      description:
                        type: "string"
                      ethnicity:
                        type: "string"
                      gender:
                        type: "string"
                      realism:
                        type: "string"
                      source_prompt:
                        type: "string"
                      species:
                        type: "string"
                    type: "object"
                  read_only:
                    description: "True when source is shared."
                    type: "boolean"
                  source:
                    enum:
                      - "my"
                      - "library"
                      - "shared"
                  source_agent_id:
                    description: "The owning agent when source is shared."
                    type: "string"
                  talking_character_count:
                    minimum: 0
                    type: "integer"
                  updated_at:
                    type: "string"
                  uploaded_talking_characters:
                    items:
                      additionalProperties: false
                      description: "A ready talking character: url plays it with its voice, latest_generated_video_url is its latest voiced video."
                      properties:
                        aspect_ratio:
                          type:
                            - "string"
                            - "null"
                        character_id:
                          type:
                            - "integer"
                            - "null"
                        duration:
                          type:
                            - "integer"
                            - "null"
                        kind:
                          enum:
                            - "generated"
                            - "uploaded"
                        latest_generated_video_url:
                          type:
                            - "string"
                            - "null"
                        look_id:
                          type:
                            - "integer"
                            - "null"
                        made_from_talking_character_id:
                          type:
                            - "integer"
                            - "null"
                        name:
                          type:
                            - "string"
                            - "null"
                        status:
                          enum:
                            - "ready"
                        talking_character_id:
                          minimum: 1
                          type: "integer"
                        thumbnail_url:
                          type:
                            - "string"
                            - "null"
                        url:
                          type:
                            - "string"
                            - "null"
                      required:
                        - "talking_character_id"
                        - "name"
                        - "kind"
                        - "status"
                        - "url"
                        - "thumbnail_url"
                        - "duration"
                        - "character_id"
                        - "look_id"
                        - "made_from_talking_character_id"
                        - "latest_generated_video_url"
                        - "aspect_ratio"
                      type: "object"
                    type: "array"
                required:
                  - "character_id"
                  - "character_public_id"
                  - "name"
                  - "profile"
                  - "source"
                  - "is_agent_character"
                  - "cover_url"
                  - "preview_url"
                  - "latest_generated_video_url"
                  - "look_count"
                  - "talking_character_count"
                  - "primary_voice"
                  - "availability"
                  - "default_talking_character"
                  - "updated_at"
                  - "looks"
                  - "uploaded_talking_characters"
                  - "generating_talking_characters"
                type: "object"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_characters
      x-mcp-branch: "copy_to_mine"
  /content_resources/from_url:
    post:
      operationId: postContentResourcesFromUrl
      x-phase: setup
      summary: "Analyze, upload, import, and delete assets — import asset from url"
      tags: [Content Resources]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              required:
                - "agent_id"
                - "url"
              properties:
                agent_id:
                  type: "string"
                  description: "Agent context; the controller reads params[:agent_id] (`require_agent!`)."
                url:
                  description: "YouTube / TikTok / Instagram URL to download."
                dw_job_id:
                  description: "Present when resuming a download that outlived the previous request."
                video_layer_id: {}
                asset_folder:
                  type: "object"
                  properties:
                    id: {}
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                description: "`app/resources/content_resource_resource.rb`."
                properties:
                  content_resource:
                    type: "object"
                    properties:
                      id: {}
                      url: {}
                      thumbnail_url: {}
                      file_name: {}
                      content_type: {}
                      origin_type: {}
                      origin_owner_type: {}
                      origin_owner_id: {}
                      origin_metadata: {}
                      enrichment: {}
                  project_node:
                    type: "object"
                    properties:
                      id: {}
                  generator:
                    description: "The UserJob or Job that produced this resource, or null."
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_asset_action
      x-mcp-branch: "import_asset_from_url"
  /credit_balance:
    get:
      operationId: getCreditBalance
      x-phase: setup
      summary: "Discover — capabilities"
      tags: [Billing]
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  agent_id: {}
                  organization_id: {}
                  available_credits:
                    type: "number"
                  paid_media_access:
                    type: "boolean"
                  generation_access:
                    description: "`UserJobs::GenerationGate.summary`."
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "agent.capabilities"
  /credit_plans:
    get:
      operationId: getCreditPlans
      x-phase: setup
      summary: "Discover — plans"
      tags: [Billing]
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "array"
                items:
                  type: "object"
                  description: "`app/resources/credit_plan_resource.rb`."
                  properties:
                    id: {}
                    name: {}
                    price: {}
                    total_credits: {}
                    cycle: {}
                    code: {}
                    credit_type: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "billing.plans"
  /credit_transactions:
    get:
      operationId: getCreditTransactions
      x-phase: setup
      summary: "Discover — usage"
      tags: [Billing]
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "array"
                items:
                  type: "object"
                  description: "`app/resources/credit_transaction_resource.rb`."
                  properties:
                    id: {}
                    amount: {}
                    purpose: {}
                    is_incoming: {}
                    start_total_used_credits: {}
                    end_total_used_credits: {}
                    created_at: {}
                    source:
                      description: "{service, tool, request_id}, {type, id}, or null."
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "billing.usage"
  /eleven_labs_job:
    post:
      operationId: postElevenLabsJob
      x-phase: setup
      summary: "Clone, design, preview, and delete voices — preview voice"
      tags: [Agent Voice]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              required:
                - "agent_id"
                - "user_job"
              properties:
                agent_id:
                  type: "string"
                  description: "Agent context; the controller reads params[:agent_id] (`require_agent!`)."
                user_job:
                  type: "object"
                  properties:
                    data: {}
                    container_id: {}
                    container_type: {}
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  user_job_id: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_voice_action
      x-mcp-branch: "preview_voice"
  /generate_voice_description:
    post:
      operationId: postGenerateVoiceDescription
      x-phase: setup
      summary: "Clone, design, preview, and delete voices — generate voice description"
      tags: [Agent Voice]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              required:
                - "agent_id"
                - "gender"
              properties:
                agent_id:
                  type: "string"
                  description: "Agent context; the controller reads params[:agent_id] (`require_agent!`)."
                gender:
                  description: "Required; the controller refuses a blank gender."
                voice_description: {}
                language: {}
                script: {}
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  voice_description: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_voice_action
      x-mcp-branch: "generate_voice_description"
  /generate_voice_sample:
    post:
      operationId: postGenerateVoiceSample
      x-phase: setup
      summary: "Clone, design, preview, and delete voices — generate voice script"
      tags: [Agent Voice]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              required:
                - "agent_id"
              properties:
                agent_id:
                  type: "string"
                  description: "Agent context; the controller reads params[:agent_id] (`require_agent!`)."
                language: {}
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  voice_sample:
                    description: "Generated voice-over script."
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_voice_action
      x-mcp-branch: "generate_voice_script"
  /hume_ai_sample:
    post:
      operationId: postHumeAiSample
      x-phase: setup
      summary: "Clone, design, preview, and delete voices — generate voice samples"
      tags: [Agent Voice]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              required:
                - "agent_id"
                - "text"
              properties:
                agent_id:
                  type: "string"
                  description: "Agent context; the controller reads params[:agent_id] (`require_agent!`)."
                text:
                  description: "Script the sample should speak."
                text_var:
                  description: "Prompt-variable substitutions for `text`."
                description:
                  description: "Style descriptor."
                voice_model_provider:
                  description: "fal.ai voice-design provider; defaults to the platform TTS provider."
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "array"
                items:
                  type: "object"
                  properties:
                    generation_id: {}
                    status:
                      description: "Present when fal.ai queued the samples."
                      enum:
                        - "pending"
                    audio:
                      description: "Base64/URL audio when Hume AI generated it directly."
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_voice_action
      x-mcp-branch: "generate_voice_samples"
  /hume_ai_sample/status:
    get:
      operationId: getHumeAiSampleStatus
      x-phase: setup
      summary: "Discover — sample status"
      tags: [Agent Voice]
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  generation_id: {}
                  status:
                    enum:
                      - "pending"
                      - "completed"
                      - "failed"
                  queue_position:
                    type: "integer"
                  error: {}
                  audio: {}
                  speaker_embedding_url: {}
                  voice_model_provider: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "voice.sample_status"
  /ideas/directions:
    get:
      operationId: getIdeasDirections
      servers:
        - url: https://agent.gen.pro/v1
      x-phase: ideas
      summary: "Discover — directions"
      tags: [Agent Chat]
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                additionalProperties: true
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "content.directions"
  /ideas/generate:
    post:
      operationId: postIdeasGenerate
      servers:
        - url: https://agent.gen.pro/v1
      x-phase: ideas
      summary: "Manage content resources and content ideas — generate ideas"
      tags: [Agent Chat]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                agent_id:
                  type: "string"
                  minLength: 1
                brief:
                  anyOf:
                    - type: "string"
                    - type: "null"
                count:
                  anyOf:
                    - type: "integer"
                      maximum: 50.0
                      minimum: 1.0
                    - type: "null"
                video_type:
                  anyOf:
                    - type: "string"
                    - type: "integer"
                    - type: "null"
                requirements:
                  anyOf:
                    - items:
                        type: "string"
                      type: "array"
                      maxItems: 20
                    - type: "null"
                sheet_rows:
                  items:
                    properties:
                      row_id: {}
                      cells:
                        items:
                          properties:
                            column_title:
                              type: "string"
                              default: ""
                            value:
                          type: "object"
                        type: "array"
                    type: "object"
                  type: "array"
                  maxItems: 1000
                source_content_resource_id:
                  anyOf:
                    - type: "integer"
                    - type: "null"
                attachments:
                  items:
                    properties:
                      signed_id:
                        type: "string"
                        default: ""
                      filename:
                        type: "string"
                        default: "attachment"
                      content_type:
                        type: "string"
                        default: ""
                      byte_size:
                        anyOf:
                          - type: "integer"
                          - type: "null"
                      url:
                        anyOf:
                          - type: "string"
                          - type: "null"
                      thumbnail_url:
                        anyOf:
                          - type: "string"
                          - type: "null"
                      content_resource_id:
                        anyOf:
                          - type: "integer"
                            minimum: 1.0
                          - type: "null"
                      origin_type:
                        anyOf:
                          - type: "string"
                          - type: "null"
                      enrichment:
                        anyOf:
                          - additionalProperties: True
                            type: "object"
                          - type: "null"
                      ref:
                        anyOf:
                          - type: "string"
                          - type: "null"
                      kind:
                        anyOf:
                          - type: "string"
                            enum:
                              - "image"
                              - "video"
                              - "audio"
                              - "document"
                          - type: "null"
                      role:
                        anyOf:
                          - type: "string"
                          - type: "null"
                      note:
                        anyOf:
                          - type: "string"
                          - type: "null"
                      use:
                        anyOf:
                          - type: "string"
                          - type: "null"
                    type: "object"
                  type: "array"
                  maxItems: 10
                prompt:
                  anyOf:
                    - type: "string"
                    - type: "null"
                content_idea:
                  anyOf:
                    - additionalProperties: True
                      type: "object"
                    - type: "null"
                style:
                  anyOf:
                    - additionalProperties: True
                      type: "object"
                    - type: "null"
                content:
                  anyOf:
                    - additionalProperties: True
                      type: "object"
                    - type: "null"
                reference_video:
                  anyOf:
                    - additionalProperties: True
                      type: "object"
                    - type: "null"
                format:
                  anyOf:
                    - additionalProperties: True
                      type: "object"
                    - type: "null"
                cast:
                  anyOf:
                    - items:
                        additionalProperties: true
                        type: "object"
                      type: "array"
                    - type: "null"
                conversation_id:
                  anyOf:
                    - type: "string"
                      format: "uuid"
                    - type: "null"
                conversation_context:
                  anyOf:
                    - type: "string"
                    - type: "null"
                target_duration_seconds:
                  anyOf:
                    - type: "integer"
                      maximum: 180.0
                      minimum: 3.0
                    - type: "null"
                from_ideas:
                  items:
                    type: "string"
                    format: "uuid"
                  type: "array"
                  maxItems: 50
                feedback:
                  anyOf:
                    - type: "string"
                    - type: "null"
                proposal_id:
                  anyOf:
                    - type: "string"
                      format: "uuid"
                    - type: "null"
                confirm:
                  anyOf:
                    - type: "boolean"
                    - type: "null"
                idempotency_key:
                  anyOf:
                    - type: "string"
                      maxLength: 200
                    - type: "null"
              type: "object"
              required:
                - "agent_id"
      responses:
        '200':
          description: Success.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'
      x-mcp-tool: gen_content_action
      x-mcp-branch: "generate_ideas"
      x-schema-status: missing
  /ideas/jobs/{job_id}:
    get:
      operationId: getIdeasJobsByJobId
      servers:
        - url: https://agent.gen.pro/v1
      x-phase: ideas
      summary: "Discover — idea job"
      tags: [Agent Chat]
      parameters:
      - name: job_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  job_id:
                    type: "string"
                  status:
                    type: "string"
                  run_id:
                    type: "string"
                  error:
                    type: "string"
                  ideas:
                    type: "array"
                    items:
                      type: "object"
                      additionalProperties: true
                  idea_id:
                    type: "string"
                  sheet_rows_used:
                    type: "integer"
                  sheet_rows_truncated:
                    type: "boolean"
                required:
                  - "job_id"
                  - "status"
                  - "run_id"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/AgentValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "content.idea_job"
  /ideas/preferences:
    post:
      operationId: postIdeasPreferences
      servers:
        - url: https://agent.gen.pro/v1
      x-phase: ideas
      summary: "Manage content resources and content ideas — set content preference"
      tags: [Agent Chat]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                agent_id:
                  type: "string"
                  maxLength: 200
                  minLength: 1
                conversation_id:
                  anyOf:
                    - type: "string"
                      format: "uuid"
                    - type: "null"
                scope:
                  type: "string"
                  enum:
                    - "long_term"
                    - "session"
                text:
                  type: "string"
                  maxLength: 8000
                  minLength: 1
              additionalProperties: false
              type: "object"
              required:
                - "agent_id"
                - "scope"
                - "text"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                additionalProperties: true
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'
      x-mcp-tool: gen_content_action
      x-mcp-branch: "set_content_preference"
    delete:
      operationId: deleteIdeasPreferences
      servers:
        - url: https://agent.gen.pro/v1
      x-phase: ideas
      summary: "Manage content resources and content ideas — remove content preference"
      tags: [Agent Chat]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                agent_id:
                  type: "string"
                  maxLength: 200
                  minLength: 1
                conversation_id:
                  anyOf:
                    - type: "string"
                      format: "uuid"
                    - type: "null"
                scope:
                  type: "string"
                  enum:
                    - "long_term"
                    - "session"
                text:
                  type: "string"
                  maxLength: 8000
                  minLength: 1
              additionalProperties: false
              type: "object"
              required:
                - "agent_id"
                - "scope"
                - "text"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                additionalProperties: true
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/AgentValidationError'
      x-mcp-tool: gen_content_action
      x-mcp-branch: "remove_content_preference"
  /ideas/recreate:
    post:
      operationId: postIdeasRecreate
      x-phase: ideas
      summary: "Manage content resources and content ideas — recreate video"
      tags: [Agent Chat]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                agent_id:
                  type: "string"
                  minLength: 1
                content_resource_id:
                  anyOf:
                    - type: "integer"
                      minimum: 1.0
                    - type: "null"
                video_url:
                  anyOf:
                    - type: "string"
                    - type: "null"
                idempotency_key:
                  anyOf:
                    - type: "string"
                      maxLength: 200
                    - type: "null"
              type: "object"
              required:
                - "agent_id"
      responses:
        '200':
          description: Success.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_content_action
      x-mcp-branch: "recreate_video"
      x-schema-status: missing
  /ideas/reimagine:
    post:
      operationId: postIdeasReimagine
      x-phase: ideas
      summary: "Manage content resources and content ideas — reimagine video"
      tags: [Agent Chat]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                agent_id:
                  type: "string"
                  minLength: 1
                content_resource_id:
                  anyOf:
                    - type: "integer"
                      minimum: 1.0
                    - type: "null"
                video_url:
                  anyOf:
                    - type: "string"
                    - type: "null"
                idempotency_key:
                  anyOf:
                    - type: "string"
                      maxLength: 200
                    - type: "null"
                idea_id:
                  anyOf:
                    - type: "string"
                      format: "uuid"
                    - type: "null"
                count:
                  type: "integer"
                  maximum: 5.0
                  minimum: 1.0
                  default: 3
                direction:
                  type: "string"
                  default: ""
              type: "object"
              required:
                - "agent_id"
      responses:
        '200':
          description: Success.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_content_action
      x-mcp-branch: "reimagine_video"
      x-schema-status: missing
  /ideas/{idea_id}/create-video:
    post:
      operationId: postIdeasByIdeaIdCreateVideo
      servers:
        - url: https://agent.gen.pro/v1
      x-phase: ideas
      summary: "Manage content resources and content ideas — create video from idea"
      tags: [Agent Chat]
      parameters:
      - name: idea_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/AgentValidationError'
      x-mcp-tool: gen_content_action
      x-mcp-branch: "create_video_from_idea"
      x-schema-status: missing
  /organizations/{organization_id}/user_organizations:
    get:
      operationId: getOrganizationsByOrganizationIdUserOrganizations
      x-phase: setup
      summary: "Discover — members"
      tags: [Organizations]
      parameters:
      - name: organization_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "array"
                items:
                  type: "object"
                  properties:
                    id: {}
                    email: {}
                    name: {}
                    organization_role: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "platform.members"
    post:
      operationId: postOrganizationsByOrganizationIdUserOrganizations
      x-phase: setup
      summary: "Manage workspaces, API keys, preferences, and backups — invite member"
      tags: [Organizations]
      parameters:
      - name: organization_id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              required:
                - "username_or_email"
              properties:
                username_or_email:
                  description: "Email or username of the member to invite."
                role:
                  description: "One of the `UserOrganization` roles."
      responses:
        '200':
          description: Success.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_platform_action
      x-mcp-branch: "invite_member"
  /organizations/{organization_id}/user_organizations/{id}:
    delete:
      operationId: deleteOrganizationsByOrganizationIdUserOrganizationsById
      x-phase: setup
      summary: "Manage workspaces, API keys, preferences, and backups — leave workspace"
      tags: [Organizations]
      parameters:
      - name: organization_id
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_platform_action
      x-mcp-branch: "leave_workspace"
  /payment:
    post:
      operationId: postPayment
      x-phase: setup
      summary: "Buy credits and manage credit purchases — buy credits"
      tags: [Billing]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              required:
                - "credit_plan_id"
                - "success_url"
                - "cancel_url"
              properties:
                credit_plan_id:
                  description: "Credit plan being purchased."
                organization_id:
                  description: "Workspace paying; omit for a blind (new-workspace) payment."
                quantity:
                  description: "Seat quantity; defaults to 1."
                  type: "integer"
                success_url:
                  type: "string"
                cancel_url:
                  type: "string"
                social_account_identifier:
                  description: "Required for AURA one-time purchases."
                with_trial:
                  type: "boolean"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                required:
                  - "payment_link"
                properties:
                  payment_link:
                    description: "Stripe Checkout URL."
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_billing_action
      x-mcp-branch: "buy_credits"
  /platform/disconnect/{platform}:
    put:
      operationId: putPlatformDisconnectByPlatform
      servers:
        - url: https://python.gen.pro
      x-phase: export
      summary: "Schedule, publish, or remove posts — disconnect social"
      tags: [Publishing]
      parameters:
      - name: platform
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              properties:
                agent_id:
                  type: "string"
              required:
                - "agent_id"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  message:
                    type: "string"
                required:
                  - "message"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/PythonValidationError'
      x-mcp-tool: gen_publish_action
      x-mcp-branch: "disconnect_social"
  /platform/get_authorization_url:
    post:
      operationId: postPlatformGetAuthorizationUrl
      servers:
        - url: https://python.gen.pro
      x-phase: export
      summary: "Discover — connect url"
      tags: [Publishing]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              properties:
                agent_id:
                  type: "string"
              required:
                - "agent_id"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  url:
                    type:
                      - "string"
                      - "null"
                required:
                  - "url"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/PythonValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "publish.connect_url"
  /platform/get_oauth_account:
    post:
      operationId: postPlatformGetOauthAccount
      servers:
        - url: https://python.gen.pro
      x-phase: export
      summary: "Analyze social trends, comments, hooks, and creators — web asset scrape"
      tags: [Publishing]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              properties:
                agent_id:
                  type: "string"
              required:
                - "agent_id"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  ig_token:
                    type:
                      - "string"
                      - "null"
                  ig_id:
                    type:
                      - "string"
                      - "null"
                  ig_expire_at:
                    type:
                      - "string"
                      - "null"
                    format: "date-time"
                  ig_username:
                    type:
                      - "string"
                      - "null"
                  facebook_token:
                    type:
                      - "string"
                      - "null"
                  facebook_page_id:
                    type:
                      - "string"
                      - "null"
                  facebook_username:
                    type:
                      - "string"
                      - "null"
                  tiktok_token:
                    type:
                      - "string"
                      - "null"
                  tiktok_expire_at:
                    type:
                      - "string"
                      - "null"
                    format: "date-time"
                  tiktok_refresh_token:
                    type:
                      - "string"
                      - "null"
                  tiktok_refresh_expire_at:
                    type:
                      - "string"
                      - "null"
                    format: "date-time"
                  tiktok_username:
                    type:
                      - "string"
                      - "null"
                  x_token:
                    type:
                      - "string"
                      - "null"
                  x_refresh_token:
                    type:
                      - "string"
                      - "null"
                  x_expire_at:
                    type:
                      - "string"
                      - "null"
                    format: "date-time"
                  x_username:
                    type:
                      - "string"
                      - "null"
                  user_id:
                    type:
                      - "integer"
                      - "null"
                  youtube_token:
                    type:
                      - "string"
                      - "null"
                  youtube_expire_at:
                    type:
                      - "string"
                      - "null"
                    format: "date-time"
                  youtube_refresh_token:
                    type:
                      - "string"
                      - "null"
                  youtube_refresh_expire_at:
                    type:
                      - "string"
                      - "null"
                    format: "date-time"
                  youtube_username:
                    type:
                      - "string"
                      - "null"
                  linkedin_token:
                    type:
                      - "string"
                      - "null"
                  linkedin_expire_at:
                    type:
                      - "string"
                      - "null"
                    format: "date-time"
                  linkedin_id:
                    type:
                      - "string"
                      - "null"
                  linkedin_username:
                    type:
                      - "string"
                      - "null"
                  created_at:
                    type: "string"
                    format: "date-time"
                required:
                  - "created_at"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/PythonValidationError'
      x-mcp-tool: gen_analyze
      x-mcp-branch: "web_asset_scrape"
  /projects/{id}/set_project_share:
    put:
      operationId: putProjectsByIdSetProjectShare
      x-phase: setup
      summary: "Create, update, or remove assistants and their profiles — set project share"
      tags: [Organizations]
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              required:
                - "permission"
              properties:
                permission:
                  description: "`public` mints/reuses a share token; `private` removes all shares."
                  enum:
                    - "public"
                    - "private"
                agent_id:
                  type: "string"
                  description: "Agent context; the controller reads params[:agent_id] (`require_agent!`)."
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                description: "`ProjectShareResource` for `public`; `{message}` for `private`."
                properties:
                  share_token: {}
                  permission: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_agent_action
      x-mcp-branch: "set_project_share"
  /recommended_sounds:
    get:
      operationId: getRecommendedSounds
      x-phase: ideas
      summary: "Discover — recommended sounds"
      tags: [Song Mixes]
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  data:
                    type: "array"
                    items:
                      type: "object"
                      description: "`DataWarehouse::RecommendedSoundResource`."
                      properties:
                        id: {}
                        sound_title: {}
                        sound_author: {}
                        sound_url: {}
                        sound_thumbnail_url: {}
                        sound_tags: {}
                        genre: {}
                        mood: {}
                        keywords: {}
                        energy_level: {}
                        instrumentation: {}
                        duration_seconds: {}
                        tempo_bpm: {}
                        latest_videos:
                          type: "array"
                          items: {}
                        video_count:
                          type: "integer"
                  meta:
                    type: "object"
                    properties:
                      window_days:
                        type: "integer"
                      search_type: {}
                      dw_audio_ids:
                        type: "array"
                        items: {}
                      dw_error: {}
                      fallback_used:
                        type: "boolean"
                      degraded:
                        type: "boolean"
                      degraded_reason: {}
                      local_only:
                        type: "boolean"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "media.recommended_sounds"
  /seat_checkout:
    post:
      operationId: postSeatCheckout
      x-phase: setup
      summary: "Manage workspaces, API keys, preferences, and backups — start seat checkout"
      tags: [Billing]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              required:
                - "return_url"
              properties:
                return_url:
                  type: "string"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  status: {}
                  payment_url: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_platform_action
      x-mcp-branch: "start_seat_checkout"
  /sound_libraries:
    get:
      operationId: getSoundLibraries
      x-phase: ideas
      summary: "Discover — sound library"
      tags: [Song Mixes]
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "array"
                items:
                  type: "object"
                  properties:
                    sound_id: {}
                    title: {}
                    sound_url: {}
                    author: {}
                    tags: {}
                    thumbnail_url: {}
                    video_count: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "media.sound_library"
  /subscription_upgrade:
    post:
      operationId: postSubscriptionUpgrade
      x-phase: setup
      summary: "Manage workspaces, API keys, preferences, and backups — upgrade workspace"
      tags: [Billing]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              required:
                - "return_url"
              properties:
                credit_plan_id: {}
                return_url: {}
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  status: {}
                  payment_url: {}
                  credit_plan:
                    type: "object"
                    description: "`app/resources/credit_plan_resource.rb`."
                    properties:
                      id: {}
                      name: {}
                      price: {}
                      total_credits: {}
                      cycle: {}
                      code: {}
                      credit_type: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_platform_action
      x-mcp-branch: "upgrade_workspace"
  /user_jobs/estimate:
    post:
      operationId: postUserJobsEstimate
      x-phase: setup
      summary: "Create, update, or remove assistants and their profiles — create look"
      tags: [Generations]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "One job (`user_job`) or a batch (`user_jobs`)."
              required:
                - "user_job"
              properties:
                agent_id:
                  type: "string"
                  description: "Agent context; the controller reads params[:agent_id] (`require_agent!`)."
                user_job:
                  description: "One job descriptor: `{user_job_type, data}`."
                user_jobs:
                  description: "Batch form: array of the same descriptor (max `MAX_ESTIMATE_USER_JOBS`)."
                  type: "array"
                  items: {}
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  estimate_id: {}
                  estimate_request_key: {}
                  estimated_credits: {}
                  status: {}
                  items:
                    type: "array"
                    items: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_agent_action
      x-mcp-branch: "create_look"
  /user_shared_agents:
    post:
      operationId: postUserSharedAgents
      x-phase: setup
      summary: "Create, update, or remove assistants and their profiles — share agent"
      tags: [Agents]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              required:
                - "user_shared_agent"
              properties:
                user_shared_agent:
                  type: "object"
                  properties:
                    agent_id: {}
                    username_or_email: {}
                    role: {}
      responses:
        '200':
          description: Success.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_agent_action
      x-mcp-branch: "share_agent"
  /user_shared_agents/{id}:
    get:
      operationId: getUserSharedAgentsById
      x-phase: setup
      summary: "Create, update, or remove assistants and their profiles — revoke agent share"
      tags: [Agents]
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  id: {}
                  name: {}
                  time_zone: {}
                  shared_users:
                    type: "array"
                    items:
                      type: "object"
                      properties:
                        id: {}
                        name: {}
                        email: {}
                        role: {}
                        shared_agent_id: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_agent_action
      x-mcp-branch: "revoke_agent_share"
    put:
      operationId: putUserSharedAgentsById
      x-phase: setup
      summary: "Create, update, or remove assistants and their profiles — set agent share role"
      tags: [Agents]
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              required:
                - "user_shared_agent"
              properties:
                user_shared_agent:
                  type: "object"
                  properties:
                    username_or_email: {}
                    role: {}
      responses:
        '200':
          description: Success.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_agent_action
      x-mcp-branch: "set_agent_share_role"
    delete:
      operationId: deleteUserSharedAgentsById
      x-phase: setup
      summary: "Create, update, or remove assistants and their profiles — revoke agent share"
      tags: [Agents]
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_agent_action
      x-mcp-branch: "revoke_agent_share"
  /user_voice_resources:
    get:
      operationId: getUserVoiceResources
      x-phase: setup
      summary: "Discover — list"
      tags: [Agent Voice]
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "array"
                items:
                  type: "object"
                  description: "`app/resources/user_voice_resource_resource.rb`."
                  properties:
                    id: {}
                    name: {}
                    gender: {}
                    language: {}
                    description: {}
                    provider: {}
                    status: {}
                    user_job_id: {}
                    failed_reason: {}
                    file:
                      description: "CDN URL of the attached sample file, or null."
                      type:
                        - "string"
                        - "null"
                    user_voice_resource_id:
                      description: "Backward-compatible alias of `id`."
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "voice.list"
    post:
      operationId: postUserVoiceResources
      x-phase: setup
      summary: "Clone, design, preview, and delete voices — clone voice"
      tags: [Agent Voice]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              required:
                - "agent_id"
                - "user_voice_resource"
              properties:
                agent_id:
                  type: "string"
                  description: "Agent context; the controller reads params[:agent_id] (`require_agent!`)."
                user_voice_resource:
                  type: "object"
                  required:
                    - "name"
                  properties:
                    generation_id: {}
                    name: {}
                    gender: {}
                    language: {}
                    base64_audio: {}
                    audio_url: {}
                    description: {}
                    speaker_embedding_url: {}
                    provider: {}
                    voice_model_provider: {}
                    qwen3_voice_design: {}
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                description: "`app/resources/user_voice_resource_resource.rb`."
                properties:
                  id: {}
                  name: {}
                  gender: {}
                  language: {}
                  description: {}
                  provider: {}
                  status: {}
                  user_job_id: {}
                  failed_reason: {}
                  file:
                    description: "CDN URL of the attached sample file, or null."
                    type:
                      - "string"
                      - "null"
                  user_voice_resource_id:
                    description: "Backward-compatible alias of `id`."
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_voice_action
      x-mcp-branch: "clone_voice"
  /user_voice_resources/{voice_id}:
    get:
      operationId: getUserVoiceResourcesByVoiceId
      x-phase: setup
      summary: "Discover — resource"
      tags: [Agent Voice]
      parameters:
      - name: voice_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                description: "`app/resources/user_voice_resource_resource.rb`."
                properties:
                  id: {}
                  name: {}
                  gender: {}
                  language: {}
                  description: {}
                  provider: {}
                  status: {}
                  user_job_id: {}
                  failed_reason: {}
                  file:
                    description: "CDN URL of the attached sample file, or null."
                    type:
                      - "string"
                      - "null"
                  user_voice_resource_id:
                    description: "Backward-compatible alias of `id`."
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "voice.resource"
    delete:
      operationId: deleteUserVoiceResourcesByVoiceId
      x-phase: setup
      summary: "Clone, design, preview, and delete voices — delete voice"
      tags: [Agent Voice]
      parameters:
      - name: voice_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_voice_action
      x-mcp-branch: "delete_voice"
  /video_recreate_job:
    post:
      operationId: postVideoRecreateJob
      x-phase: setup
      summary: "Vidsheet action — <flat ops>"
      tags: [Discovery]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              required:
                - "agent_id"
                - "user_job"
              properties:
                agent_id:
                  type: "string"
                  description: "Agent context; the controller reads params[:agent_id] (`require_agent!`)."
                user_job:
                  type: "object"
                  properties:
                    data:
                      description: "JSON object (`JSON.parse`d by the controller)."
                    project_id: {}
                    container_id: {}
                    container_type: {}
                    project_node_ids:
                      type: "array"
                      items: {}
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  user_job_id: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "<flat ops>"
  /vidsheet/actions:
    post:
      operationId: postVidsheetActions
      x-phase: convert
      summary: "Vidsheet action — <flat ops>"
      tags: [Sheets]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              required:
                - "agent_id"
                - "actions"
              properties:
                agent_id:
                  oneOf:
                    - type: "integer"
                      minimum: 1
                    - type: "string"
                      pattern: "^[A-Za-z0-9_-]+$"
                      minLength: 1
                      maxLength: 128
                  description: "The agent that owns the video workspace."
                change_set_id:
                  type: "string"
                  format: "uuid"
                  description: "An optional stable edit-group identifier for undo and retry."
                auto_regenerate:
                  type: "boolean"
                  default: true
                  description: "Whether the batch runs the automatic dependent-regeneration walk after its writes. False performs the writes and dispatches no dependent jobs; omitted keeps the current behaviour."
                no_paid:
                  type: "boolean"
                  default: false
                  description: "Refuse paid media generation for this run. Text and LLM work still bills normally."
                max_paid_operations:
                  type: "integer"
                  minimum: 0
                  maximum: 2147483647
                  description: "Maximum paid media reservations across all workspaces in this authenticated user/run, enforced atomically. Retries reuse their reservation."
                spending_run_id:
                  type: "string"
                  pattern: "^[A-Za-z0-9_-]{1,128}$"
                  minLength: 1
                  maxLength: 128
                  description: "Stable run or conversation identity required with spending controls. The authenticated run owner shares one policy across workspaces."
                actions:
                  type: "array"
                  description: "One action, or a compatible batch. Updates, generations (at most 50), variable creates and a video-scene edit group batch as before. A mix of create, update, reorder, duplicate and delete actions applies in array order, so a later action sees the records earlier actions created and may address them by ref; editing a record an earlier action deleted is refused, and deleting a record a create made earlier in the same batch is refused."
                  minItems: 1
                  maxItems: 200
                  items:
                    type: "object"
      responses:
        '200':
          description: Action result envelope
          content:
            application/json:
              schema:
                type: "object"
                description: "Every success, pending, confirmation, payment, and error envelope returned by the Rails video-action endpoint."
                anyOf:
                  - type: "object"
                    properties:
                      results:
                        type: "array"
                        description: "Results in the same order as the submitted actions."
                        items:
                          type: "object"
                          properties:
                            index:
                              type: "integer"
                              minimum: 0
                              description: "The zero-based action index."
                            result:
                              type: "object"
                              description: "The persisted edit resource, generation job, delete preview result, or undo summary."
                              properties:
                                user_job_id:
                                  oneOf:
                                    - type: "integer"
                                      minimum: 1
                                    - type: "string"
                                      pattern: "^[A-Za-z0-9_-]+$"
                                      minLength: 1
                                      maxLength: 128
                                  description: "A persisted Rails resource identifier."
                                status:
                                  type: "string"
                                  description: "The current edit or asynchronous job status."
                                container_type:
                                  type:
                                    - "string"
                                    - "null"
                                  description: "The Rails owner type for a generated take."
                                container_id:
                                  oneOf:
                                    - type: "integer"
                                      minimum: 1
                                    - type: "string"
                                      pattern: "^[A-Za-z0-9_-]+$"
                                      minLength: 1
                                      maxLength: 128
                                  description: "The cell or layer that owns the generated take."
                                card_type:
                                  type: "string"
                                  description: "The generation card that created the job."
                                reference_mapping:
                                  type: "object"
                                  description: "Provider attachment order grouped by creation-card field; prompt mentions use these stable labels."
                                  additionalProperties:
                                    type: "array"
                                    items:
                                      type: "object"
                                      properties:
                                        position:
                                          type: "integer"
                                          minimum: 1
                                        label:
                                          type: "string"
                                          pattern: "^(Image|Video|Audio) [1-9][0-9]*$"
                                        media_type:
                                          enum:
                                            - "image"
                                            - "video"
                                            - "audio"
                                        source:
                                          type: "object"
                                          properties:
                                            type:
                                              enum:
                                                - "content_resource"
                                                - "local_variable"
                                                - "global_variable"
                                                - "video_layer"
                                                - "final_video"
                                                - "audio_library"
                                            id:
                                              oneOf:
                                                - type: "integer"
                                                  minimum: 1
                                                - type: "string"
                                                  minLength: 1
                                          required:
                                            - "type"
                                            - "id"
                                          additionalProperties: false
                                      required:
                                        - "position"
                                        - "label"
                                        - "media_type"
                                        - "source"
                                      additionalProperties: false
                                project_id:
                                  oneOf:
                                    - type: "integer"
                                      minimum: 1
                                    - type: "string"
                                      pattern: "^[A-Za-z0-9_-]+$"
                                      minLength: 1
                                      maxLength: 128
                                  description: "A persisted Rails resource identifier."
                                filename:
                                  type: "string"
                                  description: "The safe CSV download filename."
                                content_type:
                                  const: "text/csv"
                                  description: "The exported file media type."
                                csv:
                                  type: "string"
                                  description: "RFC 4180-compatible Vidsheet grid content."
                                csv_chars:
                                  type: "integer"
                                  minimum: 0
                                  description: "The complete CSV character count."
                                row_count:
                                  type: "integer"
                                  minimum: 0
                                  description: "The number of rows included in the CSV."
                                column_count:
                                  type: "integer"
                                  minimum: 0
                                  description: "The number of Vidsheet columns included in the CSV."
                                uuid:
                                  type:
                                    - "string"
                                    - "null"
                                  format: "uuid"
                                  description: "The stable UUID of a created or duplicated Vidsheet; non-null in create and duplicate receipts."
                                agent_id:
                                  oneOf:
                                    - type: "integer"
                                      minimum: 1
                                    - type: "string"
                                      pattern: "^[A-Za-z0-9_-]+$"
                                      minLength: 1
                                      maxLength: 128
                                  description: "The agent that owns the created or duplicated Vidsheet."
                                spreadsheet_id:
                                  oneOf:
                                    - type: "integer"
                                      minimum: 1
                                    - type: "string"
                                      pattern: "^[A-Za-z0-9_-]+$"
                                      minLength: 1
                                      maxLength: 128
                                  description: "The persisted numeric Vidsheet identifier."
                                vidsheet_project_id:
                                  type: "string"
                                  format: "uuid"
                                  description: "The UUID used by the canonical editable Vidsheet route."
                                vidsheet_url:
                                  type: "string"
                                  format: "uri"
                                  description: "The canonical editable video-workspace URL."
                                deleted:
                                  type: "boolean"
                                  description: "Whether the requested resource was deleted."
                                column_id:
                                  oneOf:
                                    - type: "integer"
                                      minimum: 1
                                    - type: "string"
                                      pattern: "^[A-Za-z0-9_-]+$"
                                      minLength: 1
                                      maxLength: 128
                                  description: "A persisted Rails resource identifier."
                                total_estimated_credits:
                                  type: "number"
                                  minimum: 0
                                  description: "The summed pre-dispatch credit estimate for a column generate."
                                rows:
                                  type: "array"
                                  description: "The per-row dispatch ledger of a column generate."
                                  items:
                                    type: "object"
                                    properties:
                                      row_id:
                                        oneOf:
                                          - type: "integer"
                                            minimum: 1
                                          - type: "string"
                                            pattern: "^[A-Za-z0-9_-]+$"
                                            minLength: 1
                                            maxLength: 128
                                        description: "A persisted Rails resource identifier."
                                      cell_id:
                                        type:
                                          - "integer"
                                          - "null"
                                        minimum: 1
                                        description: "The row's cell in the generated column; null when the row has no cell in it."
                                      status:
                                        enum:
                                          - "dispatched"
                                          - "would_dispatch"
                                          - "failed"
                                          - "skipped"
                                        description: "Whether this row dispatched a job, would dispatch it on a preview, was refused, or held no card to run."
                                      user_job_id:
                                        oneOf:
                                          - type: "integer"
                                            minimum: 1
                                          - type: "string"
                                            pattern: "^[A-Za-z0-9_-]+$"
                                            minLength: 1
                                            maxLength: 128
                                        description: "A persisted Rails resource identifier."
                                      error:
                                        type: "string"
                                        description: "Why this row did not dispatch."
                                    required:
                                      - "row_id"
                                      - "status"
                                    additionalProperties: false
                              additionalProperties: true
                          required:
                            - "index"
                            - "result"
                          additionalProperties: false
                      change_set_id:
                        type:
                          - "string"
                          - "null"
                        format: "uuid"
                        description: "The undoable edit group, when the actions changed stored video data."
                      refs:
                        type: "object"
                        description: "The persisted id of every record a create named with a ref."
                        additionalProperties:
                          oneOf:
                            - type: "integer"
                              minimum: 1
                            - type: "string"
                              pattern: "^[A-Za-z0-9_-]+$"
                              minLength: 1
                              maxLength: 128
                      auto_regeneration:
                        description: "One entry per dependent the batch examined, the string \"skipped\" when the caller sent auto_regenerate false, and absent when no dependent was examined."
                        oneOf:
                          - const: "skipped"
                          - type: "array"
                            items:
                              type: "object"
                              properties:
                                dependent_cell_id:
                                  oneOf:
                                    - type: "integer"
                                      minimum: 1
                                    - type: "string"
                                      pattern: "^[A-Za-z0-9_-]+$"
                                      minLength: 1
                                      maxLength: 128
                                  description: "A persisted Rails resource identifier."
                                source_cell_id:
                                  oneOf:
                                    - type: "integer"
                                      minimum: 1
                                    - type: "string"
                                      pattern: "^[A-Za-z0-9_-]+$"
                                      minLength: 1
                                      maxLength: 128
                                  description: "A persisted Rails resource identifier."
                                status:
                                  type: "string"
                                  description: "The regeneration outcome for this dependent."
                                user_job_id:
                                  type:
                                    - "integer"
                                    - "string"
                                    - "null"
                                  description: "The dispatched or replayed job, when one exists."
                                error:
                                  type:
                                    - "string"
                                    - "null"
                                  description: "Why this dependent was not regenerated."
                              required:
                                - "dependent_cell_id"
                                - "source_cell_id"
                                - "status"
                              additionalProperties: false
                      contract_version:
                        type: "string"
                        pattern: "^[0-9a-f]{64}$"
                        description: "The exact Rails video-action contract revision."
                    required:
                      - "results"
                      - "change_set_id"
                      - "contract_version"
                    additionalProperties: False
                    description: "A successful video-editing action response."
                  - type: "object"
                    properties:
                      status:
                        enum:
                          - "queued"
                          - "generating"
                        description: "The prerequisite or source is not ready yet."
                      error_code:
                        enum:
                          - "source_not_ready"
                          - "generation_pending"
                        description: "The machine-readable pending reason."
                      retryable:
                        const: true
                        description: "Retry the identical request and idempotency key."
                      retry_after_seconds:
                        type: "integer"
                        minimum: 0
                        description: "Minimum retry delay."
                      message:
                        type: "string"
                        description: "Human-readable pending detail."
                      job_ids:
                        type: "array"
                        description: "The running prerequisite jobs a generation_pending caller follows or resumes; absent on a source wait and on a preview."
                        items:
                          oneOf:
                            - type: "integer"
                              minimum: 1
                            - type: "string"
                              pattern: "^[A-Za-z0-9_-]+$"
                              minLength: 1
                              maxLength: 128
                          description: "A persisted Rails resource identifier."
                      dispatched_job_ids:
                        type: "array"
                        description: "Final jobs earlier actions of the same generate batch already dispatched; present only when there are any, including when the pending action is a preview."
                        items:
                          oneOf:
                            - type: "integer"
                              minimum: 1
                            - type: "string"
                              pattern: "^[A-Za-z0-9_-]+$"
                              minLength: 1
                              maxLength: 128
                          description: "A persisted Rails resource identifier."
                    required:
                      - "status"
                      - "error_code"
                      - "retryable"
                      - "message"
                    additionalProperties: False
                    description: "An accepted generation that needs an identical retry."
                  - type: "object"
                    properties:
                      error:
                        type: "string"
                        description: "Human-readable confirmation instructions."
                      error_code:
                        const: "confirmation_required"
                        description: "The destructive action needs explicit confirmation."
                      operation:
                        type: "string"
                        description: "The destructive operation being confirmed."
                      would_destroy:
                        type: "object"
                        description: "The authoritative Rails preview bound to the token."
                      confirm_token:
                        type: "string"
                        minLength: 1
                        description: "A short-lived, single-use confirmation token."
                      expires_in:
                        type: "integer"
                        minimum: 1
                        description: "Token lifetime in seconds."
                      token_rejected:
                        type: "string"
                        description: "Why a supplied token did not authorize this preview."
                    required:
                      - "error"
                      - "error_code"
                      - "operation"
                      - "would_destroy"
                      - "confirm_token"
                      - "expires_in"
                    additionalProperties: False
                    description: "A destructive-action confirmation response."
                  - type: "object"
                    description: "A validation, conflict, credit, or payment response from the Rails action boundary."
                    required:
                      - "error_code"
                    properties:
                      error:
                        type: "string"
                        description: "Human-readable failure detail."
                      error_code:
                        type: "string"
                        minLength: 1
                        description: "The stable machine-readable failure code."
                      errors:
                        type: "array"
                        description: "Field-level action validation failures."
                        items:
                          type: "object"
                          properties:
                            path:
                              type:
                                - "string"
                                - "array"
                              description: "The invalid request path."
                            code:
                              type: "string"
                              description: "The field failure code."
                            message:
                              type: "string"
                              description: "The field failure detail."
                            schema:
                              type: "string"
                              description: "The generated schema revision that rejected the request."
                            fragment:
                              type: "string"
                              description: "The JSON Pointer to the rejected request value."
                            failed_attribute:
                              type: "string"
                              description: "The JSON Schema keyword that rejected the value."
                          required: []
                          additionalProperties: false
                      retryable:
                        type: "boolean"
                        description: "Whether retrying can succeed without changing the action."
                      new_change_set_required:
                        type: "boolean"
                        description: "Whether the caller must begin a new edit group."
                      funding_error_kind:
                        type: "string"
                        description: "The credit or payment failure category."
                      x402_credit_purchase:
                        type: "object"
                        description: "A typed x402 quote or credit-plan requirement."
                        properties:
                          status:
                            enum:
                              - "credit_plan_required"
                              - "payment_required"
                          checkout_session_id:
                            oneOf:
                              - type: "integer"
                                minimum: 1
                              - type: "string"
                                pattern: "^[A-Za-z0-9_-]+$"
                                minLength: 1
                                maxLength: 128
                            description: "A persisted Rails resource identifier."
                          amount_usd:
                            type: "string"
                          credits:
                            type: "string"
                          payment_methods:
                            type: "array"
                          retry:
                            type: "object"
                        additionalProperties: true
                    additionalProperties: True
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_vidsheet_action
      x-mcp-branch: "<flat ops>"
  /vidsheet/{id}/generations:
    get:
      operationId: getVidsheetByIdGenerations
      x-phase: convert
      summary: "Discover — running generations"
      tags: [Sheets]
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  generations:
                    type: "array"
                    items:
                      type: "object"
                      properties:
                        generation_id: {}
                        status: {}
                        user_job_type: {}
                        container_type: {}
                        container_id: {}
                        row_id: {}
                        created_at: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "vidsheet.running_generations"
  /vidsheet/{sheet_id}/cells/{cell_id}/available_variables:
    get:
      operationId: getVidsheetBySheetIdCellsByCellIdAvailableVariables
      x-phase: setup
      summary: "Discover — available variables"
      tags: [Cells]
      parameters:
      - name: sheet_id
        in: path
        required: true
        schema:
          type: string
      - name: cell_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  local_variables:
                    type: "array"
                    items:
                      type: "object"
                      properties:
                        id: {}
                        name: {}
                        value: {}
                        content_type: {}
                        column_id: {}
                  video_layer_variables:
                    type: "array"
                    items:
                      type: "object"
                      properties:
                        id: {}
                        name: {}
                        layer_type: {}
                        cell_id: {}
                  global_variables:
                    type: "array"
                    items:
                      type: "object"
                      properties:
                        id: {}
                        name: {}
                        value: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "vidsheet.available_variables"
  /vidsheet/{sheet_id}/operations:
    get:
      operationId: getVidsheetBySheetIdOperations
      x-phase: convert
      summary: "Discover — operations"
      tags: [Sheets]
      parameters:
      - name: sheet_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  change_sets:
                    type: "array"
                    items:
                      type: "object"
                      description: "`Vidsheets::ChangeSetSummary#as_json`."
                      properties:
                        change_set_id: {}
                        description: {}
                        operation_count:
                          type: "integer"
                        operation_types:
                          type: "array"
                          items: {}
                        actor_type: {}
                        user_id: {}
                        agent_id: {}
                        undone:
                          type: "boolean"
                        undone_at: {}
                        created_at: {}
                        updated_at: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "media.operations"
  /vidsheet/{sheet_id}/operations/last:
    get:
      operationId: getVidsheetBySheetIdOperationsLast
      x-phase: convert
      summary: "Discover — last operation"
      tags: [Sheets]
      parameters:
      - name: sheet_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  change_set:
                    description: "`Vidsheets::ChangeSetSummary#as_json`."
                    type: "object"
                    properties:
                      change_set_id: {}
                      description: {}
                      operation_count:
                        type: "integer"
                      operation_types:
                        type: "array"
                        items: {}
                      actor_type: {}
                      user_id: {}
                      agent_id: {}
                      undone:
                        type: "boolean"
                      undone_at: {}
                      created_at: {}
                      updated_at: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "media.last_operation"
  /vidsheet/{sheet_id}/validate_video_layout:
    post:
      operationId: postVidsheetBySheetIdValidateVideoLayout
      x-phase: convert
      summary: "Discover — layout validation"
      tags: [Sheets]
      parameters:
      - name: sheet_id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON request body."
              properties:
                agent_id:
                  type: "string"
                  description: "Agent context; the controller reads params[:agent_id] (`require_agent!`)."
              required:
                - "agent_id"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                description: "`Spreadsheets::VidsheetRouteContract#payload` merged with `{layout_valid, warnings}`."
                properties:
                  spreadsheet_id: {}
                  vidsheet_project_id: {}
                  vidsheet_url: {}
                  layout_valid:
                    type: "boolean"
                  warnings:
                    type: "array"
                    items: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "vidsheet.layout_validation"
  /voice_resources:
    get:
      operationId: getVoiceResources
      x-phase: setup
      summary: "Discover — list"
      tags: [Agent Voice]
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "array"
                items:
                  type: "object"
                  description: "`app/resources/voice_resource_resource.rb`."
                  properties:
                    id: {}
                    name: {}
                    provider: {}
                    url: {}
                    voice_id: {}
                    ownership: {}
                    billing_source: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "voice.list"
  /voice_resources/{voice_id}:
    get:
      operationId: getVoiceResourcesByVoiceId
      x-phase: setup
      summary: "Discover — resource"
      tags: [Agent Voice]
      parameters:
      - name: voice_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                description: "`app/resources/voice_resource_resource.rb`."
                properties:
                  id: {}
                  name: {}
                  provider: {}
                  url: {}
                  voice_id: {}
                  ownership: {}
                  billing_source: {}
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_discover
      x-mcp-branch: "voice.resource"
  /x402_credit_purchase/settle:
    post:
      operationId: postX402CreditPurchaseSettle
      x-phase: setup
      summary: "Buy credits and manage credit purchases — settle x402 credit purchase"
      tags: [Organizations]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
              description: "JSON body. The signed payment travels in the `PAYMENT-SIGNATURE` header."
              required:
                - "workspace_id"
                - "checkout_session_id"
              properties:
                workspace_id:
                  description: "Workspace receiving the credits (alias `organization_id`)."
                checkout_session_id:
                  description: "The `checkout_session_id` from the create/quote response (alias `x402_checkout_session_id`)."
                network:
                  description: "Payment network the signature was made on."
                  enum:
                    - "sui"
                    - "solana"
                    - "base"
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: "object"
                properties:
                  workspace_id: {}
                  checkout_session_id: {}
                  idempotent:
                    type: "boolean"
                  x402_payment_event_id: {}
                  credit_purchase:
                    type: "object"
                    properties:
                      id: {}
                      credit_type: {}
                      total_credits: {}
                      total_used_credits: {}
                      status: {}
                      payment_type: {}
                      payment_id: {}
                      created_at:
                        type: "integer"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ApiValidationError'
      x-mcp-tool: gen_billing_action
      x-mcp-branch: "settle_x402_credit_purchase"

  # gen:mcp-surface-paths:end
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: Personal Access Token (PAT). Create one in Settings > API Keys.
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Bearer JWT issued by the GEN dashboard sign-in.

  parameters:
    AgentId:
      name: agent_id
      in: query
      required: true
      description: The agent ID. Find via `GET /v1/agents`.
      schema:
        type: string
    AgentIdPath:
      name: agent_id
      in: path
      required: true
      schema:
        type: string
    SheetId:
      name: sheet_id
      in: path
      required: true
      schema:
        type: string
    RowId:
      name: row_id
      in: path
      required: true
      schema:
        type: string
    CellId:
      name: cell_id
      in: path
      required: true
      schema:
        type: string
    LayerId:
      name: layer_id
      in: path
      required: true
      schema:
        type: string
    TokenId:
      name: id
      in: path
      required: true
      schema:
        type: string

  schemas:
    TranscriptionSource:
      type: object
      required: [value]
      properties:
        value:
          type: string
          format: uri
          description: Publicly reachable URL of the media to transcribe.
          example: "https://cdn.example.com/episode-12.mp3"
        key:
          type: string
          description: Optional storage key for the media.

    TranscriptionTrim:
      type: object
      required: [start_seconds, duration_seconds]
      description: Transcribe only part of the source.
      properties:
        start_seconds:
          type: number
          minimum: 0
          description: Offset to start transcribing from.
          example: 15
        duration_seconds:
          type: number
          exclusiveMinimum: 0
          description: How many seconds to transcribe.
          example: 30

    TranscriptionData:
      type: object
      description: |
        The source to transcribe. Pass exactly one of `audio`, `video`, or
        `content_resource_id`. `audio` and `video` are mutually exclusive;
        `trim` may accompany either.
      oneOf:
        - type: object
          required: [audio]
          additionalProperties: false
          properties:
            audio:
              $ref: '#/components/schemas/TranscriptionSource'
            trim:
              $ref: '#/components/schemas/TranscriptionTrim'
        - type: object
          required: [video]
          additionalProperties: false
          properties:
            video:
              $ref: '#/components/schemas/TranscriptionSource'
            trim:
              $ref: '#/components/schemas/TranscriptionTrim'
        - type: object
          required: [content_resource_id]
          properties:
            content_resource_id:
              type: string
              description: ID of an audio or video content resource already uploaded to the agent.
              example: "res_abc123"

    TranscriptionSentence:
      type: object
      properties:
        text:
          type: string
          description: Sentence text.
          example: "Welcome back to another episode."
        startMs:
          type: integer
          description: Sentence start, in milliseconds.
          example: 0
        endMs:
          type: integer
          description: Sentence end, in milliseconds.
          example: 1840

    TranscriptionResult:
      type: object
      description: The `result` field of a completed transcription generation.
      properties:
        full_text:
          type: string
          description: The entire transcript as one string.
          example: "Welcome back to another episode. Today we are hunting tacos."
        sentences:
          type: array
          description: Sentence segments in order.
          items:
            $ref: '#/components/schemas/TranscriptionSentence'
        audio_duration:
          type: number
          description: Length of the transcribed audio, in seconds.
          example: 3.62

    X402PaymentMethod:
      type: object
      required: [network, x402Network, asset, payTo, amountUsd, credits]
      properties:
        network:
          type: string
          enum: [sui, solana, base]
          description: Human-readable payment rail to show to users and agents.
        x402Network:
          type: string
          description: x402 network identifier used inside `payment_required.accepts`.
          examples: ["sui", "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp", "eip155:8453"]
        asset:
          type: string
          example: USDC
        payTo:
          type: string
          description: Treasury payment recipient for this rail.
        amountUsd:
          type: string
          description: USD amount represented by this payment method.
        credits:
          type: string
          description: Credits that will be issued after settlement.

    X402Accept:
      type: object
      required: [scheme, network, asset, maxAmountRequired, payTo, resource]
      properties:
        scheme:
          type: string
          example: exact
        network:
          type: string
        asset:
          type: string
          example: USDC
        maxAmountRequired:
          type: string
          description: Atomic USDC amount required by this accept entry.
        payTo:
          type: string
        resource:
          type: string
          example: https://api.gen.pro/v1/x402_credit_purchase
        description:
          type: string
        mimeType:
          type: string
          example: application/json
        extra:
          type: object
          properties:
            checkoutSessionId: { type: integer }
            workspaceId: { type: integer }
            pricingMode: { type: string, enum: [custom_amount, credit_plan] }
            amountUsd: { type: string }
            credits: { type: string }
            network: { type: string, enum: [sui, solana, base] }
            referenceCreditPlanId: { type: integer, nullable: true }

    X402PaymentRequired:
      type: object
      required: [x402Version, accepts]
      properties:
        x402Version:
          type: integer
          example: 2
        error:
          type: string
        paymentMethods:
          type: array
          items:
            $ref: '#/components/schemas/X402PaymentMethod'
        accepts:
          type: array
          items:
            $ref: '#/components/schemas/X402Accept'

    X402CreditPurchaseQuote:
      type: object
      required: [checkout_session_id, workspace_id, amount_usd, credits, payment_methods, payment_required]
      properties:
        checkout_session_id:
          type: integer
        workspace_id:
          type: integer
        pricing_mode:
          type: string
          enum: [custom_amount, credit_plan]
        reference_credit_plan_id:
          type: integer
          nullable: true
        credit_plan_id:
          type: integer
          nullable: true
        quantity:
          type: integer
        amount_usd:
          type: string
        credits:
          type: string
        payment_methods:
          type: array
          description: User/agent-facing Sui, Solana, and Base payment options.
          items:
            $ref: '#/components/schemas/X402PaymentMethod'
        payment_required:
          $ref: '#/components/schemas/X402PaymentRequired'

    SongMixTrack:
      type: object
      properties:
        title:
          type: string
          nullable: true
        artist:
          type: string
          nullable: true
        url:
          type: string
          format: uri
          nullable: true
        asset_id:
          type: string
          nullable: true
        bpm:
          type: number
          minimum: 40
          maximum: 240
          nullable: true
        key:
          type: string
          nullable: true
        mood:
          type: string
          nullable: true

    SongMixRequest:
      type: object
      properties:
        tracks:
          type: array
          maxItems: 25
          items:
            $ref: '#/components/schemas/SongMixTrack'
        prompt:
          type: string
          nullable: true
        transition_style:
          type: string
          nullable: true
          default: professional
        output_format:
          type: string
          enum: [mp3, wav]
          default: mp3
        auto_order:
          type: boolean
          default: true
        desired_duration_seconds:
          type: integer
          minimum: 30
          maximum: 7200
          nullable: true
        generate_missing_count:
          type: integer
          minimum: 1
          maximum: 25
          nullable: true

    SongMixJob:
      type: object
      required: [job_id, status, prompt, tracks, engine, output_format, transition_style, auto_order, message, next_step]
      properties:
        job_id:
          type: string
        status:
          type: string
          enum: [pending_engine, pending_song_generation]
        prompt:
          type: string
        tracks:
          type: array
          items:
            $ref: '#/components/schemas/SongMixTrack'
        engine:
          type: string
          example: mixxx_or_compatible
        output_format:
          type: string
          example: mp3
        transition_style:
          type: string
          example: professional
        auto_order:
          type: boolean
          example: true
        desired_duration_seconds:
          type: integer
          nullable: true
          minimum: 30
          maximum: 7200
        output_url:
          type: string
          nullable: true
        message:
          type: string
        next_step:
          type: string

    User:
      type: object
      properties:
        id:
          type: string
        email:
          type: string
        name:
          type: string
        username:
          type: string
        created_at:
          type: string

    Workspace:
      type: object
      properties:
        id:
          type: string
        name:
          type: string

    Agent:
      type: object
      properties:
        id:
          type: string
        name:
          type: string

    ApiKey:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        token_type:
          type: string
        created_at:
          type: string
          format: date-time
        expires_at:
          type: string
          format: date-time
          nullable: true
        last_used_at:
          type: string
          format: date-time
          nullable: true
        revoked_at:
          type: string
          format: date-time
          nullable: true
        status:
          type: string
          enum: [active, expired, revoked]

    Sheet:
      type: object
      properties:
        id:
          type: string
        slug:
          type: string
        title:
          type: string
        project_type:
          type: string
        is_default:
          type: boolean
        uuid:
          type: string
        status:
          type: string
        created_at:
          type: integer
          description: Unix timestamp (seconds)
        created_at_ts:
          type: integer
          description: Unix timestamp (milliseconds)
        updated_at_ts:
          type: integer
          description: Unix timestamp (milliseconds)
        spreadsheet_columns:
          type: array
          items:
            $ref: '#/components/schemas/Column'
        spreadsheet_rows:
          type: array
          items:
            $ref: '#/components/schemas/Row'
        global_variables_sheet:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/Sheet'

    Row:
      type: object
      properties:
        id:
          type: string
        position:
          type: integer
        additional_attributes:
          type: object
        created_at_ts:
          type: integer
        updated_at_ts:
          type: integer
        spreadsheet_cells:
          type: array
          items:
            $ref: '#/components/schemas/Cell'
        execution_cost:
          type: string
          nullable: true
          description: Total credit cost (only when `with_execution_cost=true`).

    Column:
      type: object
      properties:
        id:
          type: string
        title:
          type: string
        temp_title:
          type: string
          nullable: true
        type:
          type: string
        column_role:
          type: string
          nullable: true
        description:
          type: string
          nullable: true
        position:
          type: integer
        additional_attributes:
          type: object
        created_at_ts:
          type: integer
        updated_at_ts:
          type: integer

    Cell:
      type: object
      properties:
        id:
          type: string
        value:
          type: string
          nullable: true
        additional_attributes:
          type: object
        cell_role:
          type: string
          nullable: true
        created_at_ts:
          type: integer
        updated_at_ts:
          type: integer
        default_user_job:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/Generation'
        user_jobs:
          type: array
          items:
            $ref: '#/components/schemas/Generation'
        video_layers:
          type: array
          items:
            $ref: '#/components/schemas/Layer'
        execution_cost:
          type: string
          nullable: true

    Layer:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        position:
          type: integer
        type:
          type: string
        additional_attributes:
          type: object
        created_at_ts:
          type: integer
        updated_at_ts:
          type: integer
        default_user_job:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/Generation'
        user_jobs:
          type: array
          items:
            $ref: '#/components/schemas/Generation'
        execution_cost:
          type: string
          nullable: true

    Generation:
      type: object
      properties:
        id:
          type: string
        status:
          type: string
          enum: [pending, processing, completed, failed, stopped]
        user_job_type:
          type: string
        result:
          type: object
          nullable: true
        failed_reason:
          type: string
          nullable: true
        output_resources:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              url:
                type: string
                format: uri
              thumbnail_url:
                type: string
                format: uri
                nullable: true
              object_type:
                type: string
                description: '"Video", "Image", etc.'
              type:
                type: string
        execution_cost:
          type: string
          nullable: true

    AutomationConfig:
      type: object
      properties:
        webhook_url:
          type: string
          format: uri
          nullable: true
        callback_url:
          type: string
          format: uri
          nullable: true
        polling_enabled:
          type: boolean

    Template:
      type: object
      properties:
        id:
          type: string
        slug:
          type: string
        title:
          type: string
        name:
          type: string
        description:
          type: string
        cover:
          type: string
          format: uri
          nullable: true
        tutorial_url:
          type: string
          format: uri
          nullable: true
        tags:
          type: array
          items:
            type: string
        recent_generated_contents:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              type:
                type: string
              thumbnail_url:
                type: string
                format: uri

    AgentDetail:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
          nullable: true
        organization_id:
          type: string
        time_zone:
          type: string
          nullable: true
        primary_avatar_id:
          type: string
          nullable: true
        primary_avatar_url:
          type: string
          format: uri
          nullable: true
        agent_setup_project_id:
          type: string
          nullable: true
        role:
          type: string
        default_user_voice:
          type: object
          nullable: true
          properties:
            id:
              type: string
            name:
              type: string
            gender:
              type: string
            language:
              type: string
            provider:
              type: string
            url:
              type: string
              format: uri

    Avatar:
      type: object
      properties:
        id:
          type: string
        is_primary:
          type: boolean
        url:
          type: string
          format: uri
        thumbnail_url:
          type: string
          format: uri
          nullable: true
        degod_avatar_id:
          type: string
          nullable: true

    Organization:
      type: object
      properties:
        id:
          type: string
        uuid:
          type: string
        organization_id:
          type: string
        name:
          type: string
        avatar:
          type: object
          nullable: true
          properties:
            url:
              type: string
              format: uri
            thumbnail_url:
              type: string
              format: uri
        user_role:
          type: string
        credit:
          type: number
        available_credit:
          type: object
          properties:
            generic:
              type: number
            aura:
              type: number
        total_members:
          type: integer
        credit_plan:
          type: object
          nullable: true
          properties:
            id:
              type: string
            name:
              type: string
            cycle:
              type: string

    ContentResource:
      type: object
      properties:
        id:
          type: string
        url:
          type: string
          format: uri
        thumbnail_url:
          type: string
          format: uri
          nullable: true
        file_name:
          type: string
        content_type:
          type: string

    DirectUpload:
      type: object
      properties:
        id:
          type: string
        key:
          type: string
        filename:
          type: string
        content_type:
          type: string
        byte_size:
          type: integer
        checksum:
          type: string
        signed_id:
          type: string
          description: Use this as `content_resource[file]` when creating a content resource.
        direct_upload:
          type: object
          properties:
            url:
              type: string
              format: uri
              description: Pre-signed S3 URL. PUT the file here.
            headers:
              type: object
              properties:
                Content-Type:
                  type: string
                Content-MD5:
                  type: string

    AgentProfile:
      type: object
      properties:
        identity:
          type: object
          description: Agent identity configuration (name, persona, backstory).
        voice:
          type: object
          description: Voice and tone settings.
        brand:
          type: object
          description: Brand guidelines, colors, and style.

    AgentProfileInput:
      type: object
      description: All fields are optional. Provide only the sections you want to set.
      properties:
        identity:
          type: object
        voice:
          type: object
        brand:
          type: object

    Conversation:
      type: object
      properties:
        id:
          type: string
        title:
          type: string
          nullable: true
        agent_id:
          type: string
        pinned:
          type: boolean
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        messages:
          type: array
          items:
            type: object
            properties:
              role:
                type: string
                enum: [user, assistant, system]
              content:
                type: string
              created_at:
                type: string
                format: date-time

    Idea:
      type: object
      properties:
        id:
          type: string
        title:
          type: string
        description:
          type: string
          nullable: true
        status:
          type: string
          enum: [generated, approve_to_create, ready_for_review, change_idea, change_video, rejected, approved_to_post, posted]
        agent_id:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time

    Error:
      type: object
      required: [error]
      properties:
        error:
          type: string
          description: Human-readable error message.
        error_code:
          type: string
          description: Machine-readable error code.

    # ── Publishing (schedule) schemas ─────────────────────────
    PublishPlatform:
      type: string
      enum: [tiktok, instagram, facebook, youtube, x, linkedin]

    PublishPlatformRule:
      type: object
      properties:
        platform:
          $ref: '#/components/schemas/PublishPlatform'
        label:
          type: string
          example: LinkedIn
        text_only:
          type: boolean
          description: Whether a post with no media is accepted.
        media:
          type: array
          items:
            type: string
            enum: [video, image, document]
        max_media_items:
          type: integer
          example: 9
        max_text:
          type: integer
          description: Caption / description character limit.
          example: 3000
        max_title:
          type: integer
          nullable: true
          description: Title character limit; null when the platform ignores `title`.
          example: 400
        required:
          type: array
          items:
            type: string
        optional:
          type: array
          items:
            type: string
        ignored:
          type: array
          items:
            type: string
        options:
          type: object
          description: The platform's options object (`instagram_music`, `youtube_options` or `linkedin_options`) mapped to its fields and the values each accepts. Empty for platforms without options.
          additionalProperties:
            type: object
            additionalProperties:
              type: string
          example:
            linkedin_options:
              visibility: "public (default) | connections | loggedin"
              alt_text: "string[] — alternative text per image, in media order (images only)"
        editable_after_publish:
          type: array
          description: |
            Fields `PATCH /schedule/post/{post_id}/published` can still change once the post is live. Empty means the network has no supported post-publication edit and that endpoint answers `unsupported_after_publish` for it.
          items:
            type: string
          example: [title, description, tags, category_id]
        notes:
          type: string

    PublishedPostUpdate:
      type: object
      description: |
        A sparse metadata edit for a post that has already published. Send only the fields you want changed; every other field on the live post is preserved. At least one field is required.
      minProperties: 1
      properties:
        title:
          type: string
          description: New title. YouTube allows up to 100 characters and rejects a blank title.
        description:
          type: string
          description: |
            New description / caption. YouTube allows up to 5,000 **bytes** (not characters — emoji and CJK cost several bytes each). An explicit `null` clears the description.
        tags:
          type: array
          description: YouTube only — replaces the video's tags. Each tag is 2+ characters and all tags together are at most 400 characters.
          items:
            type: string
        category_id:
          type: integer
          description: YouTube only — video category ID (for example 22 People & Blogs, 24 Entertainment).

    PublishedPostUpdateResult:
      type: object
      properties:
        platform:
          $ref: '#/components/schemas/PublishPlatform'
        platform_post_id:
          type: string
          nullable: true
          description: The platform's own ID for the live post (a YouTube video ID).
        result:
          type: string
          enum: [updated, unsupported_after_publish, reauthorization_required, failed]
          description: |
            `updated` — the platform accepted the edit and `metadata` is what it holds now.
            `unsupported_after_publish` — this network has no post-publication edit for this content; nothing was touched.
            `reauthorization_required` — GEN's saved authorization for this account can no longer edit the post; the user must reconnect it (GEN app → Setup → Accounts).
            `failed` — the platform rejected the edit; `message` carries its reason.
        updated_fields:
          type: array
          description: Present on `updated` — the fields that were sent to the platform.
          items:
            type: string
        metadata:
          type: object
          description: Present on `updated` — the metadata read back from the platform after the write, not the values that were sent.
        quota_units:
          type: integer
          description: Present on `updated` — the platform API quota the update consumed (YouTube charges 50 units per update).
          example: 50
        message:
          type: string
          description: Why this platform could not be updated. Absent on `updated`.

    PublishedPostUpdateResponse:
      type: object
      properties:
        post_id:
          type: integer
        results:
          type: array
          description: One entry per platform the post went out on, in the post's platform order.
          items:
            $ref: '#/components/schemas/PublishedPostUpdateResult'

    InstagramMusic:
      type: object
      description: Instagram only. Mixes a music track under every video item before upload (Instagram cannot attach audio to images or carousels via API). Needs at least one video item.
      properties:
        mode:
          type: string
          enum: [auto, none]
          default: auto
          description: '`auto` picks a track from the GEN music library; when none is available the post publishes without music and `music_track` is null.'
        track_url:
          type: string
          format: uri
          description: An https audio file to mix instead of an auto-picked track.

    YouTubeOptions:
      type: object
      description: YouTube only.
      properties:
        visibility:
          type: string
          enum: [public, unlisted, private]
          default: public
        shorts:
          type: boolean
          default: false
          description: Post as a YouTube Short (adds `#shorts` to the description; keep the video vertical and under 3 minutes). The published `post_url` is then `https://www.youtube.com/shorts/{id}`.
        tags:
          type: array
          items:
            type: string
            minLength: 2
          description: 400 characters in total.
        made_for_kids:
          type: boolean
          default: false
        notify_subscribers:
          type: boolean
          default: true
        category_id:
          type: integer
          default: 22
          description: YouTube video category (22 = People & Blogs).

    LinkedInOptions:
      type: object
      description: LinkedIn only.
      properties:
        visibility:
          type: string
          enum: [public, connections, loggedin]
          default: public
        alt_text:
          type: array
          items:
            type: string
          description: One entry per image, in media order. Images only.
        carousel:
          type: boolean
          default: false
          description: Post 2-9 images as a swipeable LinkedIn carousel - a PDF document built from the images, one page each - instead of the multi-image grid (LinkedIn has no image carousel for organic posts). The post `title` becomes the document title.

    SchedulePostContent:
      type: object
      properties:
        media_type:
          type: string
          enum: [VIDEO, IMAGE, REELS, TWEET_VIDEO]
          default: VIDEO
        media_url:
          type: string
          format: uri
          description: Public URL of the first (or only) media file — a video, an image, or for LinkedIn a PDF/PPT/PPTX/DOC/DOCX document. Required for TikTok, Instagram, Facebook and YouTube. The file extension decides image vs video vs document.
        media_urls:
          type: array
          items:
            type: string
            format: uri
          description: Further media URLs for the same post. Instagram — `media_url` plus `media_urls` totalling 2-10 images and videos post as one carousel. X — up to 4 images. LinkedIn — up to 9 images. One item elsewhere.
        description:
          type: string
          description: Caption / post text. Per-platform limit (X 280, TikTok/Instagram 2,200, LinkedIn 3,000, YouTube 5,000, Facebook 63,206). Required for a text-only X or LinkedIn post.
        title:
          type: string
          description: Required for YouTube (max 100). Optional for Facebook (255) and LinkedIn (400). Ignored elsewhere.
        thumbnail_url:
          type: string
          format: uri
          description: Custom thumbnail; generated from the video when omitted. YouTube uploads it as the video's thumbnail (https, .jpg/.jpeg/.png, under 2 MB) — a thumbnail problem is reported as `warning`, the video still publishes.
        instagram_music:
          $ref: '#/components/schemas/InstagramMusic'
        youtube_options:
          $ref: '#/components/schemas/YouTubeOptions'
        linkedin_options:
          $ref: '#/components/schemas/LinkedInOptions'
        thread:
          type: array
          description: X only. Ordered tweet segments, each limited to 280 characters.
          items:
            type: object
            properties:
              text:
                type: string
              media_urls:
                type: array
                items:
                  type: string
                  format: uri
        reply_to_tweet_id:
          type: string
          description: X only. Post as a reply to this tweet id.
        tiktok_privacy_level:
          type: string
          enum: [PUBLIC_TO_EVERYONE, MUTUAL_FOLLOW_FRIENDS, FOLLOWER_OF_CREATOR, SELF_ONLY]
        tiktok_disable_comment:
          type: boolean
        tiktok_disable_duet:
          type: boolean
        tiktok_disable_stitch:
          type: boolean
        tiktok_disclose_commercial_content:
          type: boolean
          default: false
        tiktok_your_brand:
          type: boolean
          default: false
        tiktok_branded_content:
          type: boolean
          default: false

    SchedulePostRequest:
      allOf:
        - $ref: '#/components/schemas/SchedulePostContent'
        - type: object
          required: [agent_id, platform]
          properties:
            agent_id:
              type: string
            platform:
              type: array
              minItems: 1
              items:
                $ref: '#/components/schemas/PublishPlatform'
            schedule_type:
              type: string
              enum: [now, specific_time, next_available]
              default: next_available
            scheduled_time:
              type: string
              description: ISO 8601 UTC (e.g. `2026-09-20T15:00:00Z`). Required for `specific_time`; must be in the future.
              example: "2026-09-20T15:00:00Z"
            strict:
              type: boolean
              default: false
              description: When true, a platform that cannot take this content (e.g. Instagram with no media) is a 422 instead of a reported skip. Recommended for API clients.

    SchedulePostUpdate:
      allOf:
        - $ref: '#/components/schemas/SchedulePostContent'
        - type: object
          properties:
            platform:
              type: array
              items:
                $ref: '#/components/schemas/PublishPlatform'
            schedule_type:
              type: string
              enum: [now, specific_time, next_available]
            scheduled_time:
              type: string

    PostPlatformStatus:
      type: object
      properties:
        platform:
          $ref: '#/components/schemas/PublishPlatform'
        status:
          type: string
          description: Raw worker status.
        normalized_status:
          type: string
          enum: [accepted, publishing, published, failed]
        platform_post_id:
          type: string
          nullable: true
          description: The platform's id for the live post.
        post_url:
          type: string
          nullable: true
          format: uri
          description: Public link to the live post (YouTube watch URL, Instagram permalink, Facebook Page video, TikTok video, X status, LinkedIn post). Set when published.
        published_at:
          type: string
          nullable: true
        error:
          type: string
          nullable: true
        error_code:
          type: string
          nullable: true
        failed_step:
          type: string
          nullable: true
        warning:
          type: string
          nullable: true
          description: 'Non-fatal problem recorded by the worker while the post itself succeeded (e.g. `thumbnail_failed: ...` on YouTube).'
        platform_options:
          type: object
          nullable: true
          description: The `instagram_music` / `youtube_options` / `linkedin_options` objects as sent.
        scheduled_time:
          type: string
        media_url:
          type: string
          nullable: true
        media_urls:
          type: array
          nullable: true
          items:
            type: string
        description:
          type: string
          nullable: true
        title:
          type: string
          nullable: true

    ScheduleCreateResponse:
      type: object
      properties:
        message:
          type: string
        post_id:
          type: integer
          example: 48213
        platforms:
          type: array
          description: The platforms requested.
          items:
            $ref: '#/components/schemas/PublishPlatform'
        platforms_status:
          type: array
          description: One entry per platform that will be published; fills in as the worker completes.
          items:
            $ref: '#/components/schemas/PostPlatformStatus'
        platforms_skipped:
          type: array
          description: Platforms that cannot take this content (only when `strict` is false).
          items:
            type: object
            properties:
              platform:
                $ref: '#/components/schemas/PublishPlatform'
              reason:
                type: string
        status_url:
          type: string
          example: /schedule/post/48213
        idempotent_replay:
          type: boolean
        post:
          $ref: '#/components/schemas/ScheduledPost'

    ScheduledPost:
      type: object
      properties:
        id:
          type: integer
        agent_id:
          type: string
        status:
          type: string
        schedule_type:
          type: string
          enum: [now, specific_time, next_available]
        scheduled_time:
          type: string
        media_type:
          type: string
        media_url:
          type: string
          nullable: true
        description:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        thumbnail_url:
          type: string
          nullable: true
        media_urls:
          type: array
          nullable: true
          items:
            type: string
        platform_options:
          type: object
          nullable: true
        platforms_status:
          type: array
          items:
            $ref: '#/components/schemas/PostPlatformStatus'

    PlatformValidationError:
      type: object
      properties:
        detail:
          type: object
          properties:
            error:
              type: string
            error_code:
              type: string
              example: platform_validation_failed
            platform:
              $ref: '#/components/schemas/PublishPlatform'
            field:
              type: string
              example: title
            errors:
              type: array
              items:
                type: object
                properties:
                  platform:
                    type: string
                  field:
                    type: string
                  error:
                    type: string

    # ── Agent Core schemas ──────────────────────────────────
    # Flat schema — every field name mirrors the public Agent Core setup fields.
    AgentCore:
      type: object
      description: Full agent setup as returned by GET /agents/{id}/core.
      properties:
        agent_id: { type: string }
        brand_name: { type: string, nullable: true }
        description: { type: string, nullable: true }
        identity_type: { type: string, enum: [brand, character], nullable: true }
        goal: { type: string, nullable: true, description: "Comma-separated, e.g. 'growth,authority,sales'" }
        target_platforms:
          type: array
          items: { type: string }
        shortform: { type: boolean, nullable: true }
        longform: { type: boolean, nullable: true }
        onboarding_status: { type: string, nullable: true }
        keywords:
          type: array
          items: { type: string }
          description: Flat keyword list used by the monitoring cron. Auto-mirrored into `monitored` on write.
        monitored:
          type: array
          items: { $ref: '#/components/schemas/MonitoredItem' }
          description: Inspiration sources — accounts, hashtags, or keywords the agent monitors for trending content.
        linked_accounts:
          type: array
          items: { $ref: '#/components/schemas/LinkedAccount' }
          description: The agent's OWN brand social links. NOT the same as `monitored` (which holds sources to watch).
        personality:
          type: string
          nullable: true
          description: Full persona text for the agent.
        default_user_voice:
          $ref: '#/components/schemas/VoiceRef'
        proof_of_genesis_enabled:
          type: boolean
          description: Master switch for automatic Backup to Blockchain from asset/vidsheet events.
        proof_of_genesis_auto_backup_sources:
          type: array
          description: Asset events that should trigger automatic Proof of Genesis backups.
          items:
            type: string
            enum: [generated, uploaded, downloaded, published]
        proof_of_genesis_auto_backup_asset_types:
          type: array
          description: Asset types eligible for automatic Proof of Genesis backup.
          items:
            type: string
            enum: [video, image]

    AgentCorePatch:
      type: object
      additionalProperties: false
      description: |
        Flat merge-patch body. Send any subset of fields — missing fields are not forwarded.
        Unknown fields return 422. `linked_accounts` and `monitored` use full-list replacement
        semantics: rows not in the list are deleted. To add without touching others, GET first,
        append, then PATCH.
      properties:
        brand_name: { type: string, maxLength: 200 }
        description:
          type: string
          maxLength: 500
          description: Short 2-3 sentence brand summary. NOT full persona — that goes in `personality`.
        identity_type: { type: string, enum: [brand, character] }
        goal: { type: string, maxLength: 100 }
        target_platforms:
          type: array
          items: { type: string }
          maxItems: 10
        shortform: { type: boolean }
        longform: { type: boolean }
        onboarding_status: { type: string, maxLength: 50 }
        keywords:
          type: array
          items: { type: string }
          maxItems: 20
          description: Flat keyword list. If set without `monitored`, auto-mirrored into monitored with item_type='keyword'.
        monitored:
          type: array
          items: { $ref: '#/components/schemas/MonitoredItem' }
          maxItems: 50
          description: Full inspiration source list (replaces the existing list).
        linked_accounts:
          type: array
          items: { $ref: '#/components/schemas/LinkedAccount' }
          maxItems: 20
        personality:
          type: string
          maxLength: 20000
          description: Full persona text for the agent.
        default_user_voice:
          $ref: '#/components/schemas/VoiceRef'
        proof_of_genesis_enabled:
          type: boolean
          description: Master switch for automatic Backup to Blockchain from asset/vidsheet events.
        proof_of_genesis_auto_backup_sources:
          type: array
          description: Replace the list of asset events that should trigger automatic Proof of Genesis backups. Empty means no automatic backup.
          items:
            type: string
            enum: [generated, uploaded, downloaded, published]
        proof_of_genesis_auto_backup_asset_types:
          type: array
          description: Replace the list of asset types eligible for automatic Proof of Genesis backup.
          items:
            type: string
            enum: [video, image]

    ProofOfGenesisBackupCreate:
      type: object
      description: Manual or event-triggered request to back up a GEN asset to Walrus.
      properties:
        asset_url:
          type: string
          description: GEN asset URL to back up. Preferred field.
        video_url:
          type: string
          description: Legacy alias for asset_url.
        asset_type:
          type: string
          enum: [video, image]
          default: video
        visibility:
          type: string
          enum: [private, public]
          default: private
          description: Private assets must be encrypted before upload. Raw private requests are rejected before billing or Walrus work.
        encrypted:
          type: boolean
          default: false
          description: Whether the asset bytes are already encrypted before Walrus upload. Required with encryption_scheme for private assets.
        encryption_scheme:
          type: string
          nullable: true
          maxLength: 128
          description: Required when visibility is private, e.g. seal/v1.
        encryption_key_id:
          type: string
          nullable: true
          maxLength: 256
          description: Optional key policy/version identifier for private proof metadata.
        owner_sui_address:
          type: string
          nullable: true
          description: Optional customer Sui wallet address that should own the Walrus object. Server-triggered auto-backup can resolve this from the user's Dynamic Sui wallet.
        source_event:
          type: string
          enum: [manual, generated, uploaded, downloaded, published]
          default: manual
        content_type:
          type: string
          nullable: true
        idempotency_key:
          type: string
          description: Stable retry key, e.g. content-resource id plus version.
        metadata:
          type: object
          additionalProperties: true
      anyOf:
        - required: [asset_url]
        - required: [video_url]

    ProofOfGenesisBackup:
      type: object
      properties:
        id: { type: integer }
        agent_id: { type: string }
        status: { type: string, enum: [uploading, synced, failed, billing_failed] }
        source_event: { type: string, enum: [manual, generated, uploaded, downloaded, published] }
        source_url: { type: string }
        asset_type: { type: string, enum: [video, image] }
        visibility: { type: string, enum: [private, public] }
        encrypted: { type: boolean }
        encryption_scheme: { type: string, nullable: true }
        encryption_key_id: { type: string, nullable: true }
        owner_sui_address: { type: string, nullable: true }
        custody_mode:
          type: string
          nullable: true
          enum: [gen_custody, customer_wallet, null]
          description: Whether GEN or the customer's Sui wallet owns the Walrus object.
        walrus_object_recipient_address:
          type: string
          nullable: true
          description: Sui address passed to Walrus send_object_to for customer-owned object transfer.
        content_sha256: { type: string, nullable: true }
        size_bytes: { type: integer, nullable: true }
        content_type: { type: string, nullable: true }
        walrus_blob_id: { type: string, nullable: true }
        walrus_blob_object_id: { type: string, nullable: true }
        walrus_storage_id: { type: string, nullable: true }
        walrus_start_epoch: { type: integer, nullable: true }
        walrus_end_epoch: { type: integer, nullable: true }
        walrus_encoded_length_bytes: { type: integer, nullable: true }
        walrus_cost_wal: { type: integer, nullable: true }
        verification_status: { type: string, nullable: true, enum: [verified, skipped, null] }
        billing_operation: { type: string, example: backup_to_blockchain }
        billing_charge_id: { type: integer, nullable: true }
        billing_amount_charged: { type: string, nullable: true }
        billing_new_balance: { type: string, nullable: true }
        billing_outboxed: { type: boolean }
        expires_at:
          type: string
          format: date-time
          nullable: true
          description: Approximate Walrus expiry for the current monthly storage period.
        renewal_due_at:
          type: string
          format: date-time
          nullable: true
          description: When Agent Core should attempt monthly renewal, currently three days before expires_at.
        renewal_status:
          type: string
          description: Monthly renewal state for this backup.
          enum: [not_due, due, renewing, renewed, renewal_blocked, renewal_failed]
        renewal_attempts:
          type: integer
          description: Number of renewal attempts recorded by Agent Core.
        last_renewed_at:
          type: string
          format: date-time
          nullable: true
        failure_code: { type: string, nullable: true }
        failure_message: { type: string, nullable: true }
        removed_at: { type: string, format: date-time, nullable: true }
        created_at: { type: string, format: date-time }
        completed_at: { type: string, format: date-time, nullable: true }

    ProofOfGenesisBackupList:
      type: object
      required: [backups]
      properties:
        backups:
          type: array
          items:
            $ref: '#/components/schemas/ProofOfGenesisBackup'

    MonitoredItem:
      type: object
      additionalProperties: false
      required: [handle, item_type]
      properties:
        handle:
          type: string
          minLength: 1
          maxLength: 300
          description: For accounts — a @handle or URL. For hashtags — the tag (with or without #). For keywords — the search term.
        item_type:
          type: string
          enum: [account, hashtag, keyword]

    LinkedAccount:
      type: object
      additionalProperties: false
      required: [url]
      properties:
        id:
          type: integer
          description: Row id if updating an existing row. Omit when adding a new account.
        url: { type: string, minLength: 1, maxLength: 500 }
        platform:
          type: string
          maxLength: 50
          description: 'tiktok | instagram | youtube | x | linkedin | pinterest | facebook | threads | website | other'
        display_name: { type: string, maxLength: 200 }

    VoiceRef:
      type: object
      additionalProperties: false
      required: [voice_id]
      properties:
        voice_id: { type: string, minLength: 1, maxLength: 200 }
        source:
          type: string
          enum: [public, user_designed, user_trained, user_elevenlabs]
        name: { type: string, maxLength: 200 }

    AgentCorePatchResult:
      type: object
      description: |
        Per-section result. A PATCH to Agent Core may update multiple sections atomically.
        Section keys currently returned:
          - `brand` — brand fields (brand_name, description, identity_type, goal,
            target_platforms, shortform, longform, onboarding_status, keywords, monitored,
            linked_accounts). Clients should treat section keys as opaque strings.
          - `personality` — personality text.
          - `voice` — voice association.
        Each section appears only if the PATCH touched at least one field it owns.
        `status=ok` means that section succeeded. `status=error` means it failed
        (see `error` field). A 207 Multi-Status means at least one section errored.
      additionalProperties:
        type: object
        properties:
          status: { type: string, enum: [ok, error] }
          data:
            description: Target-specific payload on success.
          error:
            type: string
            description: Error message on failure.

    VoiceLibraryItem:
      type: object
      properties:
        voice_id: { type: string }
        name: { type: string, nullable: true }
        source: { type: string, enum: [public, user_designed, user_trained, user_elevenlabs] }
        preview_url: { type: string, nullable: true }

    # ── Watchlists ──────────────────────────────────────────────────────────
    WatchSourceInput:
      type: object
      required: [platform, target_type, target_value]
      properties:
        platform: { type: string, description: 'e.g. "tiktok", "instagram", "youtube"' }
        target_type: { type: string, enum: [account, hashtag, keyword] }
        target_value: { type: string, description: '@handle, hashtag name (no #), or keyword text' }
        original_display_value:
          type: string
          nullable: true
          description: Optional original display form (e.g. "#glassskin" or "@drunkelephant")

    WatchSource:
      allOf:
        - $ref: '#/components/schemas/WatchSourceInput'
        - type: object
          required: [id, watchlist_id, agent_id, intent_active]
          properties:
            id: { type: string }
            watchlist_id: { type: string }
            agent_id: { type: string }
            intent_active: { type: boolean }
            created_at: { type: string, format: date-time, nullable: true }
            updated_at: { type: string, format: date-time, nullable: true }

    WatchlistCreateRequest:
      type: object
      required: [name]
      properties:
        name: { type: string, minLength: 1, maxLength: 200, description: 'Display name. Idempotent: same name reuses existing watchlist.' }
        sources:
          type: array
          items: { $ref: '#/components/schemas/WatchSourceInput' }
        project_id:
          oneOf: [{ type: string }, { type: integer }]
          nullable: true
        conversation_id: { type: string, nullable: true }
        created_by_run_id: { type: string, nullable: true }

    WatchlistUpdateRequest:
      type: object
      properties:
        name: { type: string, minLength: 1, maxLength: 200 }
        intent_active: { type: boolean, description: 'Set false to pause monitoring; true to resume.' }
        project_id:
          oneOf: [{ type: string }, { type: integer }]
          nullable: true

    Watchlist:
      type: object
      required: [id, user_id, agent_id, name, intent_active, sources]
      properties:
        id: { type: string }
        user_id: { type: string }
        agent_id: { type: string }
        name: { type: string }
        intent_active: { type: boolean }
        project_id: { type: string, nullable: true }
        project_error: { type: string, nullable: true, description: 'Read-only. Last project-link sync error, if any.' }
        conversation_id: { type: string, nullable: true }
        created_by_run_id: { type: string, nullable: true }
        sources:
          type: array
          items: { $ref: '#/components/schemas/WatchSource' }
        created_at: { type: string, format: date-time, nullable: true }
        updated_at: { type: string, format: date-time, nullable: true }

    # ── Recurring Jobs (Daily Tasks) ───────────────────────────────────────
    RecurringJobSchedule:
      type: object
      required: [cadence, timezone]
      properties:
        cadence: { type: string, enum: [daily, weekly] }
        timezone: { type: string, description: 'IANA timezone (e.g. "UTC", "America/Los_Angeles")' }
        time_of_day:
          type: string
          description: 'Local clock time "HH:MM" (24h). Required for daily/weekly cadences.'
        days_of_week:
          type: array
          items: { type: integer, minimum: 0, maximum: 6 }
          description: 'Days to run (0=Mon … 6=Sun). REQUIRED when cadence="weekly"; must be omitted when cadence="daily". No duplicates.'

    RecurringJobDelivery:
      type: object
      required: [type]
      properties:
        type: { type: string, enum: [chat_only, email] }
        email:
          type: string
          description: 'Recipient email. REQUIRED when type="email"; must be omitted when type="chat_only".'

    RecurringJob:
      type: object
      required: [id, user_id, agent_id, name, job_type, prompt, schedule, delivery, status, created_at, updated_at]
      properties:
        id: { type: string }
        user_id: { type: integer }
        agent_id: { type: string }
        name: { type: string }
        job_type: { type: string, description: 'e.g. "generate_content_ideas"' }
        prompt: { type: string }
        schedule: { $ref: '#/components/schemas/RecurringJobSchedule' }
        delivery: { $ref: '#/components/schemas/RecurringJobDelivery' }
        status: { type: string, enum: [active, paused, deleted] }
        next_run_at: { type: string, format: date-time, nullable: true }
        last_run_at: { type: string, format: date-time, nullable: true }
        created_at: { type: string, format: date-time }
        updated_at: { type: string, format: date-time }

    RecurringJobCreate:
      type: object
      required: [job_type, prompt, schedule, delivery]
      properties:
        name: { type: string, description: 'Optional. Defaults to first 80 chars of prompt.' }
        job_type: { type: string }
        prompt: { type: string }
        schedule: { $ref: '#/components/schemas/RecurringJobSchedule' }
        delivery: { $ref: '#/components/schemas/RecurringJobDelivery' }
        next_run_at: { type: string, format: date-time }

    RecurringJobUpdate:
      type: object
      properties:
        name: { type: string }
        prompt: { type: string }
        schedule: { $ref: '#/components/schemas/RecurringJobSchedule' }
        delivery: { $ref: '#/components/schemas/RecurringJobDelivery' }
        next_run_at: { type: string, format: date-time }

    # gen:backend-creation-card-schemas:start — generated by scripts/sync-from-backend.mjs; do not edit

    CreationCardModel:
      type: string
      description: |
        A model id a creation card accepts. The card catalog pairs each id with
        its card and the ratio, duration and outputResolution values the API runs.
      enum:
        - seedance-2.5-real-face
        - h3-akatz-v1.5
        - gemini_2
        - gemini_2_lite
        - gemini_pro
        - gpt-image-2
        - gpt-image-2.5-flare
        - gpt-image-2.5-sunburst
        - grok
        - midjourney
        - seedream-4.0
        - seedream-4.5
        - seedream-5.0-pro-less-restriction
        - gemini-omni-1.1-flash
        - kling-v3
        - seedance-2.0
        - seedance-2.0-less-restriction
        - seedance-2.0-fast
        - seedance-2.5
        - seedance-2.5-less-restriction
        - kling-v2-6
        - minimax-h3-max
        - wan-3.0-less-restriction
        - wan-3.0-prime-less-restriction
        - gen
        - suno-v5-beta
        - suno-v4.5plus-beta
        - suno-v5.5-beta
    CreationCardMatrix:
      type: object
      description: |
        The creation-card capability matrix: the creation-card ids, the model id each
        card accepts, and the option values, required fields and bounds the API
        enforces. A generation outside `allowed` is refused.
      properties:
        description:
          type: string
        cards:
          type: array
          description: The creation-card ids the API accepts.
          items:
            type: string
        models:
          type: array
          description: One entry per card and model id the API accepts.
          items:
            type: object
            required: [form_type, model]
            properties:
              form_type:
                type: string
                description: The creation-card id.
              model:
                $ref: '#/components/schemas/CreationCardModel'
        song_max_duration_seconds:
          type: object
          description: Longest song in seconds for each song model.
          additionalProperties:
            type: integer
        limits:
          type: array
          description: The required fields and bounds the API enforces per card and model.
          items:
            type: object
            properties:
              card:
                type: string
              model:
                $ref: '#/components/schemas/CreationCardModel'
              prompt_max_utf16:
                type: [integer, "null"]
              max_reference_images:
                type: [integer, "null"]
              max_reference_videos:
                type: [integer, "null"]
              max_reference_audio:
                type: [integer, "null"]
              max_reference_audio_seconds:
                type: [integer, "null"]
              required:
                type: array
                items:
                  type: string
              fields:
                type: array
                items:
                  type: string
              bounds:
                type: object
              max_source_seconds:
                type: [integer, "null"]
              prompt_attachment_variables:
                type: [boolean, "null"]
              branches:
                type: array
                items:
                  type: object
              speech_words_per_minute:
                type: [integer, "null"]
        rules:
          type: array
          description: The values the API runs for each option field of a card and model.
          items:
            type: object
            required: [card, model, field, allowed]
            properties:
              card:
                type: string
              model:
                $ref: '#/components/schemas/CreationCardModel'
              field:
                type: string
                enum:
                  - ratio
                  - duration
                  - outputResolution
                  - prompt
                  - nativeAudio
              default:
                oneOf:
                  - type: string
                  - type: integer
                  - type: "null"
              allowed:
                type: array
                items:
                  oneOf:
                    - type: string
                    - type: integer

    # gen:backend-creation-card-schemas:end
    # gen:error-envelope-schemas:start — generated by scripts/sync_mcp_surface.py; do not edit

    ApiError:
      type: "object"
      required:
        - "code"
      properties:
        code:
          type: "string"
          description: "The stable machine-readable failure code."
        message:
          type: "string"
          description: "Human-readable failure detail."
        errors:
          type: "array"
          description: "Field-level validation failures."
          items:
            type: "object"
        retryable:
          type: "boolean"
          description: "Whether retrying can succeed without changing the request."
        new_change_set_required:
          type: "boolean"
          description: "Whether the caller must begin a new edit group."
        funding_error_kind:
          type: "string"
          description: "The credit or payment failure category."

    AgentError:
      type: "object"
      required:
        - "code"
      properties:
        code:
          type: "string"
          description: "The stable machine-readable failure code."
        message:
          type: "string"
          description: "Human-readable failure detail."

    AgentCoreError:
      type: "object"
      required:
        - "code"
      properties:
        code:
          type: "string"
          description: "The stable machine-readable failure code."
        message:
          type: "string"
          description: "Human-readable failure detail."

    PythonError:
      type: "object"
      required:
        - "code"
      properties:
        code:
          type: "string"
          description: "The stable machine-readable failure code."
        message:
          type: "string"
          description: "Human-readable failure detail."
        platform:
          type: "string"
          description: "The platform that rejected the content."
        field:
          type: "string"
          description: "The field that failed validation."
        errors:
          type: "array"
          description: "Per-platform validation failures."
          items:
            type: "object"

    # gen:error-envelope-schemas:end
  responses:
    Unauthorized:
      description: Missing or invalid authentication.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: "Unauthorized"
            error_code: "unauthorized"

    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: "Not found"
            error_code: "not_found"

    CreditRequired:
      description: Active GEN credits required.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: "GEN credits are required to use the API."
            error_code: "usable_gen_credit_required"

    # gen:error-envelope-responses:start — generated by scripts/sync_mcp_surface.py; do not edit

    ApiUnauthorized:
      description: "Missing or invalid authentication."
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'

    ApiValidationError:
      description: "Validation failed or the request could not be processed."
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'

    AgentUnauthorized:
      description: "Missing or invalid authentication."
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AgentError'

    AgentValidationError:
      description: "Validation failed or the request could not be processed."
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AgentError'

    AgentCoreUnauthorized:
      description: "Missing or invalid authentication."
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AgentCoreError'

    AgentCoreValidationError:
      description: "Validation failed or the request could not be processed."
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AgentCoreError'

    PythonUnauthorized:
      description: "Missing or invalid authentication."
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PythonError'

    PythonValidationError:
      description: "Validation failed or the request could not be processed."
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PythonError'

    # gen:error-envelope-responses:end
