{
    "schemes": [],
    "swagger": "2.0",
    "info": {
        "description": "Build and operate AI voice agents programmatically. Create an agent, give it knowledge, bind a phone number, place and control calls — all over HTTP, no dashboard required.\n\nAll public endpoints live under /api/v1/ext and authenticate with an API key (X-API-Key: vm_live_...). Scopes are exact — there is no wildcard.\n\nWrites accept an Idempotency-Key header. Use it: a retried request that already succeeded replays the original response instead of creating a second agent or placing a second call.\n\nPin a contract with the VoiceMatrix-Version header, whose values are dates. Omitting it pins you to the OLDEST supported version permanently, so an integration written today keeps today's behaviour. Every response echoes the version it actually served, and an unrecognised one is refused with 400 rather than quietly replaced. The current value is at https://voicematrix.ai/docs/developers",
        "title": "VoiceMatrix Public API",
        "termsOfService": "https://voicematrix.ai/terms",
        "contact": {
            "name": "VoiceMatrix Support",
            "url": "https://voicematrix.ai/support",
            "email": "support@voicematrix.ai"
        },
        "license": {
            "name": "Proprietary",
            "url": "https://voicematrix.ai/license"
        },
        "version": "1.0"
    },
    "host": "api.voicematrix.ai",
    "basePath": "/api/v1",
    "paths": {
    "/ext/carriers/{id}/verify": {
        "post": {
            "security": [
                {
                    "ApiKeyAuth": []
                }
            ],
            "tags": [
                "Carriers"
            ],
            "summary": "Verify a carrier account",
            "parameters": [
                {
                    "type": "string",
                    "description": "Carrier ID",
                    "name": "id",
                    "in": "path",
                    "required": true
                }
            ],
            "responses": {
                "200": {
                    "description": "OK",
                    "schema": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "boolean"
                        }
                    }
                },
                "401": {
                    "description": "API key authentication failed - MISSING_API_KEY, INVALID_API_KEY",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "403": {
                    "description": "Carrier scope or organization required - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "404": {
                    "description": "Carrier not in this organization - NOT_FOUND",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "409": {
                    "description": "Carrier credentials rejected - CARRIER_VERIFICATION_FAILED",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "429": {
                    "description": "Request rate exceeded - RATE_LIMIT_EXCEEDED",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "503": {
                    "description": "Carrier unavailable - CARRIER_UNAVAILABLE",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                }
            }
        }
    },
    "/ext/carriers/{id}/numbers/{number}": {
        "delete": {
            "security": [
                {
                    "ApiKeyAuth": []
                }
            ],
            "tags": [
                "Carriers"
            ],
            "summary": "Detach one carrier number",
            "parameters": [
                {
                    "type": "string",
                    "description": "Carrier ID",
                    "name": "id",
                    "in": "path",
                    "required": true
                },
                {
                    "type": "string",
                    "description": "Imported E.164 number",
                    "name": "number",
                    "in": "path",
                    "required": true
                }
            ],
            "responses": {
                "204": {
                    "description": "Detached; retained number row"
                },
                "400": {
                    "description": "E.164 number required - VALIDATION_ERROR",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "401": {
                    "description": "API key authentication failed - MISSING_API_KEY, INVALID_API_KEY",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "403": {
                    "description": "Carrier scope or organization required - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "404": {
                    "description": "Number not in this organization - NOT_FOUND",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "409": {
                    "description": "Unbind first or reconcile carrier routing - NUMBER_BOUND, CARRIER_RECONCILIATION_REQUIRED",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "429": {
                    "description": "Request rate exceeded - RATE_LIMIT_EXCEEDED",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "503": {
                    "description": "Carrier unavailable - CARRIER_UNAVAILABLE",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                }
            }
        }
    },
    "/ext/carriers/{id}/numbers": {
        "post": {
            "security": [
                {
                    "ApiKeyAuth": []
                }
            ],
            "tags": [
                "Carriers"
            ],
            "summary": "Import one carrier number",
            "parameters": [
                {
                    "type": "string",
                    "description": "Carrier ID",
                    "name": "id",
                    "in": "path",
                    "required": true
                },
                {
                    "description": "One number; importing changes its current inbound routing",
                    "name": "request",
                    "in": "body",
                    "required": true,
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ImportCarrierNumberRequest"
                    }
                }
            ],
            "responses": {
                "201": {
                    "description": "Created",
                    "schema": {
                        "$ref": "#/definitions/voicematrix_internal_carriers.ImportedNumber"
                    }
                },
                "400": {
                    "description": "E.164 number required - VALIDATION_ERROR",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "401": {
                    "description": "API key authentication failed - MISSING_API_KEY, INVALID_API_KEY",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "403": {
                    "description": "Carrier scope or organization required - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "404": {
                    "description": "Carrier not in this organization - NOT_FOUND",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "409": {
                    "description": "Carrier not approved, number unavailable or ambiguous routing - CARRIER_NOT_ACTIVE, NUMBER_NOT_OWNED, NUMBER_ALREADY_IMPORTED, CARRIER_RECONCILIATION_REQUIRED",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "429": {
                    "description": "Request rate exceeded - RATE_LIMIT_EXCEEDED",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "503": {
                    "description": "Carrier unavailable - CARRIER_UNAVAILABLE",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                }
            }
        }
    },
    "/ext/carriers/{id}/available-numbers": {
        "get": {
            "security": [
                {
                    "ApiKeyAuth": []
                }
            ],
            "tags": [
                "Carriers"
            ],
            "summary": "List available carrier numbers",
            "parameters": [
                {
                    "type": "string",
                    "description": "Carrier ID",
                    "name": "id",
                    "in": "path",
                    "required": true
                }
            ],
            "responses": {
                "200": {
                    "description": "OK",
                    "schema": {
                        "type": "object",
                        "additionalProperties": true
                    }
                },
                "401": {
                    "description": "API key authentication failed - MISSING_API_KEY, INVALID_API_KEY",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "403": {
                    "description": "Carrier scope or organization required - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "404": {
                    "description": "Carrier not in this organization - NOT_FOUND",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "429": {
                    "description": "Request rate exceeded - RATE_LIMIT_EXCEEDED",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "503": {
                    "description": "Carrier unavailable - CARRIER_UNAVAILABLE",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                }
            }
        }
    },
    "/ext/carriers/{id}": {
        "get": {
            "security": [
                {
                    "ApiKeyAuth": []
                }
            ],
            "tags": [
                "Carriers"
            ],
            "summary": "Get a carrier",
            "parameters": [
                {
                    "type": "string",
                    "description": "Carrier ID",
                    "name": "id",
                    "in": "path",
                    "required": true
                }
            ],
            "responses": {
                "200": {
                    "description": "OK",
                    "schema": {
                        "type": "object",
                        "additionalProperties": true
                    }
                },
                "401": {
                    "description": "API key authentication failed - MISSING_API_KEY, INVALID_API_KEY",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "403": {
                    "description": "Carrier scope or organization required - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "404": {
                    "description": "Carrier not in this organization - NOT_FOUND",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "429": {
                    "description": "Request rate exceeded - RATE_LIMIT_EXCEEDED",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "503": {
                    "description": "Carrier storage unavailable - CARRIER_UNAVAILABLE",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                }
            }
        },
        "delete": {
            "security": [
                {
                    "ApiKeyAuth": []
                }
            ],
            "tags": [
                "Carriers"
            ],
            "summary": "Disconnect a carrier",
            "parameters": [
                {
                    "type": "string",
                    "description": "Carrier ID",
                    "name": "id",
                    "in": "path",
                    "required": true
                }
            ],
            "responses": {
                "204": {
                    "description": "Disconnected; retained data"
                },
                "401": {
                    "description": "API key authentication failed - MISSING_API_KEY, INVALID_API_KEY",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "403": {
                    "description": "Carrier scope or organization required - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "404": {
                    "description": "Carrier not in this organization - NOT_FOUND",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "429": {
                    "description": "Request rate exceeded - RATE_LIMIT_EXCEEDED",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "503": {
                    "description": "Outbound stopped but removal requires reconciliation - CARRIER_UNAVAILABLE",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                }
            }
        }
    },
    "/ext/carriers": {
        "get": {
            "security": [
                {
                    "ApiKeyAuth": []
                }
            ],
            "tags": [
                "Carriers"
            ],
            "summary": "List carriers",
            "responses": {
                "200": {
                    "description": "Carrier data; no credentials or internal routing identifiers",
                    "schema": {
                        "type": "object",
                        "additionalProperties": true
                    }
                },
                "401": {
                    "description": "API key authentication failed - MISSING_API_KEY, INVALID_API_KEY",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "403": {
                    "description": "Carrier scope or organization required - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "429": {
                    "description": "Request rate exceeded - RATE_LIMIT_EXCEEDED",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "503": {
                    "description": "Carrier storage unavailable - CARRIER_UNAVAILABLE",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                }
            }
        },
        "post": {
            "security": [
                {
                    "ApiKeyAuth": []
                }
            ],
            "tags": [
                "Carriers"
            ],
            "summary": "Connect your carrier",
            "parameters": [
                {
                    "description": "Your carrier credentials; never returned",
                    "name": "request",
                    "in": "body",
                    "required": true,
                    "schema": {
                        "$ref": "#/definitions/voicematrix_internal_carriers.CreateRequest"
                    }
                }
            ],
            "responses": {
                "201": {
                    "description": "Created",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.CarrierResponse"
                    }
                },
                "400": {
                    "description": "Invalid carrier request - VALIDATION_ERROR",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "401": {
                    "description": "API key authentication failed - MISSING_API_KEY, INVALID_API_KEY",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "403": {
                    "description": "Carrier scope, organization or paid account required - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, TRIAL_CARRIER_NOT_ALLOWED",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "429": {
                    "description": "Request rate exceeded - RATE_LIMIT_EXCEEDED",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                },
                "503": {
                    "description": "Encryption or storage unavailable - CARRIER_UNAVAILABLE",
                    "schema": {
                        "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                    }
                }
            }
        }
    },
        "/ext/agents": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Get paginated list of agents (read-only). Returns every status by default; pass ?status=active for live agents only.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Agents"
                ],
                "summary": "List agents",
                "parameters": [
                    {
                        "type": "integer",
                        "default": 20,
                        "description": "Limit",
                        "name": "limit",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "default": 0,
                        "description": "Offset",
                        "name": "offset",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "description": "Filter by status: active, inactive, draft or testing. Omit for all.",
                        "name": "status",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ListResponse"
                        }
                    },
                    "400": {
                        "description": "Unknown status filter or invalid pagination - INVALID_STATUS, VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            },
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "tags": [
                    "Agents"
                ],
                "summary": "Create an agent",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    },
                    {
                        "description": "The agent",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.CreateAgentRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.AgentDetailResponse"
                        }
                    },
                    "400": {
                        "description": "Unknown model, a voice the model cannot speak, a blank prompt, or invalid fields - INVALID_MODEL, VALIDATION_ERROR, INVALID_REQUEST",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "402": {
                        "description": "Suspended or trial-expired account, or the plan's agent limit is reached - the same gates as the dashboard - TRIAL_EXPIRED, AGENT_LIMIT_REACHED, PLAN_LIMIT_REACHED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "A reseller-scoped key has no single organization to create into, or a reserved model this organization is not entitled to - ORGANIZATION_REQUIRED, INSUFFICIENT_SCOPE, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "The organization has no usable client record; support must fix the data - NO_CLIENT_FOR_ORGANIZATION, DEFAULT_CLIENT_UNUSABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "413": {
                        "description": "Request body over the size cap - BODY_TOO_LARGE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours. Retry with the same Idempotency-Key; if it repeats, contact support - INTERNAL_ERROR, DB_ERROR, CREATE_FAILED, UPDATE_FAILED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "The idempotency or rate-limit store could not answer, so the request fails closed - IDEMPOTENCY_UNAVAILABLE, RATE_LIMIT_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/drafts/from-description": {
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "The \"describe your business\" wizard: reads your description (20 to 4000 characters) and returns the business facts in it: name, description, services, hours, Q\u0026A, suggested goals. Phones and emails are kept only if they appear in your text. Like from-website it writes no prompt; feed the facts to from-questionnaire. Creates nothing. 5 drafts a minute per key creator; needs an active account with a free agent slot.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Agent drafts"
                ],
                "summary": "Draft an agent from a description",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    },
                    {
                        "description": "The business, in your words",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.DraftFromDescriptionRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "400": {
                        "description": "Missing or unusable description or language - VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "402": {
                        "description": "Suspended or trial-expired account, or the plan's agent limit is reached - TRIAL_EXPIRED, AGENT_LIMIT_REACHED, PLAN_LIMIT_REACHED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate or the wizard's own limit - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "The drafting model is unavailable - SERVICE_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/drafts/from-questionnaire": {
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "The step-by-step wizard: from its answers (only businessName is required) a model writes the agent's name, prompt and greeting and suggests settings. promptSource says who wrote the prompt: \"ai\", or \"template\" with promptFallbackReason when the model could not. Creates nothing: send name, prompt, greeting and language to POST /ext/agents. Takes up to about a minute. 5 drafts a minute per key creator; needs an active account with a free agent slot.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Agent drafts"
                ],
                "summary": "Draft an agent from the questionnaire",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    },
                    {
                        "description": "The wizard's answers",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.DraftFromQuestionnaireRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "400": {
                        "description": "Invalid answers - VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "402": {
                        "description": "Suspended or trial-expired account, or the plan's agent limit is reached - TRIAL_EXPIRED, AGENT_LIMIT_REACHED, PLAN_LIMIT_REACHED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate or the wizard's own limit - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/drafts/from-website": {
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "The \"build from your website\" wizard's first step: reads that one page and returns the business facts it found (name, description, services, hours, phones, Q\u0026A, prices) plus suggested voice settings. It writes no prompt (name, prompt and greeting come back empty): pass the facts to POST /ext/agents/drafts/from-questionnaire, with fromWebsite: true, to have one written. Creates nothing. A paid model call: 5 drafts a minute per key creator, and it needs an active account with a free agent slot.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Agent drafts"
                ],
                "summary": "Draft an agent from a website",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    },
                    {
                        "description": "The site to read",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.DraftFromWebsiteRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "400": {
                        "description": "Missing or unusable URL - VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "402": {
                        "description": "Suspended or trial-expired account, or the plan's agent limit is reached - TRIAL_EXPIRED, AGENT_LIMIT_REACHED, PLAN_LIMIT_REACHED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate or the wizard's own limit - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Get detailed information about a specific agent (read-only)",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Agents"
                ],
                "summary": "Get agent",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.AgentResponse"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such resource in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            },
            "delete": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Soft delete, as in the dashboard: the agent disappears from every list and surface, while its calls, leads and knowledge stay on record. Refused while a phone number still routes to the agent — unbind it first (DELETE /ext/agents/{id}/phone-number), or callers to that number would reach an agent that no longer exists. Repeating a delete answers 404: treat it as done.",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Agents"
                ],
                "summary": "Delete an agent",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.AgentDeletedResponse"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "A phone number still routes to this agent - AGENT_HAS_PHONE_NUMBER, CONFLICT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "The rate-limit store could not answer, so the request fails closed - RATE_LIMIT_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            },
            "patch": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "tags": [
                    "Agents"
                ],
                "summary": "Update an agent",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent version for optimistic concurrency",
                        "name": "If-Match",
                        "in": "header"
                    },
                    {
                        "description": "Fields to change; absent fields are left alone",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.UpdateAgentRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.AgentDetailResponse"
                        }
                    },
                    "400": {
                        "description": "If-Match must be the integer agent version; an unknown model, a voice the model cannot speak, or an invalid webhook block - INVALID_IF_MATCH, INVALID_MODEL, VALIDATION_ERROR, INVALID_WEBHOOK_CONFIG",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key lacks the scope, or a reserved model this organization is not entitled to - INSUFFICIENT_SCOPE, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such resource in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "The agent changed between read and write; re-read and retry - VERSION_CONFLICT, AGENT_DELETED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "412": {
                        "description": "If-Match does not match the current version - VERSION_CONFLICT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "413": {
                        "description": "Request body over the size cap - BODY_TOO_LARGE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "422": {
                        "description": "An explicitly empty prompt is refused - INVALID_REQUEST",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours. Retry with the same Idempotency-Key; if it repeats, contact support - INTERNAL_ERROR, DB_ERROR, CREATE_FAILED, UPDATE_FAILED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "The idempotency or rate-limit store could not answer, so the request fails closed - IDEMPOTENCY_UNAVAILABLE, RATE_LIMIT_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/calendar": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Which calendar connection the agent books into, timezone, default duration, event type, buffer. Booking needs both this record's isEnabled and `calendarEnabled` in /config. An agent with nothing saved yet returns the defaults, with an empty id.",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Agent configuration"
                ],
                "summary": "Get calendar booking settings",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            },
            "put": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Any of calendarConnectionId, isEnabled, timezone, defaultDuration, eventTypeId, eventTypeSlug, bufferTime; absent keys are unchanged. The connection must belong to this organization (connections are made in the dashboard); \"\" detaches it.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Agent configuration"
                ],
                "summary": "Update calendar booking settings",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    },
                    {
                        "description": "Settings to change",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.CalendarSettingsRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "400": {
                        "description": "Malformed body, or a calendar connection of another organization - VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/config": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Every setting the dashboard's agent editor can change, keyed exactly as PATCH /ext/agents/{id}/config accepts them (camelCase, the platform's native agent schema). Credentials are write-only: `webhook.secret`, `calcomApiKey` and `googleChirpVoiceCloneKey` are always null here, and `secrets_configured` says whether each is set.",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Agent configuration"
                ],
                "summary": "Get an agent's full configuration",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.AgentConfigResponse"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            },
            "patch": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Send any subset of the keys GET /ext/agents/{id}/config returns; absent keys are left alone. The save runs the agent editor's own handler, so every rule the dashboard applies applies here. Like the editor, a plain-text setting sent as \"\" is left unchanged (those are listed back in `ignored_empty_fields`); to clear name/description/greeting use PATCH /ext/agents/{id}. Send If-Match with the version you read to refuse a lost update. Omit webhook.secret, calcomApiKey or googleChirpVoiceCloneKey (or send null) to keep the stored credential. Nested blocks (webhook, stageGraph, instructionsJson, dynamicVariables, customCaptureFields) are replaced whole; the turn-detection settings are completed from the stored agent, as the editor always sends them together.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Agent configuration"
                ],
                "summary": "Update an agent's configuration",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Agent version for optimistic concurrency",
                        "name": "If-Match",
                        "in": "header"
                    },
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    },
                    {
                        "description": "Settings to change (keys as in GET /ext/agents/{id}/config)",
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "type": "object"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.AgentConfigResponse"
                        }
                    },
                    "400": {
                        "description": "Unknown or read-only key, bad If-Match, or a value the editor's rules refuse - INVALID_REQUEST, UNKNOWN_FIELD, READ_ONLY_FIELD, INVALID_IF_MATCH, VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "402": {
                        "description": "Turning a tester back into an agent would exceed the plan's agent limit - AGENT_LIMIT_REACHED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, a reseller-wide key, a reserved model or number this account is not entitled to, or a transfer destination not permitted - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "Another write landed during this one; re-read and retry - VERSION_CONFLICT, IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "412": {
                        "description": "If-Match does not match the current version - VERSION_CONFLICT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "413": {
                        "description": "Request body over the size cap - BODY_TOO_LARGE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "422": {
                        "description": "This Idempotency-Key was already used with a different body - IDEMPOTENCY_KEY_REUSED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry with the same Idempotency-Key, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "The idempotency or rate-limit store could not answer, so the request fails closed - IDEMPOTENCY_UNAVAILABLE, RATE_LIMIT_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/duplicate": {
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "A full copy — every setting, the stage graph and the knowledge base — named \"\u003cname\u003e (Copy)\", unpublished, with no phone number. Counts against the plan's agent limit.",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Agents"
                ],
                "summary": "Duplicate an agent",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.AgentDetailResponse"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "402": {
                        "description": "Suspended or trial-expired account, or the plan's agent limit is reached - TRIAL_EXPIRED, AGENT_LIMIT_REACHED, PLAN_LIMIT_REACHED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, a reseller-wide key, or an agent on a reserved model this account cannot copy - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry with the same Idempotency-Key, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "The idempotency or rate-limit store could not answer, so the request fails closed - IDEMPOTENCY_UNAVAILABLE, RATE_LIMIT_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/integrations/gmail": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Integrations"
                ],
                "summary": "Get Gmail integration settings",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "400": {
                        "description": "Invalid agent id - VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            },
            "patch": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Any of default_subject, signature, enabled, require_confirmation (or their stored names default_email_subject, gmail_signature, gmail_enabled, gmail_require_confirmation); absent keys are kept. These are preferences shown in the dashboard; calls do not read them yet.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Integrations"
                ],
                "summary": "Update Gmail integration settings",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    },
                    {
                        "description": "Settings to change",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.GmailSettingsRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "400": {
                        "description": "Malformed body or invalid agent id - VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/integrations/google": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "The agent's Google settings: {\"config\": {...} or null, \"connected\": bool, \"google_email\"?}. The Google account itself is connected once in the dashboard (OAuth); a PATCH links the agent to it. During calls, the Sheets settings (spreadsheet_id, sheet_name) are used.",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Integrations"
                ],
                "summary": "Get Google integration settings",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "400": {
                        "description": "Invalid agent id - VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            },
            "patch": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Any of spreadsheet_id, sheet_name, calendar_id, enabled_tools, require_confirmation_for_delete; absent keys are kept. Answers with the stored config.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Integrations"
                ],
                "summary": "Update Google integration settings",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    },
                    {
                        "description": "Settings to change",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.GoogleSettingsRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "400": {
                        "description": "Malformed body or invalid agent id - VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/integrations/google-calendar": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Integrations"
                ],
                "summary": "Get Google Calendar integration settings",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "400": {
                        "description": "Invalid agent id - VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            },
            "patch": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Any of calendar_id, default_duration, reminders, send_invites, and enabled (or calendar_enabled); absent keys are kept. These are preferences shown in the dashboard; calls do not read them yet.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Integrations"
                ],
                "summary": "Update Google Calendar integration settings",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    },
                    {
                        "description": "Settings to change",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.GoogleCalendarSettingsRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "400": {
                        "description": "Malformed body or invalid agent id - VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/integrations/hubspot": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Integrations"
                ],
                "summary": "Get HubSpot integration settings",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "400": {
                        "description": "Invalid agent id - VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            },
            "patch": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Any of sync_contacts, sync_calls, create_deals, default_deal_stage, default_deal_pipeline, contact_owner_id; absent keys are kept. The HubSpot account is connected in the dashboard. These are preferences shown in the dashboard; calls do not read them yet.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Integrations"
                ],
                "summary": "Update HubSpot integration settings",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    },
                    {
                        "description": "Settings to change",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.HubSpotSettingsRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "400": {
                        "description": "Malformed body or invalid agent id - VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/integrations/salesforce": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Integrations"
                ],
                "summary": "Get Salesforce integration settings",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "400": {
                        "description": "Invalid agent id - VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            },
            "patch": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Any of sync_leads, sync_contacts, create_opportunities, default_lead_status, default_opportunity_stage, record_type_id, owner_id; absent keys are kept. The Salesforce account is connected in the dashboard. These are preferences shown in the dashboard; calls do not read them yet.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Integrations"
                ],
                "summary": "Update Salesforce integration settings",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    },
                    {
                        "description": "Settings to change",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.SalesforceSettingsRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "400": {
                        "description": "Malformed body or invalid agent id - VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/knowledge": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "tags": [
                    "Knowledge"
                ],
                "summary": "List an agent's knowledge sources",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ListResponse"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such resource in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            },
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "tags": [
                    "Knowledge"
                ],
                "summary": "Add knowledge to an agent",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    },
                    {
                        "description": "A text or URL source",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.CreateKnowledgeRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.CreateKnowledgeResponse"
                        }
                    },
                    "400": {
                        "description": "Malformed body, failed field validation, or an unsupported VoiceMatrix-Version - VALIDATION_ERROR, INVALID_REQUEST, INVALID_API_VERSION, UNSUPPORTED_API_VERSION",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such resource in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "A source with this title already exists on the agent - KNOWLEDGE_SOURCE_EXISTS",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "413": {
                        "description": "Request body over the size cap - BODY_TOO_LARGE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "422": {
                        "description": "The content guard refused the document - KNOWLEDGE_REJECTED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours. Retry with the same Idempotency-Key; if it repeats, contact support - INTERNAL_ERROR, DB_ERROR, CREATE_FAILED, UPDATE_FAILED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "Ingestion is off because the embedding service is not configured here - KNOWLEDGE_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/knowledge/files": {
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Multipart upload in form field `file`: .pdf, .txt, .docx, .csv, .json or .md, up to 10 MB, within the organization's knowledge quota. The file's name becomes its title. A name that already exists for this agent is refused (409 KNOWLEDGE_DOCUMENT_EXISTS): to replace a document, delete it, then upload the new version. Text files must be UTF-8 (400 INVALID_FILE_ENCODING); Hebrew sources should be UTF-8 .txt, since PDF extraction reverses right-to-left text. Synchronous: answers once every chunk is embedded. With an Idempotency-Key the whole request must fit in 1 MiB.",
                "consumes": [
                    "multipart/form-data"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Knowledge"
                ],
                "summary": "Upload a knowledge file",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "file",
                        "description": "The document",
                        "name": "file",
                        "in": "formData",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "400": {
                        "description": "No file, an unsupported file type, a file that is not UTF-8 text, or one that yields no text - VALIDATION_ERROR, INVALID_FILE_ENCODING, FILE_TOO_LARGE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "A document with this name, or this exact content, already exists for the agent; or the Idempotency-Key is in flight - KNOWLEDGE_DOCUMENT_EXISTS, IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "413": {
                        "description": "With an Idempotency-Key, a request over 1 MiB - BODY_TOO_LARGE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate, or over the organization's knowledge quota - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours, including an embedding failure; list the knowledge before retrying, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "Idempotency store unavailable - IDEMPOTENCY_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/knowledge/query": {
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "The Knowledge tab's test search: the nearest chunks to the query (default 5), each with its document name and position. There is no relevance cut-off. For an agent with a stage graph, pass stage to search as that stage does; without it only documents visible in every stage are searched.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Knowledge"
                ],
                "summary": "Search an agent's knowledge",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "What to search for",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.KnowledgeQueryRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "400": {
                        "description": "Missing query - VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours, including an embedding failure; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/knowledge/stages": {
            "put": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Limits a document to some stages of the agent's stageGraph (at most 12 stage ids); an empty list makes it visible in every stage. The Knowledge tab's per-stage picker.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Knowledge"
                ],
                "summary": "Set which stages see a knowledge document",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    },
                    {
                        "description": "The document and its stages",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.KnowledgeStagesRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "400": {
                        "description": "Missing filename or an invalid stage list - VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent or document - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/knowledge/{title}": {
            "delete": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "tags": [
                    "Knowledge"
                ],
                "summary": "Remove a knowledge source from an agent",
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Malformed body, failed field validation, or an unsupported VoiceMatrix-Version - VALIDATION_ERROR, INVALID_REQUEST, INVALID_API_VERSION, UNSUPPORTED_API_VERSION",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such resource in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "413": {
                        "description": "Request body over the size cap - BODY_TOO_LARGE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "422": {
                        "description": "This Idempotency-Key was already used with a different body - IDEMPOTENCY_KEY_REUSED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours. Retry with the same Idempotency-Key; if it repeats, contact support - INTERNAL_ERROR, DB_ERROR, CREATE_FAILED, UPDATE_FAILED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "The idempotency or rate-limit store could not answer, so the request fails closed - IDEMPOTENCY_UNAVAILABLE, RATE_LIMIT_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/phone-number": {
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "tags": [
                    "PhoneNumbers"
                ],
                "summary": "Bind a phone number to an agent",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    },
                    {
                        "description": "The number to bind",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.BindPhoneNumberRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.BindPhoneNumberResponse"
                        }
                    },
                    "400": {
                        "description": "Malformed body, failed field validation, or an unsupported VoiceMatrix-Version - VALIDATION_ERROR, INVALID_REQUEST, INVALID_API_VERSION, UNSUPPORTED_API_VERSION",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such resource in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "That number is bound to another agent; unbind it first - PHONE_NUMBER_ALREADY_BOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "413": {
                        "description": "Request body over the size cap - BODY_TOO_LARGE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "422": {
                        "description": "This Idempotency-Key was already used with a different body - IDEMPOTENCY_KEY_REUSED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours. Retry with the same Idempotency-Key; if it repeats, contact support - INTERNAL_ERROR, DB_ERROR, CREATE_FAILED, UPDATE_FAILED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "The idempotency or rate-limit store could not answer, so the request fails closed - IDEMPOTENCY_UNAVAILABLE, RATE_LIMIT_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            },
            "delete": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "tags": [
                    "PhoneNumbers"
                ],
                "summary": "Unbind an agent's phone number",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.BindPhoneNumberResponse"
                        }
                    },
                    "400": {
                        "description": "Malformed body, failed field validation, or an unsupported VoiceMatrix-Version - VALIDATION_ERROR, INVALID_REQUEST, INVALID_API_VERSION, UNSUPPORTED_API_VERSION",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such resource in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "413": {
                        "description": "Request body over the size cap - BODY_TOO_LARGE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "422": {
                        "description": "This Idempotency-Key was already used with a different body - IDEMPOTENCY_KEY_REUSED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours. Retry with the same Idempotency-Key; if it repeats, contact support - INTERNAL_ERROR, DB_ERROR, CREATE_FAILED, UPDATE_FAILED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "The idempotency or rate-limit store could not answer, so the request fails closed - IDEMPOTENCY_UNAVAILABLE, RATE_LIMIT_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/publish": {
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "tags": [
                    "Agents"
                ],
                "summary": "Publish an agent",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.PublishResponse"
                        }
                    },
                    "400": {
                        "description": "Malformed body, failed field validation, or an unsupported VoiceMatrix-Version - VALIDATION_ERROR, INVALID_REQUEST, INVALID_API_VERSION, UNSUPPORTED_API_VERSION",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such resource in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "413": {
                        "description": "Request body over the size cap - BODY_TOO_LARGE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "422": {
                        "description": "The agent has no usable prompt, so it cannot be published - AGENT_NOT_PUBLISHABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours. Retry with the same Idempotency-Key; if it repeats, contact support - INTERNAL_ERROR, DB_ERROR, CREATE_FAILED, UPDATE_FAILED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "The idempotency or rate-limit store could not answer, so the request fails closed - IDEMPOTENCY_UNAVAILABLE, RATE_LIMIT_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/security": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "The Security page: the latest test-suite run and a short history. `neverScanned: true` means no run exists — not a clean result.",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Security"
                ],
                "summary": "Security and behaviour test results",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/security/scan": {
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Queues a run (202); poll GET /ext/agents/{id}/security until the run has finishedAt. Requires the agents:test scope: each run is dozens of paid model calls. Suites: behaviour, security, persona (default behaviour and security). One run per agent at a time: a second request while one runs answers 409 with the running id. While the test runner has not checked in for 15 minutes it answers 503 SECURITY_TESTS_UNAVAILABLE instead of queueing a run that would not start; GET /ext/agents/{id}/security reports runnerAvailable.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Security"
                ],
                "summary": "Run the security and behaviour tests",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    },
                    {
                        "description": "Optional suites and scope",
                        "name": "request",
                        "in": "body",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.SecurityScanRequest"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Accepted",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "400": {
                        "description": "An unknown suite name - VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "A run is already in progress for this agent, or the Idempotency-Key is in flight - CONFLICT, IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "The test runner has not checked in recently, so a run would not start - SECURITY_TESTS_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/share-link": {
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "The editor's Share button: {\"ttl\": seconds}, default 24 hours; a longer ttl is capped at 30 days, not refused. Returns the URL and its expiry. Anyone holding the link can talk to the agent in a browser until it expires, billed to this account. It works only while the agent is published, and it cannot be revoked early.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Agents"
                ],
                "summary": "Create a share link",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    },
                    {
                        "description": "Optional lifetime",
                        "name": "request",
                        "in": "body",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ShareLinkRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/simulations": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "The Simulation page's list: the agent's 50 newest scored runs (an AI caller talks to the agent through the real voice stack and a model grades the transcript against goals), plus publish (whether a passing run, score 70 or more on the current prompt, exists), usageToday and hasTester.",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Simulations"
                ],
                "summary": "List simulation runs",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            },
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Queues a scored test call, the Simulation page's \"Run\" (202). Create the tester first (POST /ext/agents/{id}/tester). Poll GET /ext/agents/{id}/simulations/{sid} until status is completed or failed; a run usually takes 2-6 minutes. It runs on the real voice stack but is not billed as a call; it counts toward the organization's daily allowance (20 runs and 3600 seconds per UTC day), and at most 3 runs per agent can be queued at once. Refused for an account that may not place calls. A passing run (score 70+) is what lets a draft agent be published.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Simulations"
                ],
                "summary": "Run a simulation",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    },
                    {
                        "description": "Optional persona, goals and tester",
                        "name": "request",
                        "in": "body",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.SimulationRunRequest"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Accepted",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "400": {
                        "description": "Invalid options - VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, a reseller-wide key, or an account that may not place calls - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, SERVICE_SUSPENDED, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent, no tester yet, or an unknown persona - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "Three runs are already queued or running for this agent, or the Idempotency-Key is in flight - CONFLICT, IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate or the day's simulation allowance - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry with the same Idempotency-Key, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "Simulation service or idempotency store unavailable - SERVICE_UNAVAILABLE, IDEMPOTENCY_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/simulations/personas": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Simulations"
                ],
                "summary": "List simulation personas",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/simulations/{sid}": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "One run: status (queued, running, completed or failed), score (0-100, when scored) and report (per-goal verdicts with evidence, summary, both transcripts). complete is true once it finished without error.",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Simulations"
                ],
                "summary": "Get a simulation run",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Simulation run ID",
                        "name": "sid",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent or run in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/stats": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "All-time call statistics for the agent, simulations included: {\"stats\": {\"totalCalls\", \"completedCalls\", \"failedCalls\", \"totalDuration\" (seconds), \"avgDuration\" (seconds, completed calls), \"totalTokens\" (VoiceMatrix tokens, the sum of each call's tokens)}}.",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Agents"
                ],
                "summary": "Agent call statistics",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/tester": {
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "The Simulation page's \"build a tester\": an agent aimed at this one that phones it and plays a persona. One per agent: 201 when it is created, 200 with the existing one after that. Testers never answer real calls and hold no plan slot; they do appear in GET /ext/agents, with status \"testing\".",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Simulations"
                ],
                "summary": "Create a simulation tester",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    },
                    {
                        "description": "Optional persona and name",
                        "name": "request",
                        "in": "body",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.TesterRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The agent's existing tester",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "201": {
                        "description": "Tester created",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "400": {
                        "description": "The agent cannot be tested (it is itself a tester) - VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/unpublish": {
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "tags": [
                    "Agents"
                ],
                "summary": "Unpublish an agent",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.PublishResponse"
                        }
                    },
                    "400": {
                        "description": "Malformed body, failed field validation, or an unsupported VoiceMatrix-Version - VALIDATION_ERROR, INVALID_REQUEST, INVALID_API_VERSION, UNSUPPORTED_API_VERSION",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such resource in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "413": {
                        "description": "Request body over the size cap - BODY_TOO_LARGE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "422": {
                        "description": "This Idempotency-Key was already used with a different body - IDEMPOTENCY_KEY_REUSED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours. Retry with the same Idempotency-Key; if it repeats, contact support - INTERNAL_ERROR, DB_ERROR, CREATE_FAILED, UPDATE_FAILED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "The idempotency or rate-limit store could not answer, so the request fails closed - IDEMPOTENCY_UNAVAILABLE, RATE_LIMIT_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/usage": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "The Analytics tab's usage card for this agent: calls, LLM tokens, TTS characters, STT seconds, and the VoiceMatrix tokens charged (totalTokens, averageTokensPerCall). Optional startDate and endDate in RFC 3339 (2026-10-01T00:00:00Z); an unparseable value is ignored.",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Agents"
                ],
                "summary": "Agent usage summary",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "From (RFC 3339)",
                        "name": "startDate",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "description": "To (RFC 3339)",
                        "name": "endDate",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/usage/daily": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "The Analytics tab's daily chart: one row per day that had calls, newest first. days defaults to 30; a non-number counts as 30.",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Agents"
                ],
                "summary": "Agent usage per day",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "integer",
                        "default": 30,
                        "description": "Days back",
                        "name": "days",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED, FORBIDDEN",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/webhook-logs": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Recent deliveries of the agent's own webhook (settings `webhook`: call_start enrichment and call_end), newest first, with what was sent, status and timing. The Tools tab's log; test requests are not logged. Not the outbound event webhooks (GET /ext/webhooks/{id}/deliveries). A logged call_end carries the call's transcript, so this needs calls:read as well as webhooks:manage.",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Agent configuration"
                ],
                "summary": "Call-enrichment webhook log",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "integer",
                        "default": 50,
                        "description": "Rows, 1-100",
                        "name": "limit",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "default": 0,
                        "description": "Rows to skip",
                        "name": "offset",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "Missing scope, or a reseller-wide key - INSUFFICIENT_SCOPE, ORGANIZATION_REQUIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/agents/{id}/webhook/test": {
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Sends the same signed test request the Tools tab's Test button sends. Body optional: {\"url\", \"secret\", \"timeout_ms\"}; anything omitted comes from the agent's saved `webhook` settings, so an empty body tests what is saved. Answers 200 with success=false when the endpoint is unreachable or answers non-2xx — the test ran; the endpoint failed it.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Agent configuration"
                ],
                "summary": "Test the call-enrichment webhook",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Overrides for this one test; empty tests what is saved",
                        "name": "request",
                        "in": "body",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.EnrichmentWebhookTestRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.EnrichmentWebhookTestResponse"
                        }
                    },
                    "400": {
                        "description": "No URL to test, or a URL that resolves to a private or internal address - VALIDATION_ERROR, INVALID_WEBHOOK_URL",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such agent in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours; retry, and contact support if it repeats - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/calls": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Get paginated list of calls",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Calls"
                ],
                "summary": "List calls",
                "parameters": [
                    {
                        "type": "integer",
                        "default": 20,
                        "description": "Limit",
                        "name": "limit",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "default": 0,
                        "description": "Offset",
                        "name": "offset",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "description": "Status filter",
                        "name": "status",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "description": "Direction filter",
                        "name": "direction",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "description": "Agent ID filter",
                        "name": "agent_id",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ListResponse"
                        }
                    },
                    "400": {
                        "description": "Malformed body, failed field validation, or an unsupported VoiceMatrix-Version - VALIDATION_ERROR, INVALID_REQUEST, INVALID_API_VERSION, UNSUPPORTED_API_VERSION",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            },
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Place an outbound call: the agent is dispatched and dials the number. 201 means the dial was started (status \"initiating\"); a dial the telephony layer refuses answers 502 and the call is recorded as failed.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Calls"
                ],
                "summary": "Create outbound call",
                "parameters": [
                    {
                        "description": "Call request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.CreateCallRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.CreateCallResponse"
                        }
                    },
                    "400": {
                        "description": "Bad number, unusable agent, or failed validation - INVALID_PHONE, AGENT_NOT_FOUND, VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "402": {
                        "description": "The organization's plan or outbound budget refuses the call - SUBSCRIPTION_REQUIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key lacks the scope, or the destination is refused (country allowlist, organization blocked list) - INSUFFICIENT_SCOPE, country_not_allowed, NUMBER_BLOCKED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "Idempotency-Key in flight, a call to this number from this agent started in the last 30s (details.existing_call_id), or the agent is an unpublished draft - IDEMPOTENCY_KEY_IN_FLIGHT, DUPLICATE_CALL, AGENT_NOT_PUBLISHED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "413": {
                        "description": "Request body over the size cap - BODY_TOO_LARGE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "422": {
                        "description": "This Idempotency-Key was already used with a different body - IDEMPOTENCY_KEY_REUSED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate or its daily outbound allowance - RATE_LIMIT_EXCEEDED, DAILY_CALL_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "The call record could not be created - CALL_FAILED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "502": {
                        "description": "The telephony layer refused the call; it is recorded as failed (details.call_id) and quota is returned - CALL_DISPATCH_FAILED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "A pre-dial check could not answer or this deployment cannot dial, so no spend is committed - QUOTA_UNAVAILABLE, CALL_CHECK_UNAVAILABLE, DIALER_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/calls/{id}": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Get detailed information about a specific call",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Calls"
                ],
                "summary": "Get call details",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Call ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.CallDetailResponse"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such resource in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/calls/{id}/hangup": {
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "tags": [
                    "Calls"
                ],
                "summary": "Hang up a live call",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.HangupResponse"
                        }
                    },
                    "400": {
                        "description": "Malformed body, failed field validation, or an unsupported VoiceMatrix-Version - VALIDATION_ERROR, INVALID_REQUEST, INVALID_API_VERSION, UNSUPPORTED_API_VERSION",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such resource in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "413": {
                        "description": "Request body over the size cap - BODY_TOO_LARGE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "422": {
                        "description": "This Idempotency-Key was already used with a different body - IDEMPOTENCY_KEY_REUSED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "502": {
                        "description": "The media layer refused the teardown; teardown_ok is false - TEARDOWN_FAILED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "Hangup requested but LiveKit is not configured on this deployment - TEARDOWN_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/leads": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Get paginated list of leads",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Leads"
                ],
                "summary": "List leads",
                "parameters": [
                    {
                        "type": "integer",
                        "default": 20,
                        "description": "Limit",
                        "name": "limit",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "default": 0,
                        "description": "Offset",
                        "name": "offset",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "description": "Status filter",
                        "name": "status",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "description": "Agent ID filter",
                        "name": "agent_id",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ListResponse"
                        }
                    },
                    "400": {
                        "description": "Malformed body, failed field validation, or an unsupported VoiceMatrix-Version - VALIDATION_ERROR, INVALID_REQUEST, INVALID_API_VERSION, UNSUPPORTED_API_VERSION",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            },
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Create a new lead",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Leads"
                ],
                "summary": "Create lead",
                "parameters": [
                    {
                        "description": "Lead request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.CreateLeadRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.LeadResponse"
                        }
                    },
                    "400": {
                        "description": "agent_id is required and must name an agent you can use - VALIDATION_ERROR, AGENT_NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "413": {
                        "description": "Request body over the size cap - BODY_TOO_LARGE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "422": {
                        "description": "This Idempotency-Key was already used with a different body - IDEMPOTENCY_KEY_REUSED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours. Retry with the same Idempotency-Key; if it repeats, contact support - INTERNAL_ERROR, DB_ERROR, CREATE_FAILED, UPDATE_FAILED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "The idempotency or rate-limit store could not answer, so the request fails closed - IDEMPOTENCY_UNAVAILABLE, RATE_LIMIT_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/leads/{id}": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Get detailed information about a specific lead",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Leads"
                ],
                "summary": "Get lead",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Lead ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.LeadResponse"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such resource in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            },
            "patch": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Update an existing lead",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Leads"
                ],
                "summary": "Update lead",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Lead ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Update request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.UpdateLeadRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.LeadResponse"
                        }
                    },
                    "400": {
                        "description": "Malformed body, failed field validation, or an unsupported VoiceMatrix-Version - VALIDATION_ERROR, INVALID_REQUEST, INVALID_API_VERSION, UNSUPPORTED_API_VERSION",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such resource in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "413": {
                        "description": "Request body over the size cap - BODY_TOO_LARGE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "422": {
                        "description": "This Idempotency-Key was already used with a different body - IDEMPOTENCY_KEY_REUSED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours. Retry with the same Idempotency-Key; if it repeats, contact support - INTERNAL_ERROR, DB_ERROR, CREATE_FAILED, UPDATE_FAILED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "The idempotency or rate-limit store could not answer, so the request fails closed - IDEMPOTENCY_UNAVAILABLE, RATE_LIMIT_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/me": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "tags": [
                    "Introspection"
                ],
                "summary": "Describe the current API key",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.MeResponse"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/phone-numbers": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "tags": [
                    "PhoneNumbers"
                ],
                "summary": "List phone numbers",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ListResponse"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            },
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "tags": [
                    "PhoneNumbers"
                ],
                "summary": "Acquire a phone number",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    },
                    {
                        "description": "Country to acquire in",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.AcquirePhoneNumberRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.AcquirePhoneNumberResponse"
                        }
                    },
                    "400": {
                        "description": "Unsupported country for self-serve acquisition - COUNTRY_NOT_SUPPORTED, VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "402": {
                        "description": "Acquisition needs a paid plan, or the self-serve pool is exhausted - SUBSCRIPTION_REQUIRED, PLATFORM_NUMBER_CAPACITY_REACHED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "The organization already holds its included number - ORG_NUMBER_LIMIT_REACHED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "413": {
                        "description": "Request body over the size cap - BODY_TOO_LARGE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "422": {
                        "description": "This Idempotency-Key was already used with a different body - IDEMPOTENCY_KEY_REUSED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours - INTERNAL_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "502": {
                        "description": "The carrier refused or failed the purchase - PROVIDER_ERROR, PROVIDER_PURCHASE_FAILED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "Self-serve acquisition is disabled here, or no inventory is available - ACQUISITION_DISABLED, NO_NUMBERS_AVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/studio/films": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "tags": [
                    "Studio"
                ],
                "summary": "List films",
                "parameters": [
                    {
                        "type": "integer",
                        "description": "Maximum films, newest first; default 20, capped at 50",
                        "name": "limit",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.StudioFilmsResponse"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key lacks studio:read, or was not issued by the account owner - INSUFFICIENT_SCOPE, FORBIDDEN_ROLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            },
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Studio's orchestrator writes the script, casts the main character, shoots each scene, narrates in Hebrew or English, adds music and edits one MP4. The whole film is reserved from the organization's Studio allowance (a free monthly allowance unless the organization has its own Studio budget) before any work starts; the customer is not charged. Answers at once; poll GET /ext/studio/films/{id} (films take about 5-10 minutes).",
                "tags": [
                    "Studio"
                ],
                "summary": "Make a film",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Retry-safe key",
                        "name": "Idempotency-Key",
                        "in": "header"
                    },
                    {
                        "description": "The film",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/voicematrix_internal_studioapi.FilmRequest"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Accepted",
                        "schema": {
                            "$ref": "#/definitions/voicematrix_internal_studioapi.Film"
                        }
                    },
                    "400": {
                        "description": "A missing brief, a length other than 24/36/48, an unknown format or engine - INVALID_INPUT, MODEL_UNAVAILABLE, INVALID_REQUEST",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "402": {
                        "description": "The film does not fit what is left of the organization's Studio allowance this month - ALLOWANCE_EXHAUSTED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key lacks studio:write or was not issued by the account owner, or Studio is off for the organization - INSUFFICIENT_SCOPE, FORBIDDEN_ROLE, STUDIO_NOT_ENABLED, STUDIO_PAUSED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "The idempotency key was used for another request, or the price moved while the film was set up; retry - STATE_CONFLICT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate, or the organization's daily Studio limit - RATE_LIMIT_EXCEEDED, DAILY_LIMIT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "Studio cannot make films here now, or this month's free films are all taken - NOT_CONFIGURED, FREE_POOL_EXHAUSTED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/studio/films/{id}": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Status, progress, the narration once written, and — once done — a signed link to the MP4 and a preview image. Links expire after about 24 hours; read the film again for fresh ones.",
                "tags": [
                    "Studio"
                ],
                "summary": "Get a film",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Film id",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/voicematrix_internal_studioapi.Film"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key lacks studio:read, or was not issued by the account owner - INSUFFICIENT_SCOPE, FORBIDDEN_ROLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such film in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/studio/options": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Film lengths, formats, languages, narrator voices, video engines (Gemini Omni, Veo, and open models such as MiniMax H3 where enabled), what a film of each length costs in VoiceMatrix tokens, and the organization's Studio allowance this month.",
                "tags": [
                    "Studio"
                ],
                "summary": "What Studio can make",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/voicematrix_internal_studioapi.Options"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key lacks studio:read, or was not issued by the account owner - INSUFFICIENT_SCOPE, FORBIDDEN_ROLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "Studio is not available on this server - NOT_CONFIGURED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/webhooks": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Get all webhooks for the authenticated user",
                "tags": [
                    "Webhooks"
                ],
                "summary": "List webhooks",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.WebhookListResponse"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            },
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Create a new webhook subscription",
                "tags": [
                    "Webhooks"
                ],
                "summary": "Create webhook",
                "parameters": [
                    {
                        "description": "Webhook configuration",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.CreateWebhookRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.WebhookResponse"
                        }
                    },
                    "400": {
                        "description": "Unknown event, an SSRF-blocked or malformed url, or an agent_id you cannot use - INVALID_EVENT, INVALID_WEBHOOK_URL, INVALID_AGENT, VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "413": {
                        "description": "Request body over the size cap - BODY_TOO_LARGE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "422": {
                        "description": "This Idempotency-Key was already used with a different body - IDEMPOTENCY_KEY_REUSED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours. Retry with the same Idempotency-Key; if it repeats, contact support - INTERNAL_ERROR, DB_ERROR, CREATE_FAILED, UPDATE_FAILED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "The idempotency or rate-limit store could not answer, so the request fails closed - IDEMPOTENCY_UNAVAILABLE, RATE_LIMIT_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/webhooks/events": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Get all available webhook events",
                "tags": [
                    "Webhooks"
                ],
                "summary": "List webhook events",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.WebhookEventsResponse"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/webhooks/{id}": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Get webhook details by ID",
                "tags": [
                    "Webhooks"
                ],
                "summary": "Get webhook",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Webhook ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.WebhookResponse"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such resource in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            },
            "delete": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Delete a webhook subscription",
                "tags": [
                    "Webhooks"
                ],
                "summary": "Delete webhook",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Webhook ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Malformed body, failed field validation, or an unsupported VoiceMatrix-Version - VALIDATION_ERROR, INVALID_REQUEST, INVALID_API_VERSION, UNSUPPORTED_API_VERSION",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such resource in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "413": {
                        "description": "Request body over the size cap - BODY_TOO_LARGE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "422": {
                        "description": "This Idempotency-Key was already used with a different body - IDEMPOTENCY_KEY_REUSED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours. Retry with the same Idempotency-Key; if it repeats, contact support - INTERNAL_ERROR, DB_ERROR, CREATE_FAILED, UPDATE_FAILED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "The idempotency or rate-limit store could not answer, so the request fails closed - IDEMPOTENCY_UNAVAILABLE, RATE_LIMIT_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            },
            "patch": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Update webhook configuration",
                "tags": [
                    "Webhooks"
                ],
                "summary": "Update webhook",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Webhook ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Updates",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.UpdateWebhookRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.WebhookResponse"
                        }
                    },
                    "400": {
                        "description": "Unknown event or an SSRF-blocked url - INVALID_EVENT, INVALID_WEBHOOK_URL, VALIDATION_ERROR",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such resource in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "413": {
                        "description": "Request body over the size cap - BODY_TOO_LARGE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "422": {
                        "description": "This Idempotency-Key was already used with a different body - IDEMPOTENCY_KEY_REUSED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours. Retry with the same Idempotency-Key; if it repeats, contact support - INTERNAL_ERROR, DB_ERROR, CREATE_FAILED, UPDATE_FAILED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "The idempotency or rate-limit store could not answer, so the request fails closed - IDEMPOTENCY_UNAVAILABLE, RATE_LIMIT_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/webhooks/{id}/deliveries": {
            "get": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Get delivery history for a webhook",
                "tags": [
                    "Webhooks"
                ],
                "summary": "Get webhook deliveries",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Webhook ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "integer",
                        "description": "Limit (default 20)",
                        "name": "limit",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "description": "Offset",
                        "name": "offset",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/definitions/internal_publicapi.ListResponse"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/definitions/internal_publicapi.WebhookDeliveryResponse"
                                            }
                                        }
                                    }
                                }
                            ]
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such resource in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        },
        "/ext/webhooks/{id}/test": {
            "post": {
                "security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "description": "Send a test event to the webhook",
                "tags": [
                    "Webhooks"
                ],
                "summary": "Test webhook",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Webhook ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Test event type",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.TestWebhookRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.TestWebhookResponse"
                        }
                    },
                    "400": {
                        "description": "Malformed body, failed field validation, or an unsupported VoiceMatrix-Version - VALIDATION_ERROR, INVALID_REQUEST, INVALID_API_VERSION, UNSUPPORTED_API_VERSION",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "401": {
                        "description": "Missing, malformed, unknown, revoked or expired key - MISSING_API_KEY, INVALID_API_KEY_FORMAT, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "403": {
                        "description": "The key is valid but lacks the scope this route requires - INSUFFICIENT_SCOPE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "404": {
                        "description": "No such resource in this organization - NOT_FOUND",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "409": {
                        "description": "This Idempotency-Key is still in flight - IDEMPOTENCY_KEY_IN_FLIGHT",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "413": {
                        "description": "Request body over the size cap - BODY_TOO_LARGE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "422": {
                        "description": "This Idempotency-Key was already used with a different body - IDEMPOTENCY_KEY_REUSED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "429": {
                        "description": "Over the key's request rate; honour Retry-After - RATE_LIMIT_EXCEEDED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "500": {
                        "description": "Ours. Retry with the same Idempotency-Key; if it repeats, contact support - INTERNAL_ERROR, DB_ERROR, CREATE_FAILED, UPDATE_FAILED",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    },
                    "503": {
                        "description": "The idempotency or rate-limit store could not answer, so the request fails closed - IDEMPOTENCY_UNAVAILABLE, RATE_LIMIT_UNAVAILABLE",
                        "schema": {
                            "$ref": "#/definitions/internal_publicapi.ErrorEnvelope"
                        }
                    }
                }
            }
        }
    },
    "definitions": {
    "voicematrix_internal_carriers.ImportedNumber": {
        "type": "object",
        "properties": {
            "carrier_connection_id": {
                "type": "string"
            },
            "id": {
                "type": "string"
            },
            "phone_number": {
                "type": "string"
            },
            "status": {
                "type": "string"
            }
        }
    },
    "internal_publicapi.ImportCarrierNumberRequest": {
        "type": "object",
        "required": [
            "phone_number"
        ],
        "properties": {
            "phone_number": {
                "type": "string"
            }
        }
    },
    "internal_publicapi.CarrierResponse": {
        "type": "object",
        "properties": {
            "approved_at": {
                "type": "string"
            },
            "created_at": {
                "type": "string"
            },
            "id": {
                "type": "string"
            },
            "label": {
                "type": "string"
            },
            "max_concurrent_calls": {
                "type": "integer"
            },
            "organization_id": {
                "type": "string"
            },
            "provider": {
                "type": "string"
            },
            "status": {
                "type": "string"
            },
            "status_reason": {
                "type": "string"
            },
            "updated_at": {
                "type": "string"
            }
        }
    },
    "voicematrix_internal_carriers.Credentials": {
        "type": "object",
        "properties": {
            "account_sid": {
                "type": "string"
            },
            "api_key": {
                "type": "string"
            },
            "auth_password": {
                "type": "string"
            },
            "auth_token": {
                "type": "string"
            },
            "auth_username": {
                "type": "string"
            },
            "outbound_address": {
                "type": "string"
            },
            "transport": {
                "type": "string"
            }
        }
    },
    "voicematrix_internal_carriers.CreateRequest": {
        "type": "object",
        "required": [
            "credentials",
            "label",
            "provider"
        ],
        "properties": {
            "credentials": {
                "$ref": "#/definitions/voicematrix_internal_carriers.Credentials"
            },
            "inbound_allowed_cidrs": {
                "type": "array",
                "items": {
                    "type": "string"
                }
            },
            "label": {
                "type": "string",
                "maxLength": 100
            },
            "provider": {
                "type": "string",
                "enum": [
                    "twilio",
                    "telnyx",
                    "sip"
                ]
            }
        }
    },
        "internal_publicapi.APIError": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "string"
                },
                "details": {},
                "fields": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/internal_publicapi.FieldError"
                    }
                },
                "hint": {
                    "type": "string"
                },
                "message": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.AcquirePhoneNumberRequest": {
            "type": "object",
            "required": [
                "country"
            ],
            "properties": {
                "country": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.AcquirePhoneNumberResponse": {
            "type": "object",
            "properties": {
                "bound": {
                    "description": "always false — bind it explicitly",
                    "type": "boolean"
                },
                "country": {
                    "type": "string"
                },
                "hint": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "phone_number": {
                    "type": "string"
                },
                "source": {
                    "description": "\"pool\" | \"purchased\"",
                    "type": "string"
                }
            }
        },
        "internal_publicapi.AgentBrief": {
            "type": "object",
            "properties": {
                "id": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.AgentConfigResponse": {
            "type": "object",
            "properties": {
                "config": {
                    "description": "Config holds every writable setting; a setting with no stored value is null.",
                    "type": "object",
                    "additionalProperties": true
                },
                "id": {
                    "type": "string"
                },
                "ignored_empty_fields": {
                    "description": "IgnoredEmptyFields names plain-text settings this PATCH sent as \"\" over a stored value. The\neditor's save treats \"\" there as \"unchanged\", so they were NOT cleared.",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "name": {
                    "type": "string"
                },
                "published": {
                    "type": "boolean"
                },
                "secrets_configured": {
                    "description": "SecretsConfigured says whether each write-only credential is stored (\"webhook.secret\",\n\"calcomApiKey\"). Config renders those as null whatever their value.",
                    "type": "object",
                    "additionalProperties": {
                        "type": "boolean"
                    }
                },
                "status": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                },
                "version": {
                    "type": "integer"
                },
                "warnings": {
                    "description": "Warnings are outbound webhooks this save left unable to fire (a capture field their\ncondition requires is gone). Advisory: the save itself succeeded.",
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/internal_publicapi.CaptureCoverageWarning"
                    }
                }
            }
        },
        "internal_publicapi.AgentDeletedResponse": {
            "type": "object",
            "properties": {
                "deleted": {
                    "type": "boolean"
                },
                "id": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.AgentDetailResponse": {
            "type": "object",
            "properties": {
                "created_at": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "greeting": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "language": {
                    "type": "string"
                },
                "model": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "phone_number": {
                    "type": "string"
                },
                "prompt": {
                    "type": "string"
                },
                "published": {
                    "type": "boolean"
                },
                "status": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                },
                "version": {
                    "type": "integer"
                },
                "voice": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.AgentResponse": {
            "type": "object",
            "properties": {
                "created_at": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "is_active": {
                    "type": "boolean"
                },
                "language": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "phone_number": {
                    "description": "PhoneNumber is the first number that routes calls to the agent; PhoneNumbers lists them all.",
                    "type": "string"
                },
                "phone_numbers": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "status": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.BindPhoneNumberRequest": {
            "type": "object",
            "required": [
                "phone_number_id"
            ],
            "properties": {
                "phone_number_id": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.BindPhoneNumberResponse": {
            "type": "object",
            "properties": {
                "agent_id": {
                    "type": "string"
                },
                "phone_number": {
                    "type": "string"
                },
                "routing_live": {
                    "type": "boolean"
                },
                "warning": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.CalendarSettingsRequest": {
            "type": "object",
            "properties": {
                "bufferTime": {
                    "description": "Minutes between bookings.",
                    "type": "integer",
                    "example": 10
                },
                "calendarConnectionId": {
                    "description": "A calendar connection of this organization (connected in the dashboard). \"\" detaches it.",
                    "type": "string"
                },
                "defaultDuration": {
                    "description": "Minutes.",
                    "type": "integer",
                    "example": 30
                },
                "eventTypeId": {
                    "type": "integer"
                },
                "eventTypeSlug": {
                    "type": "string"
                },
                "isEnabled": {
                    "type": "boolean"
                },
                "timezone": {
                    "description": "IANA timezone, e.g. Asia/Jerusalem.",
                    "type": "string",
                    "example": "Asia/Jerusalem"
                }
            }
        },
        "internal_publicapi.CallDetailResponse": {
            "type": "object",
            "properties": {
                "agent": {
                    "$ref": "#/definitions/internal_publicapi.AgentBrief"
                },
                "callee": {
                    "type": "string"
                },
                "caller": {
                    "type": "string"
                },
                "direction": {
                    "type": "string"
                },
                "duration": {
                    "type": "integer"
                },
                "ended_at": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": true
                },
                "recording_url": {
                    "type": "string"
                },
                "started_at": {
                    "type": "string"
                },
                "status": {
                    "type": "string"
                },
                "summary": {
                    "type": "string"
                },
                "tokens": {
                    "description": "What the call is charged, in VoiceMatrix tokens; null until the call is priced.",
                    "type": "integer"
                },
                "transcript": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/internal_publicapi.TranscriptEntry"
                    }
                }
            }
        },
        "internal_publicapi.CaptureCoverageWarning": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "string"
                },
                "message": {
                    "type": "string"
                },
                "missingFields": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "scope": {
                    "description": "\"agent\" (pinned) or \"organization\" (fires for every agent)",
                    "type": "string"
                },
                "url": {
                    "type": "string"
                },
                "webhookId": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.CreateAgentRequest": {
            "type": "object",
            "required": [
                "name",
                "prompt"
            ],
            "properties": {
                "description": {
                    "type": "string",
                    "maxLength": 500
                },
                "greeting": {
                    "type": "string"
                },
                "language": {
                    "type": "string",
                    "enum": [
                        "en",
                        "he"
                    ]
                },
                "model": {
                    "type": "string"
                },
                "name": {
                    "type": "string",
                    "maxLength": 100
                },
                "prompt": {
                    "type": "string"
                },
                "voice": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.CreateCallRequest": {
            "type": "object",
            "required": [
                "agent_id",
                "to"
            ],
            "properties": {
                "agent_id": {
                    "type": "string"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": true
                },
                "to": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.CreateCallResponse": {
            "type": "object",
            "properties": {
                "agent_id": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "status": {
                    "type": "string"
                },
                "to": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.CreateKnowledgeRequest": {
            "type": "object",
            "required": [
                "source_type"
            ],
            "properties": {
                "content": {
                    "description": "Content is required when source_type is \"text\".",
                    "type": "string"
                },
                "source_type": {
                    "description": "SourceType selects the ingestion path. Only these two have a reusable service behind them;\nfile upload lives inline in a gin handler and has no callable entry point.",
                    "type": "string",
                    "enum": [
                        "text",
                        "url"
                    ]
                },
                "title": {
                    "description": "Title labels the source so it can be listed and deleted later.",
                    "type": "string",
                    "maxLength": 200
                },
                "url": {
                    "description": "URL is required when source_type is \"url\". Fetched server-side, so it is SSRF-validated.",
                    "type": "string"
                }
            }
        },
        "internal_publicapi.CreateKnowledgeResponse": {
            "type": "object",
            "properties": {
                "agent_id": {
                    "type": "string"
                },
                "chunks": {
                    "type": "integer"
                },
                "title": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.CreateLeadRequest": {
            "type": "object",
            "required": [
                "name",
                "phone"
            ],
            "properties": {
                "agent_id": {
                    "type": "string"
                },
                "email": {
                    "type": "string"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": true
                },
                "name": {
                    "type": "string"
                },
                "notes": {
                    "type": "string"
                },
                "phone": {
                    "type": "string"
                },
                "source": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.CreateWebhookRequest": {
            "type": "object",
            "required": [
                "events",
                "url"
            ],
            "properties": {
                "agent_id": {
                    "description": "Optional: scope webhook to one agent",
                    "type": "string"
                },
                "condition": {
                    "description": "{\"require\": [...]} — gate delivery until these fields are present",
                    "type": "object",
                    "additionalProperties": true
                },
                "content_type": {
                    "type": "string"
                },
                "custom_headers": {
                    "description": "e.g. destination auth: {\"X-Api-Password\": \"...\"}",
                    "type": "object",
                    "additionalProperties": true
                },
                "delivery_timing": {
                    "description": "during (default) / after_call / both. Gates on the CALL being over, unlike\nCondition which gates on fields — only the former still delivers when the\ncaller hangs up mid-questionnaire.",
                    "type": "string"
                },
                "events": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                        "type": "string"
                    }
                },
                "http_method": {
                    "type": "string"
                },
                "payload_template": {
                    "description": "Maps event fields onto the destination's own schema. Placeholders are double-curly-brace field\nnames resolved from the event payload; unset sends the standard envelope. See /docs/developers.",
                    "type": "object",
                    "additionalProperties": true
                },
                "secret": {
                    "description": "Optional custom secret",
                    "type": "string"
                },
                "url": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.DraftFromDescriptionRequest": {
            "type": "object",
            "required": [
                "description"
            ],
            "properties": {
                "description": {
                    "description": "20 to 4000 characters.",
                    "type": "string"
                },
                "language": {
                    "description": "Write the draft in this language. Default: the description's own language.",
                    "type": "string",
                    "example": "he"
                }
            }
        },
        "internal_publicapi.DraftFromQuestionnaireRequest": {
            "type": "object",
            "required": [
                "businessName"
            ],
            "properties": {
                "additionalInstructions": {
                    "type": "string"
                },
                "agentName": {
                    "type": "string"
                },
                "aggressiveness": {
                    "type": "integer"
                },
                "audiencePreset": {
                    "type": "string"
                },
                "businessDescription": {
                    "type": "string"
                },
                "businessHoursNote": {
                    "type": "string"
                },
                "businessName": {
                    "type": "string"
                },
                "callDirection": {
                    "type": "string",
                    "example": "inbound"
                },
                "closingLine": {
                    "type": "string"
                },
                "empathy": {
                    "type": "integer"
                },
                "enableLeadScoring": {
                    "type": "boolean"
                },
                "escalationMessage": {
                    "type": "string"
                },
                "escalationRules": {
                    "type": "string",
                    "example": "on_request"
                },
                "escalationTriggers": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "extraLanguages": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "forbiddenTopics": {
                    "type": "string"
                },
                "formality": {
                    "type": "integer"
                },
                "fromWebsite": {
                    "type": "boolean"
                },
                "goals": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    },
                    "example": [
                        "answer_questions",
                        "capture_leads"
                    ]
                },
                "hasBusinessHours": {
                    "type": "boolean"
                },
                "industry": {
                    "type": "string"
                },
                "integrations": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "objectionHandling": {
                    "type": "string"
                },
                "openingLine": {
                    "type": "string"
                },
                "personality": {
                    "type": "string"
                },
                "primaryLanguage": {
                    "type": "string",
                    "example": "he"
                },
                "qAndA": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/internal_publicapi.QuestionAnswer"
                    }
                },
                "responseLength": {
                    "type": "string",
                    "example": "short"
                },
                "scoringCriteria": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "scrapedServices": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "silenceHandling": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "successCriteria": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "targetAudience": {
                    "type": "string"
                },
                "tone": {
                    "type": "string",
                    "example": "friendly"
                },
                "voiceEngine": {
                    "type": "string"
                },
                "websiteContent": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.DraftFromWebsiteRequest": {
            "type": "object",
            "required": [
                "url"
            ],
            "properties": {
                "language": {
                    "description": "Language code, default he.",
                    "type": "string",
                    "example": "he"
                },
                "url": {
                    "type": "string",
                    "example": "https://example.co.il"
                }
            }
        },
        "internal_publicapi.EnrichmentWebhookTestRequest": {
            "type": "object",
            "properties": {
                "secret": {
                    "description": "Secret signs the test (X-Webhook-Signature). Omitted: the saved secret. \"\": unsigned.",
                    "type": "string"
                },
                "timeout_ms": {
                    "type": "integer",
                    "maximum": 30000,
                    "minimum": 1
                },
                "url": {
                    "type": "string",
                    "maxLength": 2048
                }
            }
        },
        "internal_publicapi.EnrichmentWebhookTestResponse": {
            "type": "object",
            "properties": {
                "duration_ms": {
                    "type": "integer"
                },
                "message": {
                    "type": "string"
                },
                "status_code": {
                    "type": "integer"
                },
                "success": {
                    "type": "boolean"
                },
                "url": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.ErrorEnvelope": {
            "type": "object",
            "properties": {
                "error": {
                    "$ref": "#/definitions/internal_publicapi.APIError"
                }
            }
        },
        "internal_publicapi.FieldError": {
            "type": "object",
            "properties": {
                "field": {
                    "description": "the JSON name, e.g. \"phone_number_id\"",
                    "type": "string"
                },
                "reason": {
                    "description": "\"required\", \"must be a uuid\", ...",
                    "type": "string"
                }
            }
        },
        "internal_publicapi.GmailSettingsRequest": {
            "type": "object",
            "properties": {
                "default_email_subject": {
                    "type": "string"
                },
                "gmail_enabled": {
                    "type": "boolean"
                },
                "gmail_require_confirmation": {
                    "type": "boolean"
                },
                "gmail_signature": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.GoogleCalendarSettingsRequest": {
            "type": "object",
            "properties": {
                "calendar_enabled": {
                    "type": "boolean"
                },
                "calendar_id": {
                    "type": "string",
                    "example": "primary"
                },
                "default_duration": {
                    "type": "integer",
                    "example": 30
                },
                "reminders": {
                    "type": "array",
                    "items": {
                        "type": "integer"
                    },
                    "example": [
                        15,
                        60
                    ]
                },
                "send_invites": {
                    "type": "boolean"
                }
            }
        },
        "internal_publicapi.GoogleSettingsRequest": {
            "type": "object",
            "properties": {
                "calendar_id": {
                    "type": "string"
                },
                "enabled_tools": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    },
                    "example": [
                        "gmail",
                        "calendar",
                        "sheets"
                    ]
                },
                "require_confirmation_for_delete": {
                    "type": "boolean"
                },
                "sheet_name": {
                    "type": "string"
                },
                "spreadsheet_id": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.HangupResponse": {
            "type": "object",
            "properties": {
                "id": {
                    "type": "string"
                },
                "status": {
                    "type": "string"
                },
                "teardown_ok": {
                    "type": "boolean"
                },
                "warning": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.HubSpotSettingsRequest": {
            "type": "object",
            "properties": {
                "contact_owner_id": {
                    "type": "string"
                },
                "create_deals": {
                    "type": "boolean"
                },
                "default_deal_pipeline": {
                    "type": "string"
                },
                "default_deal_stage": {
                    "type": "string"
                },
                "sync_calls": {
                    "type": "boolean"
                },
                "sync_contacts": {
                    "type": "boolean"
                }
            }
        },
        "internal_publicapi.KnowledgeQueryRequest": {
            "type": "object",
            "required": [
                "query"
            ],
            "properties": {
                "limit": {
                    "description": "Chunks to return. Default 5.",
                    "type": "integer",
                    "example": 3
                },
                "query": {
                    "type": "string",
                    "example": "How much is the business plan?"
                },
                "stage": {
                    "description": "For an agent with a stage graph: search as that stage does. Without it, only documents\nvisible in every stage are searched.",
                    "type": "string"
                }
            }
        },
        "internal_publicapi.KnowledgeStagesRequest": {
            "type": "object",
            "required": [
                "filename"
            ],
            "properties": {
                "filename": {
                    "description": "The document's name, as GET /ext/agents/{id}/knowledge lists it.",
                    "type": "string",
                    "example": "prices.txt"
                },
                "stages": {
                    "description": "Stage ids from the agent's stageGraph (at most 12). Empty: visible in every stage.",
                    "type": "array",
                    "items": {
                        "type": "string"
                    },
                    "example": [
                        "pricing",
                        "close"
                    ]
                }
            }
        },
        "internal_publicapi.LeadResponse": {
            "type": "object",
            "properties": {
                "agent_id": {
                    "type": "string"
                },
                "created_at": {
                    "type": "string"
                },
                "email": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": true
                },
                "name": {
                    "type": "string"
                },
                "notes": {
                    "type": "string"
                },
                "phone": {
                    "type": "string"
                },
                "source": {
                    "type": "string"
                },
                "status": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.ListResponse": {
            "type": "object",
            "properties": {
                "data": {},
                "pagination": {
                    "$ref": "#/definitions/internal_publicapi.PaginationResponse"
                }
            }
        },
        "internal_publicapi.MeResponse": {
            "type": "object",
            "properties": {
                "daily_call_limit": {
                    "type": "integer"
                },
                "daily_calls_used": {
                    "type": "integer"
                },
                "key_id": {
                    "type": "string"
                },
                "key_name": {
                    "type": "string"
                },
                "organization_id": {
                    "type": "string"
                },
                "rate_limit_tier": {
                    "type": "string"
                },
                "reseller_id": {
                    "type": "string"
                },
                "scopes": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            }
        },
        "internal_publicapi.PaginationResponse": {
            "type": "object",
            "properties": {
                "has_more": {
                    "type": "boolean"
                },
                "limit": {
                    "type": "integer"
                },
                "offset": {
                    "type": "integer"
                },
                "total": {
                    "type": "integer"
                }
            }
        },
        "internal_publicapi.PublishResponse": {
            "type": "object",
            "properties": {
                "id": {
                    "type": "string"
                },
                "published": {
                    "type": "boolean"
                },
                "status": {
                    "type": "string"
                },
                "warning": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.QuestionAnswer": {
            "type": "object",
            "properties": {
                "answer": {
                    "type": "string"
                },
                "question": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.SalesforceSettingsRequest": {
            "type": "object",
            "properties": {
                "create_opportunities": {
                    "type": "boolean"
                },
                "default_lead_status": {
                    "type": "string"
                },
                "default_opportunity_stage": {
                    "type": "string"
                },
                "owner_id": {
                    "type": "string"
                },
                "record_type_id": {
                    "type": "string"
                },
                "sync_contacts": {
                    "type": "boolean"
                },
                "sync_leads": {
                    "type": "boolean"
                }
            }
        },
        "internal_publicapi.SecurityScanRequest": {
            "type": "object",
            "properties": {
                "scope": {
                    "description": "prompt (default) or realtime.",
                    "type": "string",
                    "example": "prompt"
                },
                "suites": {
                    "description": "behaviour, security, persona. Default: behaviour and security.",
                    "type": "array",
                    "items": {
                        "type": "string"
                    },
                    "example": [
                        "behaviour",
                        "security"
                    ]
                }
            }
        },
        "internal_publicapi.ShareLinkRequest": {
            "type": "object",
            "properties": {
                "ttl": {
                    "description": "Seconds the link stays valid. 0 or absent: 24 hours. Above 30 days it is capped at 30 days.",
                    "type": "integer",
                    "example": 3600
                }
            }
        },
        "internal_publicapi.SimulationRunRequest": {
            "type": "object",
            "properties": {
                "goals": {
                    "description": "What the caller should get from the call; each one is scored (12 at most, 500 characters each).",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "persona": {
                    "description": "Your own caller persona instead (12,000 characters at most). Wins over scenarioId.",
                    "type": "string"
                },
                "promptB": {
                    "description": "A rewritten prompt to compare against the current one: queues two runs (A = current, B = this).",
                    "type": "string"
                },
                "scenarioId": {
                    "description": "A persona id from GET /ext/agents/{id}/simulations/personas.",
                    "type": "string"
                },
                "testerAgentId": {
                    "description": "A tester of your own, aimed at this agent. Default: the tester POST /tester created.",
                    "type": "string"
                }
            }
        },
        "internal_publicapi.StudioFilmsResponse": {
            "type": "object",
            "properties": {
                "films": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/voicematrix_internal_studioapi.Film"
                    }
                }
            }
        },
        "internal_publicapi.TestWebhookRequest": {
            "type": "object",
            "required": [
                "event_type"
            ],
            "properties": {
                "event_type": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.TestWebhookResponse": {
            "type": "object",
            "properties": {
                "message": {
                    "type": "string"
                },
                "status": {
                    "type": "integer"
                },
                "success": {
                    "type": "boolean"
                }
            }
        },
        "internal_publicapi.TesterRequest": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "persona": {
                    "description": "The tester's caller persona. Default: a generated one in the agent's language.",
                    "type": "string"
                }
            }
        },
        "internal_publicapi.TranscriptEntry": {
            "type": "object",
            "properties": {
                "role": {
                    "description": "assistant, user",
                    "type": "string"
                },
                "text": {
                    "type": "string"
                },
                "timestamp": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.UpdateAgentRequest": {
            "type": "object",
            "properties": {
                "description": {
                    "type": "string",
                    "maxLength": 500
                },
                "greeting": {
                    "type": "string"
                },
                "language": {
                    "type": "string",
                    "enum": [
                        "en",
                        "he"
                    ]
                },
                "model": {
                    "type": "string"
                },
                "name": {
                    "type": "string",
                    "maxLength": 100
                },
                "prompt": {
                    "type": "string"
                },
                "voice": {
                    "type": "string"
                },
                "webhook": {
                    "description": "Webhook is the call-enrichment block (agent.settings.webhook) — the SYNCHRONOUS call we make\nto the customer's CRM while the caller is connecting, not an outbound event webhook.\n\nA map rather than a struct, because that is the shape the validator takes and the shape the\ncolumn stores; typing it here would mean a second parse, and the second parse is where the two\nsurfaces drift apart. nil means absent — the same PATCH semantics as the pointers above, and\nthe reason an untouched webhook is left exactly as it was rather than cleared.",
                    "type": "object",
                    "additionalProperties": true
                }
            }
        },
        "internal_publicapi.UpdateLeadRequest": {
            "type": "object",
            "properties": {
                "email": {
                    "type": "string"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": true
                },
                "name": {
                    "type": "string"
                },
                "notes": {
                    "type": "string"
                },
                "status": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.UpdateWebhookRequest": {
            "type": "object",
            "properties": {
                "clear_condition": {
                    "type": "boolean"
                },
                "clear_payload_template": {
                    "description": "ClearPayloadTemplate/ClearCondition exist because `omitempty` on the\nfields above makes \"send {}\" indistinguishable from \"field absent\" —\nwithout an explicit clear flag there would be no way to revert a\nwebhook back to the standard envelope / unconditional delivery once a\ntemplate or condition had been set.",
                    "type": "boolean"
                },
                "condition": {
                    "type": "object",
                    "additionalProperties": true
                },
                "content_type": {
                    "type": "string"
                },
                "custom_headers": {
                    "description": "CustomHeaders REPLACES the full header set when provided — there's no\npartial-merge semantics, because we never return existing values to\ndiff against (they're credentials). Send the complete set every time.",
                    "type": "object",
                    "additionalProperties": true
                },
                "delivery_timing": {
                    "description": "Pointer: nil is \"leave as-is\", not \"reset to during\".",
                    "type": "string"
                },
                "events": {
                    "description": "pq.StringArray, not []string — see the same field on\nwebhooks.UpdateWebhookRequest for why. `webhooks.events` is text[], and a bare\n[]string in an Updates() map renders as a ROW constructor that Postgres\nrejects with SQLSTATE 42804, so PATCH /webhooks/{id} with an events list\nreturned 500 UPDATE_FAILED for every API caller too, not just the dashboard.",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "http_method": {
                    "type": "string"
                },
                "is_active": {
                    "type": "boolean"
                },
                "is_paused": {
                    "type": "boolean"
                },
                "payload_template": {
                    "type": "object",
                    "additionalProperties": true
                },
                "url": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.WebhookDeliveryResponse": {
            "type": "object",
            "properties": {
                "attempt_count": {
                    "type": "integer"
                },
                "completed_at": {
                    "type": "string"
                },
                "created_at": {
                    "type": "string"
                },
                "error_message": {
                    "type": "string"
                },
                "event_id": {
                    "type": "string"
                },
                "event_type": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "is_test": {
                    "description": "from the Test button, not a real event — excluded from the webhook's health",
                    "type": "boolean"
                },
                "response_status": {
                    "type": "integer"
                },
                "response_time_ms": {
                    "type": "integer"
                },
                "status": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.WebhookEventInfo": {
            "type": "object",
            "properties": {
                "category": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "internal_publicapi.WebhookEventsResponse": {
            "type": "object",
            "properties": {
                "events": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/internal_publicapi.WebhookEventInfo"
                    }
                }
            }
        },
        "internal_publicapi.WebhookListResponse": {
            "type": "object",
            "properties": {
                "data": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/internal_publicapi.WebhookResponse"
                    }
                }
            }
        },
        "internal_publicapi.WebhookResponse": {
            "type": "object",
            "properties": {
                "agent_id": {
                    "type": "string"
                },
                "condition": {
                    "type": "object",
                    "additionalProperties": true
                },
                "content_type": {
                    "type": "string"
                },
                "created_at": {
                    "type": "string"
                },
                "custom_header_names": {
                    "description": "names only — values are credentials, never round-tripped (see models.Webhook.CustomHeaders)",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "delivery_timing": {
                    "type": "string"
                },
                "events": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "failure_count": {
                    "type": "integer"
                },
                "http_method": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "is_active": {
                    "type": "boolean"
                },
                "is_paused": {
                    "type": "boolean"
                },
                "last_delivery_at": {
                    "type": "string"
                },
                "last_delivery_status": {
                    "type": "string"
                },
                "payload_template": {
                    "type": "object",
                    "additionalProperties": true
                },
                "secret": {
                    "description": "Only on create",
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                },
                "url": {
                    "type": "string"
                }
            }
        },
        "voicematrix_internal_studioapi.Allowance": {
            "type": "object",
            "properties": {
                "kind": {
                    "type": "string"
                },
                "left_tokens": {
                    "type": "integer"
                },
                "max_film_tokens": {
                    "type": "integer"
                },
                "month": {
                    "type": "string"
                },
                "paused": {
                    "type": "boolean"
                },
                "tokens": {
                    "description": "Tokens is the monthly total; LeftTokens what is left of it now.",
                    "type": "integer"
                }
            }
        },
        "voicematrix_internal_studioapi.Engine": {
            "type": "object",
            "properties": {
                "available": {
                    "type": "boolean"
                },
                "id": {
                    "type": "string"
                },
                "label": {
                    "type": "string"
                },
                "note": {
                    "type": "string"
                },
                "open_model": {
                    "type": "boolean"
                },
                "recommended": {
                    "type": "boolean"
                }
            }
        },
        "voicematrix_internal_studioapi.Film": {
            "type": "object",
            "properties": {
                "allowance_left_tokens": {
                    "description": "AllowanceLeftTokens is set on a create, so the caller can tell the user what is left without\nanother call.",
                    "type": "integer"
                },
                "created_at": {
                    "type": "string"
                },
                "done": {
                    "type": "boolean"
                },
                "duration_seconds": {
                    "type": "integer"
                },
                "error": {
                    "type": "string"
                },
                "error_code": {
                    "type": "string"
                },
                "format": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "language": {
                    "type": "string"
                },
                "links_expire_at": {
                    "type": "string"
                },
                "narration": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "next_step": {
                    "type": "string"
                },
                "preview_image_url": {
                    "type": "string"
                },
                "shots_done": {
                    "type": "integer"
                },
                "shots_total": {
                    "type": "integer"
                },
                "status": {
                    "description": "Status is Studio's state in the words a user would use; Done is true once nothing more will\nchange (done or failed).",
                    "type": "string"
                },
                "title": {
                    "type": "string"
                },
                "tokens": {
                    "type": "integer"
                },
                "updated_at": {
                    "type": "string"
                },
                "video_engine": {
                    "type": "string"
                },
                "video_url": {
                    "type": "string"
                },
                "watch_url": {
                    "type": "string"
                }
            }
        },
        "voicematrix_internal_studioapi.FilmRequest": {
            "type": "object",
            "properties": {
                "brief": {
                    "type": "string"
                },
                "duration_seconds": {
                    "type": "integer"
                },
                "format": {
                    "type": "string"
                },
                "idempotency_key": {
                    "type": "string"
                },
                "language": {
                    "description": "Language empty lets the script writer read it from the brief.",
                    "type": "string"
                },
                "title": {
                    "type": "string"
                },
                "video_engine": {
                    "type": "string"
                }
            }
        },
        "voicematrix_internal_studioapi.Options": {
            "type": "object",
            "properties": {
                "allowance": {
                    "$ref": "#/definitions/voicematrix_internal_studioapi.Allowance"
                },
                "available": {
                    "type": "boolean"
                },
                "durations_seconds": {
                    "type": "array",
                    "items": {
                        "type": "integer"
                    }
                },
                "film_tokens": {
                    "description": "FilmTokens maps a length in seconds to what such a film reserves from the allowance, as\nquoted now with the recommended engine. A length missing from it would not fit what one film\nmay reserve now, or cannot be quoted; with none left, Available is false and Reason says why.",
                    "type": "object",
                    "additionalProperties": {
                        "type": "integer"
                    }
                },
                "formats": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "languages": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "narrators": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "string"
                    }
                },
                "reason": {
                    "type": "string"
                },
                "typical_minutes": {
                    "type": "string"
                },
                "video_engines": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/voicematrix_internal_studioapi.Engine"
                    }
                }
            }
        }
    },
    "securityDefinitions": {
        "ApiKeyAuth": {
            "description": "API Key for authentication (format: vm_live_xxx...)",
            "type": "apiKey",
            "name": "X-API-Key",
            "in": "header"
        }
    },
    "tags": [
        {
            "description": "Manage phone calls - list, get details, create outbound calls",
            "name": "Calls"
        },
        {
            "description": "Manage leads captured from calls",
            "name": "Leads"
        },
        {
            "description": "View voice agent configurations",
            "name": "Agents"
        },
        {
            "description": "Manage webhook subscriptions for real-time events",
            "name": "Webhooks"
        }
    ]
}