{
  "openapi": "3.1.0",
  "info": {
    "title": "11x API",
    "version": "1.0.0",
    "description": "API for 11x AI agents. Programmatically enroll contacts into agent calling sequences, manage sequences, and track credit usage. All requests are authenticated with an organization API key in the `x-api-key` header. The bulk scheduling endpoint also enforces a configurable per-agent rate limit and returns HTTP 429 when exceeded."
  },
  "servers": [
    {
      "url": "https://julian.11x.ai/api/v1"
    }
  ],
  "security": [
    {
      "apiKeyAuth": []
    }
  ],
  "tags": [
    {
      "name": "Workflows",
      "description": "Start an API-triggered workflow and inspect its runs."
    },
    {
      "name": "Scheduling",
      "description": "Enroll contacts into an agent's calling sequence."
    },
    {
      "name": "Sequences",
      "description": "Manage active sequences."
    },
    {
      "name": "Agents",
      "description": "Read agent configuration."
    },
    {
      "name": "Conversation Meetings",
      "description": "Manage the meeting booked during a conversation — list its attendees, add attendees before it starts, and cancel it. Every endpoint is addressed by an `entityId` that identifies the conversation. Today only voice calls are supported, with the form of the call prefix followed by the call ID (e.g. `call.abc123`). The meeting is resolved from the calendar booking created during the conversation, and the calendar provider remains the source of truth."
    },
    {
      "name": "Conversation Metadata",
      "description": "Retrieve completed conversation data asynchronously — designed for batch ingestion, backfills, and reconciliation jobs that pull conversation metadata instead of receiving it through a webhook.\n\n**Recommended batch ingestion flow:**\n\n1. Call `GET /conversations/search/{agentId}` with the time window you want to ingest (e.g. yesterday or the last seven days).\n2. Iterate through the returned `sequenceIds`.\n3. For each sequence ID, call `GET /conversations/metadata/{sequenceId}`.\n4. Store the returned `metadata` array in your warehouse.\n5. Use `limit`, `offset`, and `hasMore` to paginate through larger backfills."
    },
    {
      "name": "Credits",
      "description": "Track credit utilization."
    },
    {
      "name": "Webhooks",
      "description": "Events 11x sends to your endpoint."
    },
    {
      "name": "Recordings",
      "description": "Fetch call audio, and optionally transcripts.\n\nA recording belongs to a single call, so `GET /recordings/{callId}` is addressed by call ID. The bulk endpoint selects by **sequence** ID instead, because that is the unit `GET /conversations/search/{agentId}` returns — same resource, two selectors.\n\n**Bulk export flow:**\n\n1. Call `GET /conversations/search/{agentId}` for the window you want.\n2. Pass a page of the returned `sequenceIds` to `POST /recordings` (up to 100 per request).\n3. Download each `url` before it expires; re-fetch individual calls later with `GET /recordings/{callId}`.\n\nRecording URLs are signed and short-lived — see `expiresAt` on each entry."
    }
  ],
  "paths": {
    "/workflows/{agentId}/run": {
      "post": {
        "tags": ["Workflows"],
        "operationId": "startWorkflowRun",
        "summary": "Start one workflow run",
        "description": "Starts the enabled published API-triggered workflow for this agent. The request body is a flat object of at most 50 configured scalar fields; unknown fields, objects and arrays are rejected. The published schema controls validation. The organization x-api-key is sufficient; HMAC signing is not required on this route. A successful response contains a durable run ID that can be read immediately, even while queued. Reuse an optional Idempotency-Key with an unchanged body to recover the same run; omit it for a distinct run each time.",
        "parameters": [
          { "$ref": "#/components/parameters/AgentId" },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": { "type": "string", "minLength": 1, "maxLength": 255 },
            "description": "Unique per organization and agent while the run remains queryable. Reusing it with a different body returns 422."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "maxProperties": 50,
                "additionalProperties": {
                  "oneOf": [{ "type": "string" }, { "type": "number" }, { "type": "boolean" }]
                },
                "description": "Fields and required keys depend on the published Start API request schema. Field names use lower camelCase or snake_case, begin with a lowercase letter, contain at most 64 characters, and are unique regardless of case."
              },
              "example": { "contact_name": "Example Person", "priority": 2 }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Run admitted and queued.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["workflowRunId"],
                  "properties": { "workflowRunId": { "type": "string" } }
                },
                "example": { "workflowRunId": "wf-run.example" }
              }
            }
          },
          "400": { "description": "Invalid JSON, configured field, or idempotency header." },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "description": "Agent not found or no enabled published API workflow." },
          "409": { "description": "The published API input schema is invalid." },
          "422": { "description": "Idempotency-Key already used with a different request body." },
          "429": {
            "description": "The agent's per-minute workflow-run rate limit was exceeded; retry after the Retry-After interval."
          },
          "500": { "description": "Unable to admit the run." }
        }
      },
      "get": {
        "tags": ["Workflows"],
        "operationId": "getWorkflowRun",
        "summary": "Inspect one workflow run",
        "description": "Returns a small status projection. terminalNodes contains the last executed node on each ending branch, with its name and succeeded/failed state. Raw input, node IDs/types, outputs and traces are not returned. A found failed run still returns HTTP 200.",
        "parameters": [
          { "$ref": "#/components/parameters/AgentId" },
          {
            "name": "runId",
            "in": "query",
            "required": true,
            "schema": { "type": "string", "minLength": 1 },
            "description": "workflowRunId returned by POST."
          }
        ],
        "responses": {
          "200": {
            "description": "Run status.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowRunDetail" } } }
          },
          "400": { "description": "runId is missing or empty." },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "description": "Run or agent not found in this organization." },
          "429": {
            "description": "Shared per-agent workflow-read budget exceeded; retry after the Retry-After interval."
          }
        }
      }
    },
    "/workflows/{agentId}/runs": {
      "get": {
        "tags": ["Workflows"],
        "operationId": "listWorkflowRuns",
        "summary": "List workflow run history",
        "description": "Returns at most 50 newest-first API-triggered run summaries. Includes historical runs after workflow replacement and excludes builder test runs. Pass nextCursor unchanged to request the next page; null means the final page.",
        "parameters": [
          { "$ref": "#/components/parameters/AgentId" },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "maxLength": 512 },
            "description": "Opaque nextCursor from the previous page."
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated run summaries.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["runs", "nextCursor"],
                  "properties": {
                    "runs": { "type": "array", "items": { "$ref": "#/components/schemas/WorkflowRunSummary" } },
                    "nextCursor": { "type": ["string", "null"] }
                  }
                }
              }
            }
          },
          "400": { "description": "Malformed cursor." },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "description": "Agent not found in this organization." },
          "429": {
            "description": "Shared per-agent workflow-read budget exceeded; retry after the Retry-After interval."
          }
        }
      }
    },
    "/agents/{agentId}/schedule/sequence": {
      "post": {
        "tags": ["Scheduling"],
        "operationId": "scheduleSequence",
        "summary": "Enroll a single contact",
        "description": "Schedule one outbound sequence per request. This is the recommended endpoint for real-time, per-contact integrations (CRM webhooks, lead capture forms, etc.). For batch imports, use the bulk endpoint.\n\n**Duplicates:** a phone number that already has an in-progress sequence on this agent gets a `409` `DUPLICATE_ACTIVE_SEQUENCE` naming that sequence, and no new one is created. Send `allowDuplicates: true` to create it anyway, for example for a separate lead on the same number.\n\nYou can also send a `HEAD` request to this URL to verify your API key and agent ID without scheduling anything (returns 200 if reachable).",
        "parameters": [
          {
            "$ref": "#/components/parameters/AgentId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScheduleSequenceRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sequence scheduled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduleSequenceResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation error. `error` is one of: `NO_DATA_PROVIDED` (empty body), `MISSING_NAME`, `MISSING_PHONENUMBER`, `MISSING_CUSTOM_VARIABLES` (one or more required custom input variables missing), `INVALID_PHONE_NUMBER`, `INVALID_EMAIL_ADDRESS` (malformed `toEmailAddress`, or missing for an agent with email steps), `INVALID_TIMEZONE` (not a valid IANA timezone), `INVALID_SCHEDULED_AT` (not valid ISO 8601 or in the past), `AGENT_NOT_ACTIVE` (agent is paused, deleted or archived), `AGENT_HAS_NO_FOLLOW_UP` (agent has no follow-up steps, so it can't take a lead), `INVALID_REQUEST` (`allowDuplicates` is not a boolean).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Phone number cannot be called, or the agent requires signed requests. `error` is `DO_NOT_CALL` (number is on the do-not-call list), `CALIFORNIA_RESTRICTION` (number's area code or ZIP is in California), or `REQUEST_SIGNING_REQUIRED` (the agent has [request signing](/authentication#request-signing) enabled, which only [Enroll multiple contacts](/api-reference/scheduling/enroll-multiple-contacts) supports; not retryable).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/AgentNotFound"
          },
          "409": {
            "description": "No new sequence was created. `DUPLICATE_ACTIVE_SEQUENCE`: the phone number already has an in-progress sequence on this agent, named by `existingSequenceId`; not retryable while that sequence runs. Two concurrent requests for one phone number are serialized, so the second one gets this response. Send `allowDuplicates: true` to create the sequence anyway.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    { "$ref": "#/components/schemas/Error" },
                    {
                      "type": "object",
                      "properties": {
                        "retryable": { "type": "boolean", "example": false },
                        "existingSequenceId": { "type": "string", "example": "call-sequence.23456789ABCDEFGHJ" }
                      }
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/agents/{agentId}/schedule/sequences": {
      "post": {
        "tags": ["Scheduling"],
        "operationId": "scheduleSequencesBulk",
        "summary": "Enroll multiple contacts",
        "description": "Schedule up to 1,000 contacts in a single request — the API equivalent of CSV import.\n\nValidation is **per-contact**: valid contacts are queued, and invalid contacts are returned in `rejected[]` with their original zero-based index. `total` always equals `accepted + rejected.length` on a `202`. Invalid JSON, invalid field types, invalid request options, agent configuration errors, no valid contacts, or insufficient credits reject the whole request.\n\n**Examples:** the request examples assume the agent requires `account_id`. Replace that field with every custom input variable required by your agent, directly on each contact. Use [List agent input variables](/api-reference/agents/list-agent-input-variables) to discover them. The default example omits `scheduledAt` so 11x chooses times using the agent's schedule. Provide `toEmailAddress` for agents with email steps.\n\n**Asynchronous results:** `202` confirms that accepted contacts passed upfront checks and were queued. Sequence creation happens in the background and can still fail. `batchId` identifies the request; sequence IDs are not returned here, and there is no public batch-status endpoint. Inspect background scheduling failures in the agent's scheduling logs. Receive completed-call results through the [Call Results webhook](/webhooks), or retrieve available conversation results using [Search conversations](/api-reference/conversation-metadata/search-conversations).\n\n**Duplicate detection:** phone numbers are normalized first, so `+12125550123` and `+1 (212) 555-0123` collide. By default only the first occurrence in the batch is accepted. Contacts are also rejected if a sequence for the same phone number on this agent is still in progress or started within the past 30 days. `allowDuplicates: true` bypasses both duplicate checks. Opt-outs and California calling restrictions still apply.\n\n**Contact chaining** (`groupByField`): contacts are grouped by the value of the named custom variable. Only the first valid contact in each group is scheduled immediately; the rest activate automatically when an earlier call in the same group does not reach a successful outcome.\n\n**Rate limiting:** this endpoint allows 600 requests per minute per agent by default, shared across API keys for the same organization. The agent may have a different configured limit. On `429`, wait for `Retry-After` seconds before retrying.\n\n**Idempotency:** send an `Idempotency-Key` to make retries safe. Retrying a request that returned `202` with the same key and the same body returns the original response with `Idempotent-Replayed: true` and schedules nothing again. See the `Idempotency-Key` header for the other cases.\n\n**Request signing:** agents with signing enabled also require `X-HMAC-Timestamp` and `X-HMAC-Signature`. See [Authentication](/authentication#request-signing) for the signature format.",
        "parameters": [
          {
            "$ref": "#/components/parameters/AgentId"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional, max 255 characters after trimming. When supplied, its value is returned as `batchId`; otherwise 11x generates a UUID. Only a `202` records the key, for 24 hours. Within that time, a request with the same key and a byte-for-byte identical body returns the stored `202` response with the `Idempotent-Replayed: true` header and schedules nothing again; the same key with a different body returns `422 IDEMPOTENCY_KEY_REUSED`. While the first request with a key is still being processed, another request with that key returns `409 IDEMPOTENCY_KEY_IN_PROGRESS`. If the first request with a key does not return `202`, nothing is recorded and the key can be reused for a corrected request. Use a new key for each new batch.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-HMAC-Timestamp",
            "in": "header",
            "required": false,
            "description": "Required when request signing is enabled for this agent. Current Unix time in seconds, within the agent's configured tolerance (default ±300 seconds).",
            "schema": {
              "type": "string",
              "pattern": "^\\d{1,10}$"
            }
          },
          {
            "name": "X-HMAC-Signature",
            "in": "header",
            "required": false,
            "description": "Required when request signing is enabled for this agent. Base64-encoded HMAC-SHA256 of POST + newline + timestamp + newline + the exact JSON body, using the agent's signing secret. The x-api-key header is also required.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkScheduleRequest"
              },
              "examples": {
                "allAccepted": {
                  "summary": "Two contacts with all required variables",
                  "description": "Assumes this agent requires account_id. Times are chosen using the agent's schedule.",
                  "value": {
                    "contacts": [
                      {
                        "name": "John Doe",
                        "phoneNumber": "+12125550123",
                        "account_id": "account_123"
                      },
                      {
                        "name": "Jane Smith",
                        "phoneNumber": "+12125550124",
                        "account_id": "account_456"
                      }
                    ],
                    "timezone": "America/New_York"
                  }
                },
                "partialAcceptance": {
                  "summary": "Second contact is missing account_id",
                  "description": "Assumes this agent requires account_id. Only the first contact is accepted.",
                  "value": {
                    "contacts": [
                      {
                        "name": "John Doe",
                        "phoneNumber": "+12125550123",
                        "account_id": "account_123"
                      },
                      {
                        "name": "Jane Smith",
                        "phoneNumber": "+12125550124"
                      }
                    ],
                    "timezone": "America/New_York"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted contacts were queued for asynchronous processing. Both full and partial acceptance return 202. Inspect rejected[] and do not assume sequence creation has completed.",
            "headers": {
              "Idempotent-Replayed": {
                "description": "Present and `true` when this is the stored response to an earlier request with the same Idempotency-Key and body; nothing new was scheduled.",
                "schema": {
                  "type": "string",
                  "enum": ["true"]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkScheduleResponse"
                },
                "examples": {
                  "allAccepted": {
                    "summary": "All contacts accepted",
                    "value": {
                      "batchId": "550e8400-e29b-41d4-a716-446655440000",
                      "total": 2,
                      "accepted": 2,
                      "rejected": []
                    }
                  },
                  "partialAcceptance": {
                    "summary": "One accepted, one rejected",
                    "value": {
                      "batchId": "550e8400-e29b-41d4-a716-446655440000",
                      "total": 2,
                      "accepted": 1,
                      "rejected": [
                        {
                          "index": 1,
                          "phoneNumber": "+12125550124",
                          "reason": "MISSING_CUSTOM_VARIABLES",
                          "error": "Missing custom input variables: account_id.",
                          "retryable": false
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Request rejected. `error` is one of: `INVALID_REQUEST_BODY` (body is not valid JSON), `INVALID_REQUEST` (schema violation — empty `contacts`, more than 1000 contacts, or `allowDuplicates` combined with `groupByField`), `INVALID_TIMEZONE` (top-level timezone invalid), `MISSING_TIMEZONE` (agent has no configured timezones), `AGENT_NOT_ACTIVE` (agent is paused, deleted or archived), `AGENT_SCHEDULE_NOT_CONFIGURED` (agent has no schedule days), `INVALID_IDEMPOTENCY_KEY` (header exceeds 255 characters), `ALL_CONTACTS_REJECTED` (every contact failed validation — see `rejected[]`), `INSUFFICIENT_CREDITS` (not enough credits for the accepted contacts — top up and retry).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkScheduleError"
                },
                "examples": {
                  "invalidRequest": {
                    "summary": "Empty contacts array",
                    "value": {
                      "error": "INVALID_REQUEST",
                      "message": "The 'contacts' array must contain at least one contact.",
                      "retryable": false
                    }
                  },
                  "allContactsRejected": {
                    "summary": "No contact passed validation",
                    "value": {
                      "error": "ALL_CONTACTS_REJECTED",
                      "message": "All 1 contacts failed validation. No contacts were scheduled.",
                      "retryable": false,
                      "batchId": "550e8400-e29b-41d4-a716-446655440000",
                      "total": 1,
                      "accepted": 0,
                      "rejected": [
                        {
                          "index": 0,
                          "phoneNumber": "+12125550124",
                          "reason": "MISSING_CUSTOM_VARIABLES",
                          "error": "Missing custom input variables: account_id.",
                          "retryable": false
                        }
                      ]
                    }
                  },
                  "insufficientCredits": {
                    "summary": "Insufficient credits for the accepted contacts",
                    "value": {
                      "error": "INSUFFICIENT_CREDITS",
                      "message": "Insufficient credits: 2 contacts requested, 1 available.",
                      "retryable": true,
                      "result": {
                        "contacts_requested": 2,
                        "credits_available": 1
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "API key missing, invalid, disabled or expired; agent belongs to another organization; or request signing failed. HMAC errors apply only when signing is enabled. Authenticate or correct the signature before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkScheduleUnauthorizedError"
                },
                "examples": {
                  "missingApiKey": {
                    "summary": "Missing API key",
                    "value": {
                      "error": "UNAUTHORIZED",
                      "message": "API key is required. Please provide your API key in the x-api-key header."
                    }
                  },
                  "invalidApiKey": {
                    "summary": "Invalid API key",
                    "value": {
                      "error": "INVALID_API_KEY",
                      "message": "The provided API key is invalid."
                    }
                  },
                  "disabledApiKey": {
                    "summary": "Disabled API key",
                    "value": {
                      "error": "INVALID_API_KEY",
                      "message": "The provided API key is not active."
                    }
                  },
                  "expiredApiKey": {
                    "summary": "Expired API key",
                    "value": {
                      "error": "INVALID_API_KEY",
                      "message": "The provided API key has expired."
                    }
                  },
                  "wrongOrganization": {
                    "summary": "Agent belongs to another organization",
                    "value": {
                      "error": "UNAUTHORIZED",
                      "message": "Invalid API key.",
                      "retryable": false
                    }
                  },
                  "missingSignature": {
                    "summary": "Signing headers missing",
                    "value": {
                      "error": "HMAC_HEADERS_MISSING",
                      "message": "The X-HMAC-Timestamp and X-HMAC-Signature headers are required.",
                      "retryable": false
                    }
                  },
                  "invalidTimestamp": {
                    "summary": "Signing timestamp invalid or expired",
                    "value": {
                      "error": "HMAC_TIMESTAMP_INVALID",
                      "message": "The HMAC timestamp is invalid or expired.",
                      "retryable": false
                    }
                  },
                  "invalidSignature": {
                    "summary": "Invalid signature",
                    "value": {
                      "error": "INVALID_HMAC_SIGNATURE",
                      "message": "The HMAC signature is invalid.",
                      "retryable": false
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Agent could not be loaded. A successfully loaded agent belonging to another organization returns 401 UNAUTHORIZED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkScheduleAgentNotFoundError"
                },
                "examples": {
                  "agentNotFound": {
                    "summary": "Agent not found",
                    "value": {
                      "error": "AGENT_NOT_FOUND",
                      "message": "Agent not found.",
                      "retryable": false
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Another request with this Idempotency-Key is still being processed. Retry shortly with the same key and body.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkScheduleIdempotencyInProgressError"
                },
                "examples": {
                  "idempotencyKeyInProgress": {
                    "summary": "Same key still processing",
                    "value": {
                      "error": "IDEMPOTENCY_KEY_IN_PROGRESS",
                      "message": "A request with this Idempotency-Key is still being processed. Retry shortly.",
                      "retryable": true
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "The `Content-Type` header is missing or is not `application/json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkScheduleUnsupportedMediaTypeError"
                },
                "examples": {
                  "unsupportedMediaType": {
                    "summary": "Body sent as text/plain",
                    "value": {
                      "error": "UNSUPPORTED_MEDIA_TYPE",
                      "message": "Content-Type must be application/json.",
                      "retryable": false
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "This Idempotency-Key already recorded a `202` for a different request body. Send the new request with a new key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkScheduleIdempotencyKeyReusedError"
                },
                "examples": {
                  "idempotencyKeyReused": {
                    "summary": "Same key, different body",
                    "value": {
                      "error": "IDEMPOTENCY_KEY_REUSED",
                      "message": "This Idempotency-Key was already used with a different request body. Send a new key.",
                      "retryable": false
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Per-agent request limit exceeded. Defaults to 600 requests per minute, shared across API keys for the same organization; the agent may have a different configured limit. Wait Retry-After seconds before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkScheduleRateLimitError"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Agent rate limit exceeded",
                    "value": {
                      "error": "RATE_LIMITED",
                      "message": "Rate limit of 600 requests per minute exceeded for this agent. Retry after 30 seconds.",
                      "retryable": true
                    }
                  }
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "minimum": 1,
                  "example": 30
                }
              },
              "X-RateLimit-Limit": {
                "description": "Configured request limit per minute.",
                "schema": {
                  "type": "integer",
                  "example": 600
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests remaining in the current window.",
                "schema": {
                  "type": "integer",
                  "example": 0
                }
              },
              "X-RateLimit-Reset": {
                "description": "Rate-limit reset time as Unix seconds.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server failure. API-key lookup failures return JSON with error INVALID_API_KEY and message \"An internal server error occurred while validating the API key.\" Other server failures may return an unstructured body, so clients must handle non-JSON responses. Retry with backoff and reuse the same Idempotency-Key for an unchanged request."
          }
        }
      }
    },
    "/agents": {
      "get": {
        "tags": ["Agents"],
        "operationId": "listAgents",
        "summary": "List organization agents",
        "description": "Returns active, paused, and archived agents belonging to an organization in fixed pages of up to 100 agents. The required `orgId` is the Stytch organization ID and must match the organization associated with the API key.",
        "parameters": [
          {
            "name": "orgId",
            "in": "query",
            "required": true,
            "description": "Stytch organization ID associated with the API key.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "example": "organization-test-123"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "One-based page number. Defaults to the first page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of agents and pagination metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["agents", "pagination"],
                  "properties": {
                    "agents": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "required": ["agentId", "name", "status"],
                        "properties": {
                          "agentId": {
                            "type": "string",
                            "description": "Unique identifier of the agent.",
                            "example": "agent.abc123"
                          },
                          "name": {
                            "type": "string",
                            "description": "Display name of the agent.",
                            "example": "Outbound SDR"
                          },
                          "status": {
                            "type": "string",
                            "description": "Current agent status.",
                            "enum": ["ACTIVE", "PAUSED", "ARCHIVED"],
                            "example": "ACTIVE"
                          }
                        }
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "required": ["page", "pageSize", "totalItems", "totalPages", "hasMore"],
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current one-based page number."
                        },
                        "pageSize": {
                          "type": "integer",
                          "const": 100,
                          "description": "Maximum number of agents returned per page."
                        },
                        "totalItems": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of matching agents."
                        },
                        "totalPages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of available pages."
                        },
                        "hasMore": {
                          "type": "boolean",
                          "description": "Whether another page is available."
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`MISSING_ORG_ID` — the required `orgId` query parameter is missing or empty. `INVALID_PAGE` — `page` is not a positive integer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "missingOrgId": {
                    "summary": "Missing organization ID",
                    "value": {
                      "error": "MISSING_ORG_ID",
                      "message": "The orgId query parameter is required."
                    }
                  },
                  "invalidPage": {
                    "summary": "Invalid page number",
                    "value": {
                      "error": "INVALID_PAGE",
                      "message": "The page query parameter must be a positive integer."
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`UNAUTHORIZED` or `INVALID_API_KEY` — the API key is missing or invalid, or it does not belong to the requested organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/agents/{agentId}/input-variables": {
      "get": {
        "tags": ["Agents"],
        "operationId": "listAgentInputVariables",
        "summary": "List agent input variables",
        "description": "Returns the non-deleted input-variable definitions configured on the agent. Use each variable's `slug` as the key in `customVariables` when scheduling a sequence.",
        "parameters": [
          {
            "$ref": "#/components/parameters/AgentId"
          }
        ],
        "responses": {
          "200": {
            "description": "Input-variable definitions configured on the agent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["inputVariables"],
                  "properties": {
                    "inputVariables": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InputVariableDefinition"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`UNAUTHORIZED` or `INVALID_API_KEY` — the API key is missing or invalid, or the agent does not exist or belong to the API key's organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/agents/{agentId}/extracted-variables": {
      "get": {
        "tags": ["Agents"],
        "operationId": "listAgentExtractedVariables",
        "summary": "List agent extracted variables",
        "description": "Returns the non-deleted, customer-defined variables that 11x extracts from the agent's conversations. System-default definitions are excluded. Dropdown and date/time variables include their type-specific configuration.",
        "parameters": [
          {
            "$ref": "#/components/parameters/AgentId"
          }
        ],
        "responses": {
          "200": {
            "description": "Customer-defined extracted-variable definitions configured on the agent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["extractedVariables"],
                  "properties": {
                    "extractedVariables": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ExtractedVariableDefinition"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`UNAUTHORIZED` or `INVALID_API_KEY` — the API key is missing or invalid, or the agent does not exist or belong to the API key's organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/agents/{agentId}/outcomes": {
      "get": {
        "tags": ["Agents"],
        "operationId": "listAgentOutcomes",
        "summary": "List agent outcomes",
        "description": "Returns the enabled, customer-defined outcome definitions configured on the agent. Use this to map the `outcomes[].name` values delivered in call-result webhooks back to their definitions.",
        "parameters": [
          {
            "$ref": "#/components/parameters/AgentId"
          }
        ],
        "responses": {
          "200": {
            "description": "Enabled outcome definitions for the agent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["outcomes"],
                  "properties": {
                    "outcomes": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": ["outcomeDefinitionId", "name"],
                        "properties": {
                          "outcomeDefinitionId": {
                            "type": "string",
                            "description": "Unique identifier of the outcome definition."
                          },
                          "name": {
                            "type": "string",
                            "description": "Outcome name as it appears in call results.",
                            "example": "interested"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/sequences/cancel": {
      "post": {
        "tags": ["Sequences"],
        "operationId": "cancelSequences",
        "summary": "Cancel sequences",
        "description": "Cancels all in-progress sequences in your organization whose custom input variable `referenceKey` equals `referenceValue` (e.g. every sequence enrolled with `account_id = \"acme-123\"`). Pass `agentId` to cancel only that agent's sequences and leave the contact's sequences on your other agents running. Sequences that are already done, cancelled, or failed are skipped.\n\nThe call is idempotent: it returns success even when no matching in-progress sequences exist.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["referenceKey", "referenceValue"],
                "properties": {
                  "referenceKey": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Name of the custom input variable to match on.",
                    "example": "account_id"
                  },
                  "referenceValue": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Value of the custom input variable to match.",
                    "example": "acme-123"
                  },
                  "reason": {
                    "type": "string",
                    "description": "Optional free-text reason, recorded for auditing."
                  },
                  "agentId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Optional. Only cancel sequences on this agent. Omit it to cancel matching sequences on every agent in your organization. An agent ID that matches none of your sequences cancels nothing.",
                    "example": "agent-123"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cancellation processed (also returned when nothing matched).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["success"],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_ERROR` — body is not valid JSON or required fields are missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/credits/usage": {
      "get": {
        "tags": ["Credits"],
        "operationId": "getCreditUsage",
        "summary": "Get credit usage",
        "description": "Returns your organization's credit utilization for a billing month (default: current month) or a custom date range, plus a per-agent consumption breakdown. Amounts are in whole credits.\n\nIn **month mode** the response includes allocation, remaining, and `percentageUsed`; the organization `spent` figure is authoritative and may differ slightly from the sum of `agents[]`. In **range mode** allocation, remaining, and `percentageUsed` are `null`, and organization `spent` equals the sum of per-agent spend.",
        "parameters": [
          {
            "name": "month",
            "in": "query",
            "required": false,
            "description": "Billing month as `YYYY-MM`. Defaults to the current month. Must not be in the future. Mutually exclusive with `startDate`/`endDate`.",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}$",
              "example": "2026-05"
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "required": false,
            "description": "Start of a custom range as `YYYY-MM-DD` (inclusive, UTC). Requires `endDate`. Range cannot exceed 366 days.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "required": false,
            "description": "End of a custom range as `YYYY-MM-DD` (inclusive, UTC). Requires `startDate`. Cannot be in the future.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Credit usage report.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreditUsageResponse"
                }
              }
            }
          },
          "400": {
            "description": "`INVALID_REQUEST` — invalid or conflicting period parameters (e.g. `month` combined with `startDate`/`endDate`, future month, range over 366 days).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/conversations/meetings/{entityId}/attendees": {
      "get": {
        "tags": ["Conversation Meetings"],
        "operationId": "listMeetingAttendees",
        "summary": "List meeting attendees",
        "description": "Retrieve the current attendees on the meeting linked to a conversation. Attendees are read live from the calendar provider: each attendee always includes `email`, while `name`, `timeZone`, and `phoneNumber` are present when the provider has a value for them.",
        "parameters": [
          {
            "$ref": "#/components/parameters/EntityId"
          }
        ],
        "responses": {
          "200": {
            "description": "Current attendees on the meeting.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MeetingAttendeesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/ConversationMeetingNotFound"
          },
          "409": {
            "$ref": "#/components/responses/CalNotConfigured"
          },
          "422": {
            "$ref": "#/components/responses/UnsupportedConversationEntity"
          },
          "502": {
            "$ref": "#/components/responses/CalApiError"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      },
      "post": {
        "tags": ["Conversation Meetings"],
        "operationId": "addMeetingAttendees",
        "summary": "Add meeting attendees",
        "description": "Add one or more attendees to the meeting, then return the full reconciled attendee list fetched from the calendar provider after the additions are applied (not just the attendees from the request). Attendees can only be added while the meeting has not yet started.",
        "parameters": [
          {
            "$ref": "#/components/parameters/EntityId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddMeetingAttendeesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The full attendee list after the additions are applied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MeetingAttendeesResponse"
                }
              }
            }
          },
          "400": {
            "description": "`INVALID_REQUEST_BODY` — the request body failed validation (e.g. no attendees, more than 30, an invalid email, or an empty name). The message describes the specific validation failures.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "INVALID_REQUEST_BODY",
                  "message": "At least one attendee is required."
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/ConversationMeetingNotFound"
          },
          "409": {
            "$ref": "#/components/responses/CalNotConfigured"
          },
          "422": {
            "description": "`UNSUPPORTED_ENTITY` — the `entityId` is not a supported conversation type (only voice calls are supported today). `MEETING_ALREADY_STARTED` — the meeting start time is in the past; attendees can only be added before the meeting starts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unsupportedEntity": {
                    "summary": "Unsupported conversation entity",
                    "value": {
                      "error": "UNSUPPORTED_ENTITY",
                      "message": "Conversation entity is not supported for meeting attendees: call.abc123"
                    }
                  },
                  "meetingAlreadyStarted": {
                    "summary": "Meeting already started",
                    "value": {
                      "error": "MEETING_ALREADY_STARTED",
                      "message": "Cannot add attendees to a meeting that has already started."
                    }
                  }
                }
              }
            }
          },
          "502": {
            "$ref": "#/components/responses/CalApiError"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/conversations/meetings/{entityId}/cancel": {
      "post": {
        "tags": ["Conversation Meetings"],
        "operationId": "cancelMeeting",
        "summary": "Cancel meeting",
        "description": "Cancel the meeting linked to a conversation. The request body is optional — send an empty body to cancel with no extra options. Reconciliation of the conversation's stored metadata (such as marking the booking cancelled) is handled asynchronously after the calendar provider confirms the cancellation; it does not happen within this request.",
        "parameters": [
          {
            "$ref": "#/components/parameters/EntityId"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelMeetingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Meeting cancelled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelMeetingResponse"
                }
              }
            }
          },
          "400": {
            "description": "`INVALID_REQUEST_BODY` — the request body failed validation. The message describes the specific validation failures.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "INVALID_REQUEST_BODY",
                  "message": "Expected boolean, received string"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/ConversationMeetingNotFound"
          },
          "409": {
            "$ref": "#/components/responses/CalNotConfigured"
          },
          "422": {
            "$ref": "#/components/responses/UnsupportedConversationEntity"
          },
          "502": {
            "$ref": "#/components/responses/CalApiError"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/conversations/search/{agentId}": {
      "get": {
        "tags": ["Conversation Metadata"],
        "operationId": "searchConversations",
        "summary": "Search conversations",
        "description": "Search for conversation sequence IDs for a specific agent within a scheduled-time window. The window is evaluated against scheduled call-step time using UTC calendar days: `start` is interpreted as `00:00:00.000Z` for that date and `end` as `23:59:59.999Z` for that date. Both must be zero-padded `YYYY-MM-DD` dates. Results are returned as conversation sequence IDs only — use the metadata endpoint to hydrate them.",
        "parameters": [
          {
            "$ref": "#/components/parameters/AgentId"
          },
          {
            "name": "start",
            "in": "query",
            "required": true,
            "description": "UTC start date for the search window in zero-padded `YYYY-MM-DD` format (inclusive).",
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-05-06"
            }
          },
          {
            "name": "end",
            "in": "query",
            "required": true,
            "description": "UTC end date for the search window in zero-padded `YYYY-MM-DD` format (inclusive).",
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-05-14"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of sequence IDs to return.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Number of matching conversations to skip.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching conversation sequence IDs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchConversationsResponse"
                }
              }
            }
          },
          "400": {
            "description": "`INVALID_DATE_RANGE` — `start`/`end` are missing, not in `YYYY-MM-DD` format, or `start` is after `end`. `INVALID_PAGINATION` — `limit` is outside 1–500 or `offset` is negative.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalidDateRange": {
                    "summary": "Missing or malformed dates",
                    "value": {
                      "error": "INVALID_DATE_RANGE",
                      "message": "Both start and end query parameters are required and must use YYYY-MM-DD format."
                    }
                  },
                  "startAfterEnd": {
                    "summary": "Start after end",
                    "value": {
                      "error": "INVALID_DATE_RANGE",
                      "message": "The start query parameter must be before or equal to end."
                    }
                  },
                  "invalidPagination": {
                    "summary": "Invalid pagination",
                    "value": {
                      "error": "INVALID_PAGINATION",
                      "message": "limit must be between 1 and 500, and offset must be a non-negative integer."
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`UNAUTHORIZED` or `INVALID_API_KEY` — API key missing or invalid. Also returned as `INVALID_API_KEY` when the agent does not exist or does not belong to your organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "missingApiKey": {
                    "summary": "Missing API key",
                    "value": {
                      "error": "UNAUTHORIZED",
                      "message": "API key is required. Please provide your API key in the x-api-key header."
                    }
                  },
                  "invalidApiKeyOrAgentNotFound": {
                    "summary": "Invalid API key or agent not found",
                    "value": {
                      "error": "INVALID_API_KEY",
                      "message": "The provided API key is invalid or the agent was not found."
                    }
                  }
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/conversations/metadata/{sequenceId}": {
      "get": {
        "tags": ["Conversation Metadata"],
        "operationId": "getConversationMetadata",
        "summary": "Retrieve conversation metadata",
        "description": "Retrieve metadata for every call step in a conversation sequence, returned at conversation-sequence grain with one metadata object per call step. Set `includeRecording=true` to include a signed recording URL when one is available — recording URLs are opt-in because they are signed and may include sensitive call audio.",
        "parameters": [
          {
            "$ref": "#/components/parameters/SequenceId"
          },
          {
            "name": "includeRecording",
            "in": "query",
            "required": false,
            "description": "When set to `true`, includes a signed `recordingUrl` on each metadata object when available. Any value other than `true` defaults to `false`. Matching is case-insensitive.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Conversation metadata, one object per call step.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConversationMetadataResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "`CONVERSATION_NOT_FOUND` — the sequence does not exist or does not belong to your organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "CONVERSATION_NOT_FOUND",
                  "message": "Conversation not found."
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/recordings": {
      "post": {
        "tags": ["Recordings"],
        "operationId": "listRecordings",
        "summary": "Retrieve recordings for conversations",
        "description": "Retrieve recording URLs for every call in the requested conversation sequences, optionally with each call's transcript.\n\nTwo limits apply. At most **100 sequence IDs** per request, and those sequences may contain at most **500 calls** in total — a few long sequences can exceed the call limit while well under the sequence limit, in which case split the IDs across requests. Nothing is truncated silently.\n\nSequences you cannot see are reported in `notFound` rather than failing the request.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordingsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recordings grouped by conversation sequence.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordingsResponse"
                }
              }
            }
          },
          "400": {
            "description": "`INVALID_REQUEST` — no sequence IDs, or more than 100.\n`TOO_MANY_CALLS` — the requested sequences contain more than 500 calls in total.\n`INVALID_REQUEST_BODY` — the body is not valid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/recordings/{callId}": {
      "get": {
        "tags": ["Recordings"],
        "operationId": "getCallRecording",
        "summary": "Retrieve a call recording",
        "description": "Retrieve the recording URL for a single call, optionally with its transcript.\n\nBecause the call-results webhook payload carries `callId`, this is the endpoint to call when a webhook delivery was missed or you need the audio again later.",
        "parameters": [
          {
            "name": "callId",
            "in": "path",
            "required": true,
            "description": "The call's ID, e.g. `call.abc123`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeTranscript",
            "in": "query",
            "required": false,
            "description": "When set to `true`, include the call's transcript text. Any other value is treated as `false`. Matching is case-insensitive.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The call's recording, and its transcript when requested.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallRecordingEntry"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "`CALL_NOT_FOUND` — the call does not exist or does not belong to your organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "CALL_NOT_FOUND",
                  "message": "Call not found."
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    }
  },
  "webhooks": {
    "callResults": {
      "post": {
        "operationId": "callResultsWebhook",
        "tags": ["Webhooks"],
        "summary": "Call results",
        "description": "Sent to your configured webhook URL after each call is completed and analyzed. Respond with a `2xx` promptly and process asynchronously; deliveries may occasionally repeat, so handle them idempotently (key on `callId`). See the [Call Results Webhook guide](/webhooks) for `resultType` and `lifecycleStatus` value tables.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CallResultsWebhookPayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx status to acknowledge receipt."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "Organization API key. Get it from the 11x team or from the platform."
      }
    },
    "parameters": {
      "AgentId": {
        "name": "agentId",
        "in": "path",
        "required": true,
        "description": "ID of the agent, e.g. `agent.abc123`.",
        "schema": {
          "type": "string"
        }
      },
      "EntityId": {
        "name": "entityId",
        "in": "path",
        "required": true,
        "description": "ID of the conversation whose meeting you want to manage. Voice calls use the call prefix followed by the call ID, e.g. `call.abc123`.",
        "schema": {
          "type": "string"
        }
      },
      "SequenceId": {
        "name": "sequenceId",
        "in": "path",
        "required": true,
        "description": "ID of the conversation sequence, e.g. `call-sequence.abc123`.",
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "`UNAUTHORIZED` or `INVALID_API_KEY` — API key missing, invalid, or not authorized for this agent's organization.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "missingApiKey": {
                "summary": "Missing API key",
                "value": {
                  "error": "UNAUTHORIZED",
                  "message": "API key is required. Please provide your API key in the x-api-key header."
                }
              },
              "invalidApiKey": {
                "summary": "Invalid API key",
                "value": {
                  "error": "INVALID_API_KEY",
                  "message": "The provided API key is invalid."
                }
              }
            }
          }
        }
      },
      "AgentNotFound": {
        "description": "`AGENT_NOT_FOUND` — agent ID does not exist or is not owned by your organization.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "InternalServerError": {
        "description": "`INTERNAL_SERVER_ERROR` — unexpected server error. Retry with backoff and contact the 11x team if it persists.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "INTERNAL_SERVER_ERROR",
              "message": "Internal Server Error. Please contact 11x team."
            }
          }
        }
      },
      "ConversationMeetingNotFound": {
        "description": "`ENTITY_NOT_FOUND` — the conversation does not exist or does not belong to your organization. `BOOKING_NOT_FOUND` — the conversation exists but has no calendar booking linked to it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "entityNotFound": {
                "summary": "Conversation not found",
                "value": {
                  "error": "ENTITY_NOT_FOUND",
                  "message": "Conversation not found: call.abc123"
                }
              },
              "bookingNotFound": {
                "summary": "No booking linked to the conversation",
                "value": {
                  "error": "BOOKING_NOT_FOUND",
                  "message": "No Cal.com booking found for conversation call.abc123"
                }
              }
            }
          }
        }
      },
      "CalNotConfigured": {
        "description": "`CAL_NOT_CONFIGURED` — the calendar provider is not configured for your organization.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "CAL_NOT_CONFIGURED",
              "message": "Cal.com is not configured for this organization."
            }
          }
        }
      },
      "CalApiError": {
        "description": "`CAL_API_ERROR` — the calendar provider rejected the request. The message includes the provider's error detail.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "CAL_API_ERROR",
              "message": "Failed to add attendee guest@example.com: [provider error detail]"
            }
          }
        }
      },
      "UnsupportedConversationEntity": {
        "description": "`UNSUPPORTED_ENTITY` — the `entityId` is not a supported conversation type. Only voice calls are supported today.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "UNSUPPORTED_ENTITY",
              "message": "Conversation entity is not supported for meeting attendees: call.abc123"
            }
          }
        }
      }
    },
    "schemas": {
      "WorkflowRunSummary": {
        "type": "object",
        "required": ["workflowRunId", "status", "startedAt", "finishedAt"],
        "properties": {
          "workflowRunId": { "type": "string" },
          "status": { "type": "string", "enum": ["queued", "in_progress", "completed", "failed"] },
          "startedAt": { "type": ["string", "null"], "format": "date-time", "description": "Null while queued." },
          "finishedAt": { "type": ["string", "null"], "format": "date-time", "description": "Null until terminal." }
        }
      },
      "WorkflowRunDetail": {
        "allOf": [
          { "$ref": "#/components/schemas/WorkflowRunSummary" },
          {
            "type": "object",
            "required": ["terminalNodes"],
            "properties": {
              "terminalNodes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": ["nodeName", "status"],
                  "properties": {
                    "nodeName": { "type": "string" },
                    "status": { "type": "string", "enum": ["succeeded", "failed"] }
                  }
                }
              }
            }
          }
        ]
      },
      "Error": {
        "type": "object",
        "required": ["error", "message"],
        "properties": {
          "error": {
            "type": "string",
            "description": "Machine-readable error code.",
            "example": "INVALID_PHONE_NUMBER"
          },
          "message": {
            "type": "string",
            "description": "Human-readable explanation."
          }
        }
      },
      "InputVariableDefinition": {
        "type": "object",
        "required": ["slug", "displayName", "description"],
        "properties": {
          "slug": {
            "type": "string",
            "description": "Stable key used to provide this value when scheduling a sequence.",
            "example": "first_name"
          },
          "displayName": {
            "type": "string",
            "description": "Human-readable variable name.",
            "example": "First name"
          },
          "description": {
            "type": "string",
            "description": "Explanation of the value expected for this variable.",
            "example": "The contact's first name"
          }
        }
      },
      "ExtractedVariableDefinition": {
        "type": "object",
        "required": ["slug", "displayName", "description", "type"],
        "properties": {
          "slug": {
            "type": "string",
            "description": "Stable key used for this value in conversation results.",
            "example": "meeting_time"
          },
          "displayName": {
            "type": "string",
            "description": "Human-readable variable name.",
            "example": "Meeting time"
          },
          "description": {
            "type": "string",
            "description": "Explanation of the value 11x extracts.",
            "example": "The agreed date and time for the meeting"
          },
          "type": {
            "type": "string",
            "description": "Value type extracted from the conversation.",
            "enum": ["TEXT", "NUMBER", "TRUE/FALSE", "DATE/TIME", "DROPDOWN"],
            "example": "DATE/TIME"
          },
          "dropdownOptions": {
            "type": "array",
            "description": "Allowed values. Returned only when `type` is `DROPDOWN`.",
            "items": {
              "type": "string"
            },
            "example": ["High", "Medium", "Low"]
          },
          "datetimeFormat": {
            "type": ["string", "null"],
            "description": "Moment.js-compatible output format. Returned only when `type` is `DATE/TIME`.",
            "enum": [
              "YYYY-MM-DD",
              "MMMM Do, YYYY",
              "D MMM YYYY",
              "D MMMM YYYY",
              "h:mm A",
              "HH:mm",
              "YYYY-MM-DD h:mm A",
              "YYYY-MM-DD HH:mm:ss",
              "YYYY-MM-DD h:mm:ss A",
              null
            ],
            "example": "YYYY-MM-DD HH:mm:ss"
          },
          "formatDatetimeInUtc": {
            "type": ["boolean", "null"],
            "description": "Whether the extracted value is normalized to UTC. Returned only when `type` is `DATE/TIME`.",
            "example": true
          }
        }
      },
      "ScheduleSequenceRequest": {
        "type": "object",
        "required": ["name", "phoneNumber"],
        "description": "In addition to the fields below, include every **custom input variable** required by the agent as a top-level string property (e.g. `prospect_name`, `account_id`). The exact set varies per agent and is configured on the agent's prompt template.",
        "properties": {
          "name": {
            "type": "string",
            "description": "Contact's full name.",
            "example": "John Doe"
          },
          "phoneNumber": {
            "type": "string",
            "description": "Contact's phone number in E.164 format.",
            "example": "+15551234567"
          },
          "toEmailAddress": {
            "type": "string",
            "format": "email",
            "description": "Recipient email address. Required when the agent's sequence contains email steps."
          },
          "timezone": {
            "type": "string",
            "description": "IANA timezone (e.g. `America/New_York`). If omitted, inferred from the phone number's area code, falling back to the agent's first configured timezone."
          },
          "scheduledAt": {
            "type": "string",
            "format": "date-time",
            "description": "Schedule the call for a specific future time (ISO 8601). Validated against the same timezone the scheduler uses for execution."
          },
          "bypassAllowedCallWindow": {
            "type": "boolean",
            "default": false,
            "description": "Bypass the agent's allowed call windows for this sequence."
          },
          "groupByField": {
            "type": "string",
            "description": "Group this contact with others sharing the same value of the named custom variable. Used for contact chaining — only the first contact per group is scheduled; the rest are chained automatically when the previous call ends without success.",
            "example": "account_id"
          },
          "allowDuplicates": {
            "type": "boolean",
            "default": false,
            "description": "Create the sequence even when this phone number already has an in-progress sequence on this agent. Without it, that request gets a `409` `DUPLICATE_ACTIVE_SEQUENCE`. Opt-outs and California calling restrictions still apply."
          }
        },
        "additionalProperties": {
          "type": "string",
          "description": "Custom input variables defined on the agent."
        }
      },
      "ScheduleSequenceResponse": {
        "type": "object",
        "required": ["sequence"],
        "properties": {
          "sequence": {
            "type": "object",
            "properties": {
              "sequenceId": {
                "type": "string",
                "example": "call-sequence.abc123"
              },
              "name": {
                "type": "string",
                "example": "John Doe"
              },
              "phoneNumber": {
                "type": "string",
                "example": "+15551234567"
              },
              "scheduledAt": {
                "type": "string",
                "format": "date-time"
              },
              "toEmailAddress": {
                "type": "string",
                "format": "email"
              },
              "customInputVariables": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "timezone": {
                "type": "string",
                "example": "America/New_York"
              },
              "scheduledBy": {
                "type": "string",
                "example": "API"
              },
              "steps": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "stepType": {
                      "type": "string",
                      "enum": ["CALL", "EMAIL"],
                      "example": "CALL"
                    },
                    "delaySeconds": {
                      "type": "integer",
                      "example": 0
                    },
                    "delaySecondsMax": {
                      "type": ["integer", "null"],
                      "example": null
                    },
                    "executionWindowConfig": {
                      "type": ["object", "null"],
                      "properties": {
                        "dayOffset": {
                          "type": "integer",
                          "minimum": 0,
                          "example": 1
                        },
                        "timeWindow": {
                          "type": "object",
                          "properties": {
                            "startTime": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 1439,
                              "example": 540
                            },
                            "endTime": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 1440,
                              "example": 660
                            }
                          },
                          "required": ["startTime", "endTime"]
                        },
                        "timezoneSource": {
                          "type": "string",
                          "enum": ["contact"],
                          "example": "contact"
                        }
                      },
                      "required": ["dayOffset", "timeWindow", "timezoneSource"]
                    }
                  }
                }
              }
            }
          }
        }
      },
      "BulkScheduleRequest": {
        "type": "object",
        "required": ["contacts"],
        "properties": {
          "contacts": {
            "type": "array",
            "minItems": 1,
            "maxItems": 1000,
            "description": "Contacts to enroll (1–1,000).",
            "items": {
              "$ref": "#/components/schemas/BulkContact"
            }
          },
          "timezone": {
            "type": "string",
            "description": "Default IANA timezone applied to contacts that don't supply their own. If omitted, falls back to the agent's first configured timezone.",
            "example": "America/New_York"
          },
          "groupByField": {
            "type": "string",
            "description": "Group contacts by the value of a custom variable for contact chaining. Only the first valid contact per group is scheduled immediately. Cannot be combined with `allowDuplicates`.",
            "example": "account_id"
          },
          "normalizeFields": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Custom variable names to title-case before scheduling (e.g. `\"JOHN\"` → `\"John\"`). Only applied for organizations in the normalization allowlist."
          },
          "allowDuplicates": {
            "type": "boolean",
            "default": false,
            "description": "Bypass duplicate checks within the batch and against sequences on this agent that are still in progress or started within the past 30 days. Opt-outs and California calling restrictions still apply. Cannot be combined with groupByField."
          }
        },
        "example": {
          "contacts": [
            {
              "name": "John Doe",
              "phoneNumber": "+12125550123",
              "account_id": "account_123"
            },
            {
              "name": "Jane Smith",
              "phoneNumber": "+12125550124",
              "account_id": "account_456"
            }
          ],
          "timezone": "America/New_York"
        }
      },
      "BulkContact": {
        "type": "object",
        "required": ["name", "phoneNumber"],
        "description": "In addition to the fields below, include every custom input variable required by the agent as a top-level string property.",
        "properties": {
          "name": {
            "type": "string",
            "example": "John Doe"
          },
          "phoneNumber": {
            "type": "string",
            "description": "Phone number in E.164 format.",
            "example": "+12125550123"
          },
          "phoneNumberExt": {
            "type": "string",
            "description": "DTMF extension dialed after the call connects."
          },
          "timezone": {
            "type": "string",
            "description": "Per-contact IANA timezone. Used for explicit scheduledAt validation and for automatic scheduling when the agent is configured to use contact timezones. Otherwise automatic scheduling uses the request's timezone or the agent's first configured timezone."
          },
          "scheduledAt": {
            "type": "string",
            "format": "date-time",
            "description": "Per-contact scheduled time (ISO 8601), at least five seconds in the future. Omit to use the agent's schedule."
          },
          "toEmailAddress": {
            "type": "string",
            "format": "email",
            "description": "Required when the agent's sequence contains email steps."
          }
        },
        "additionalProperties": {
          "type": ["string", "number", "boolean"],
          "description": "Custom input variables defined on the agent. Numbers and booleans are converted to strings."
        }
      },
      "BulkScheduleResponse": {
        "type": "object",
        "required": ["batchId", "total", "accepted", "rejected"],
        "properties": {
          "batchId": {
            "type": "string",
            "example": "550e8400-e29b-41d4-a716-446655440000",
            "description": "Request correlation identifier: the trimmed Idempotency-Key when supplied, otherwise a generated UUID. This identifier is not a sequence ID."
          },
          "total": {
            "type": "integer",
            "description": "Total contacts submitted.",
            "example": 2,
            "minimum": 1,
            "maximum": 1000
          },
          "accepted": {
            "type": "integer",
            "description": "Contacts that passed upfront checks and were queued for background scheduling. Background creation can still fail.",
            "example": 2,
            "minimum": 1,
            "maximum": 1000
          },
          "rejected": {
            "type": "array",
            "description": "Per-contact validation failures (empty when all passed).",
            "items": {
              "$ref": "#/components/schemas/RejectedContact"
            }
          }
        },
        "example": {
          "batchId": "550e8400-e29b-41d4-a716-446655440000",
          "total": 2,
          "accepted": 2,
          "rejected": []
        }
      },
      "RejectedContact": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer",
            "description": "Zero-based index of the contact in the submitted `contacts` array.",
            "example": 1,
            "minimum": 0
          },
          "phoneNumber": {
            "type": "string",
            "example": "+12125550124",
            "description": "Present when a phone number is available. Invalid numbers may be returned as submitted; valid numbers are normalized to E.164."
          },
          "reason": {
            "type": "string",
            "description": "Rejection reason code.",
            "enum": [
              "MISSING_NAME",
              "MISSING_PHONE_NUMBER",
              "INVALID_PHONE_NUMBER",
              "INVALID_EMAIL",
              "INVALID_TIMEZONE",
              "INVALID_SCHEDULED_AT",
              "MISSING_CUSTOM_VARIABLES",
              "DUPLICATE_PHONE_NUMBER",
              "DUPLICATE_ACTIVE_SEQUENCE",
              "DO_NOT_CALL",
              "CALIFORNIA_RESTRICTION"
            ],
            "example": "MISSING_CUSTOM_VARIABLES"
          },
          "error": {
            "type": "string",
            "description": "Human-readable explanation.",
            "example": "Missing custom input variables: account_id."
          },
          "retryable": {
            "type": "boolean",
            "description": "Always false. Do not immediately retry the same contact unchanged. Correct invalid data, resolve a block, or wait until duplicate eligibility changes, then resubmit with a new Idempotency-Key.",
            "const": false,
            "example": false
          },
          "retryAfter": {
            "type": "string",
            "format": "date-time",
            "description": "For `DUPLICATE_ACTIVE_SEQUENCE`: the earliest time the contact can be accepted. Absent while an earlier sequence is still running."
          }
        },
        "required": ["index", "reason", "error", "retryable"]
      },
      "BulkScheduleError": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/BulkScheduleValidationError"
          },
          {
            "$ref": "#/components/schemas/BulkScheduleAllRejectedError"
          },
          {
            "$ref": "#/components/schemas/BulkScheduleInsufficientCreditsError"
          }
        ]
      },
      "CreditUsageResponse": {
        "type": "object",
        "required": ["period", "organization", "agents"],
        "properties": {
          "period": {
            "type": "object",
            "description": "Echo of the resolved reporting period. `month` is present in month mode only.",
            "required": ["type", "startDate", "endDate"],
            "properties": {
              "type": {
                "type": "string",
                "enum": ["month", "range"]
              },
              "month": {
                "type": "string",
                "description": "Billing month (`YYYY-MM`). Month mode only.",
                "example": "2026-05"
              },
              "startDate": {
                "type": "string",
                "format": "date"
              },
              "endDate": {
                "type": "string",
                "format": "date"
              }
            }
          },
          "organization": {
            "type": "object",
            "required": ["allocatedCredits", "spentCredits", "remainingCredits", "percentageUsed"],
            "properties": {
              "allocatedCredits": {
                "type": ["number", "null"],
                "description": "Credits allocated for the month. `null` in range mode or when no allocation is configured."
              },
              "spentCredits": {
                "type": "number",
                "description": "Credits spent in the period. Authoritative monthly figure in month mode; sum of per-agent spend in range mode."
              },
              "remainingCredits": {
                "type": ["number", "null"],
                "description": "Credits remaining. `null` in range mode."
              },
              "percentageUsed": {
                "type": ["number", "null"],
                "description": "Spent as a percentage of allocation, rounded to two decimals. `null` in range mode."
              }
            }
          },
          "agents": {
            "type": "array",
            "description": "Per-agent consumption breakdown from the credit ledger.",
            "items": {
              "type": "object",
              "required": ["agentId", "agentName", "spentCredits", "transactionCount"],
              "properties": {
                "agentId": {
                  "type": ["string", "null"],
                  "description": "`null` for spend not attributable to a specific agent."
                },
                "agentName": {
                  "type": ["string", "null"]
                },
                "spentCredits": {
                  "type": "number"
                },
                "transactionCount": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "CallResultsWebhookPayload": {
        "type": "object",
        "properties": {
          "agentId": {
            "type": "string",
            "example": "agent.abc123"
          },
          "agentName": {
            "type": "string",
            "example": "Inbound Agent"
          },
          "callId": {
            "type": "string",
            "example": "call.abc123"
          },
          "name": {
            "type": "string",
            "example": "Victor Wembly"
          },
          "phoneNumber": {
            "type": "string",
            "example": "+15551234567"
          },
          "phoneNumberExt": {
            "type": "string",
            "description": "Phone extension, empty string when none."
          },
          "fromPhoneNumber": {
            "type": "string",
            "description": "Phone number used to place the call. Empty string for web calls."
          },
          "scheduledAt": {
            "type": "string",
            "format": "date-time"
          },
          "callInitiatedAt": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "When the call started dialing, in UTC, from the telephony provider. Null for calls without a phone leg (e.g. web calls) or when the timing has not been recorded yet."
          },
          "callEndedAt": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "When the call ended, in UTC, from the telephony provider. Null when the call did not complete or has no phone leg."
          },
          "timezone": {
            "type": "string",
            "description": "IANA timezone.",
            "example": "Europe/London"
          },
          "direction": {
            "type": "string",
            "enum": ["outbound", "inbound"]
          },
          "customInputVariables": {
            "type": "object",
            "description": "The custom input variables submitted when the contact was enrolled, echoed back verbatim. The set of keys is defined by your agent's configuration and varies per agent.",
            "additionalProperties": {
              "type": "string"
            }
          },
          "duration": {
            "type": "integer",
            "description": "Call duration in seconds."
          },
          "callUrl": {
            "type": "string",
            "format": "uri",
            "description": "Link to the call in the 11x platform."
          },
          "rescheduledAt": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "callResult": {
            "type": "object",
            "properties": {
              "resultType": {
                "type": "string",
                "description": "Human-readable call outcome. See the webhook guide for the full value table.",
                "enum": [
                  "Goal Completed",
                  "Goal Not Completed",
                  "Voicemail",
                  "Busy",
                  "No Conversation",
                  "Opted Out",
                  "Invalid Phone Number",
                  "Cancelled",
                  "Failed",
                  "Scheduled",
                  "Rescheduled",
                  "Processing Analysis",
                  "Calling"
                ]
              },
              "summary": {
                "type": "string",
                "description": "AI-generated call summary."
              },
              "extractedVariables": {
                "type": "object",
                "description": "Values the agent extracted from the conversation, keyed by the extraction variables configured on the agent. Both keys and values vary per agent.",
                "additionalProperties": true
              },
              "agentActions": {
                "type": "array",
                "description": "Actions performed by the AI agent.",
                "items": {
                  "$ref": "#/components/schemas/CallAction"
                }
              },
              "humanActions": {
                "type": "array",
                "description": "Actions requested by or assigned to a human.",
                "items": {
                  "$ref": "#/components/schemas/CallAction"
                }
              },
              "transcription": {
                "type": "string",
                "description": "Full call transcript."
              },
              "outcomes": {
                "type": "array",
                "description": "Outcomes assigned to the call. Each `name` is one of the customer-defined outcome definitions configured on the agent (not a fixed enum) — retrieve them with `GET /agents/{agentId}/outcomes`.",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "example": "interested"
                    },
                    "reasoning": {
                      "type": "string",
                      "example": "Customer expressed interest in the product"
                    }
                  }
                }
              },
              "followUpMeetingDetails": {
                "type": "object",
                "description": "Present when a meeting was booked during the call.",
                "properties": {
                  "meetingStartTime": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Meeting start in UTC (ISO 8601)."
                  },
                  "meetingEndTime": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Meeting end in UTC (ISO 8601)."
                  },
                  "hostEmail": {
                    "type": "string",
                    "format": "email"
                  },
                  "timezone": {
                    "type": "string",
                    "description": "IANA timezone of the meeting host's calendar profile. Prefer the UTC meetingStartTime/meetingEndTime for display and storage."
                  },
                  "meetingLink": {
                    "type": "string",
                    "description": "The booked meeting's join link for virtual meetings, or the physical location/address for in-person bookings. Present when available."
                  },
                  "source": {
                    "type": "string",
                    "description": "Present only for meetings booked via ChiliPiper (value: \"chilipiper\"). Absent for Cal.com bookings."
                  },
                  "status": {
                    "type": "string",
                    "enum": ["cancelled", "rescheduled"],
                    "description": "Present only after the booking was cancelled or rescheduled."
                  },
                  "cancelledAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Present only when the booking was cancelled."
                  },
                  "rescheduledAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Present only after the booking was rescheduled."
                  },
                  "previousMeetingTimes": {
                    "type": "array",
                    "description": "Present only after reschedules: the prior slots this meeting occupied, oldest first.",
                    "items": {
                      "type": "object",
                      "properties": {
                        "meetingStartTime": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "meetingEndTime": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "replacedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    }
                  }
                },
                "additionalProperties": true
              }
            }
          },
          "crmSchedulingDetails": {
            "type": "object",
            "description": "CRM integration details, when applicable.",
            "additionalProperties": true
          },
          "sequence": {
            "type": "object",
            "description": "Present when the call belongs to a sequence.",
            "properties": {
              "sequenceId": {
                "type": "string",
                "example": "call-sequence.xyz123"
              },
              "lifecycleStatus": {
                "type": "string",
                "enum": ["done", "in progress", "cancelled", "failed"],
                "description": "Whether the contact is still actively enrolled."
              }
            }
          },
          "promptVersionId": {
            "type": "string",
            "description": "The published prompt version used for the call. Present when a prompt version was captured for the call.",
            "example": "prompt-ver.abc123"
          }
        }
      },
      "CallAction": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "example": "Scheduled follow-up meeting"
          },
          "status": {
            "type": "string",
            "example": "completed"
          },
          "actionKey": {
            "type": "string",
            "example": "schedule_meeting"
          },
          "completedAt": {
            "type": "string",
            "description": "ISO 8601 timestamp, empty string when not completed."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "MeetingAttendee": {
        "type": "object",
        "required": ["email"],
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "example": "guest@example.com"
          },
          "name": {
            "type": "string",
            "description": "Included when the calendar provider has a value for it.",
            "example": "Jane Doe"
          },
          "timeZone": {
            "type": "string",
            "description": "IANA timezone. Included when the calendar provider has a value for it.",
            "example": "America/New_York"
          },
          "phoneNumber": {
            "type": "string",
            "description": "E.164 phone number. Included when the calendar provider has a value for it.",
            "example": "+15555550123"
          }
        }
      },
      "MeetingAttendeesResponse": {
        "type": "object",
        "required": ["entityId", "bookingUid", "attendees"],
        "properties": {
          "entityId": {
            "type": "string",
            "example": "call.abc123"
          },
          "bookingUid": {
            "type": "string",
            "description": "UID of the calendar booking linked to the conversation."
          },
          "attendees": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MeetingAttendee"
            }
          }
        }
      },
      "AddMeetingAttendeesRequest": {
        "type": "object",
        "required": ["attendees"],
        "properties": {
          "attendees": {
            "type": "array",
            "minItems": 1,
            "maxItems": 30,
            "description": "Attendees to add (1–30 per request).",
            "items": {
              "type": "object",
              "required": ["email", "name"],
              "properties": {
                "email": {
                  "type": "string",
                  "format": "email",
                  "description": "Attendee email address.",
                  "example": "guest@example.com"
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "description": "Attendee display name.",
                  "example": "Jane Doe"
                },
                "timeZone": {
                  "type": "string",
                  "description": "IANA timezone for the attendee. Defaults to the meeting's timezone when omitted.",
                  "example": "America/New_York"
                },
                "phoneNumber": {
                  "type": "string",
                  "description": "Attendee phone number in E.164 format.",
                  "example": "+15555550123"
                },
                "language": {
                  "type": "string",
                  "description": "Attendee language code.",
                  "enum": [
                    "ar",
                    "az",
                    "bg",
                    "ca",
                    "cs",
                    "da",
                    "de",
                    "el",
                    "en",
                    "es",
                    "es-419",
                    "et",
                    "eu",
                    "fi",
                    "fr",
                    "he",
                    "hr",
                    "hu",
                    "id",
                    "it",
                    "iw",
                    "ja",
                    "km",
                    "ko",
                    "lv",
                    "nl",
                    "no",
                    "pl",
                    "pt",
                    "pt-BR",
                    "ro",
                    "ru",
                    "sk",
                    "sr",
                    "sv",
                    "ta",
                    "th",
                    "tr",
                    "uk",
                    "vi",
                    "zh-CN",
                    "zh-TW"
                  ],
                  "example": "en"
                }
              }
            }
          }
        }
      },
      "CancelMeetingRequest": {
        "type": "object",
        "description": "Optional. Send an empty body to cancel with no extra options.",
        "properties": {
          "cancellationReason": {
            "type": "string",
            "description": "Human-readable reason for the cancellation. May be shared with attendees by the calendar provider."
          },
          "cancelSubsequentBookings": {
            "type": "boolean",
            "description": "For recurring (non-seated) bookings only. When `true`, cancels this booking and all following occurrences in the series."
          }
        }
      },
      "CancelMeetingResponse": {
        "type": "object",
        "required": ["entityId", "bookingUid", "status"],
        "properties": {
          "entityId": {
            "type": "string",
            "example": "call.abc123"
          },
          "bookingUid": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["cancelled"],
            "example": "cancelled"
          }
        }
      },
      "SearchConversationsResponse": {
        "type": "object",
        "required": ["sequenceIds", "pagination"],
        "properties": {
          "sequenceIds": {
            "type": "array",
            "description": "Matching conversation sequence IDs.",
            "items": {
              "type": "string"
            },
            "example": ["call-sequence.abc123", "call-sequence.def456"]
          },
          "pagination": {
            "type": "object",
            "required": ["total", "limit", "offset", "hasMore"],
            "properties": {
              "total": {
                "type": "integer",
                "description": "Total matching conversations.",
                "example": 2
              },
              "limit": {
                "type": "integer",
                "example": 100
              },
              "offset": {
                "type": "integer",
                "example": 0
              },
              "hasMore": {
                "type": "boolean",
                "description": "Whether more results exist beyond this page.",
                "example": false
              }
            }
          }
        }
      },
      "ConversationMetadataResponse": {
        "type": "object",
        "required": ["sequenceId", "metadata"],
        "properties": {
          "sequenceId": {
            "type": "string",
            "example": "call-sequence.abc123"
          },
          "metadata": {
            "type": "array",
            "description": "One metadata object per call step in the sequence.",
            "items": {
              "$ref": "#/components/schemas/ConversationCallMetadata"
            }
          }
        }
      },
      "ConversationCallMetadata": {
        "description": "Per-call-step metadata. Mirrors the call-results webhook payload, plus fields specific to the metadata API.",
        "allOf": [
          {
            "$ref": "#/components/schemas/CallResultsWebhookPayload"
          },
          {
            "type": "object",
            "properties": {
              "attempt": {
                "type": "integer",
                "description": "1-based call attempt number for this step.",
                "example": 1
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "description": "When the call record was created."
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "description": "When the call record was last updated."
              },
              "callStatus": {
                "type": "string",
                "description": "Internal call status (outcome) for the step.",
                "example": "goal-not-completed"
              },
              "recordingUrl": {
                "type": "string",
                "format": "uri",
                "description": "Signed recording URL. Only present when `includeRecording=true` and a recording is available."
              }
            }
          }
        ]
      },
      "CallRecordingEntry": {
        "type": "object",
        "description": "Recording — and optionally transcript — for a single call.",
        "properties": {
          "callId": {
            "type": "string",
            "example": "call.abc123"
          },
          "recordingStatus": {
            "type": "string",
            "enum": ["downloaded", "no-recording", "call-not-found"],
            "description": "Whether audio was located for this call. Describes the **audio only** — a call can have a transcript and no recording, so do not filter on this value when you also want transcripts.\n\n- `downloaded` — audio was located and `url` is present.\n- `no-recording` — the call has no retrievable audio (never recorded, cleaned up, or hosted by a provider this API cannot sign for).\n- `call-not-found` — no call exists for the id."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Short-lived link to the call audio. Absent when `recordingStatus` is not `downloaded`.\n\nTreat this as a secret: anyone holding the URL can fetch the audio until it expires, so do not forward it into tickets or third-party tools."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "When `url` stops working — **3 hours** after the response is generated. Present only for URLs this API signs; provider-hosted audio carries its own lifetime, which we do not control and therefore do not report. Re-fetch with `GET /recordings/{callId}` at any time."
          },
          "durationSeconds": {
            "type": "integer",
            "example": 184
          },
          "scheduledAt": {
            "type": "string",
            "format": "date-time"
          },
          "stepNumber": {
            "type": "integer",
            "description": "Position of this call within its sequence.",
            "example": 1
          },
          "transcript": {
            "type": "string",
            "description": "Formatted transcript text. Present only when transcripts were requested and the call has one — independent of `recordingStatus`.",
            "example": "[Agent] (0:00): Hi, is this Victor?"
          }
        },
        "required": ["callId", "recordingStatus"]
      },
      "SequenceRecordings": {
        "type": "object",
        "properties": {
          "sequenceId": {
            "type": "string",
            "example": "call-sequence.xyz123"
          },
          "calls": {
            "type": "array",
            "description": "One entry per call in the sequence, ordered by call step.",
            "items": {
              "$ref": "#/components/schemas/CallRecordingEntry"
            }
          }
        },
        "required": ["sequenceId", "calls"]
      },
      "RecordingsRequest": {
        "type": "object",
        "properties": {
          "sequenceIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "minItems": 1,
            "maxItems": 100,
            "description": "Conversation sequence IDs, as returned by `GET /conversations/search/{agentId}`. Duplicates are collapsed.",
            "example": ["call-sequence.xyz123", "call-sequence.xyz456"]
          },
          "includeTranscripts": {
            "type": "boolean",
            "default": false,
            "description": "When `true`, include each call's transcript text alongside its recording."
          }
        },
        "required": ["sequenceIds"]
      },
      "RecordingsResponse": {
        "type": "object",
        "properties": {
          "recordings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SequenceRecordings"
            }
          },
          "notFound": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Requested sequence IDs that do not exist or do not belong to your organization. Omitted when every requested ID resolved."
          }
        },
        "required": ["recordings"]
      },
      "BulkScheduleValidationError": {
        "type": "object",
        "required": ["error", "message", "retryable"],
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "INVALID_REQUEST_BODY",
              "INVALID_REQUEST",
              "INVALID_TIMEZONE",
              "MISSING_TIMEZONE",
              "AGENT_NOT_ACTIVE",
              "AGENT_SCHEDULE_NOT_CONFIGURED",
              "INVALID_IDEMPOTENCY_KEY"
            ]
          },
          "message": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean",
            "const": false
          }
        }
      },
      "BulkScheduleAllRejectedError": {
        "type": "object",
        "required": ["error", "message", "retryable", "batchId", "total", "accepted", "rejected"],
        "properties": {
          "error": {
            "type": "string",
            "const": "ALL_CONTACTS_REJECTED"
          },
          "message": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean",
            "const": false
          },
          "batchId": {
            "type": "string",
            "example": "550e8400-e29b-41d4-a716-446655440000",
            "description": "Request correlation identifier: the trimmed Idempotency-Key when supplied, otherwise a generated UUID. This identifier is not a sequence ID."
          },
          "total": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000
          },
          "accepted": {
            "type": "integer",
            "const": 0
          },
          "rejected": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/RejectedContact"
            }
          }
        }
      },
      "BulkScheduleInsufficientCreditsError": {
        "type": "object",
        "required": ["error", "message", "retryable", "result"],
        "properties": {
          "error": {
            "type": "string",
            "const": "INSUFFICIENT_CREDITS"
          },
          "message": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean",
            "const": true,
            "description": "Retry after enough organization credits become available."
          },
          "result": {
            "type": "object",
            "required": ["contacts_requested", "credits_available"],
            "properties": {
              "contacts_requested": {
                "type": "integer",
                "minimum": 1,
                "description": "Contacts that passed upfront checks."
              },
              "credits_available": {
                "type": "number",
                "description": "Available organization credits at the time of the request."
              }
            }
          }
        }
      },
      "BulkScheduleUnauthorizedError": {
        "type": "object",
        "required": ["error", "message"],
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "UNAUTHORIZED",
              "INVALID_API_KEY",
              "HMAC_HEADERS_MISSING",
              "HMAC_TIMESTAMP_INVALID",
              "INVALID_HMAC_SIGNATURE"
            ]
          },
          "message": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean",
            "const": false,
            "description": "Present on wrong-organization and request-signing failures; omitted on API-key authentication failures."
          }
        }
      },
      "BulkScheduleAgentNotFoundError": {
        "type": "object",
        "required": ["error", "message", "retryable"],
        "properties": {
          "error": {
            "type": "string",
            "const": "AGENT_NOT_FOUND"
          },
          "message": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean",
            "const": false
          }
        }
      },
      "BulkScheduleRateLimitError": {
        "type": "object",
        "required": ["error", "message", "retryable"],
        "properties": {
          "error": {
            "type": "string",
            "const": "RATE_LIMITED"
          },
          "message": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "BulkScheduleIdempotencyInProgressError": {
        "type": "object",
        "required": ["error", "message", "retryable"],
        "properties": {
          "error": {
            "type": "string",
            "const": "IDEMPOTENCY_KEY_IN_PROGRESS"
          },
          "message": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "BulkScheduleIdempotencyKeyReusedError": {
        "type": "object",
        "required": ["error", "message", "retryable"],
        "properties": {
          "error": {
            "type": "string",
            "const": "IDEMPOTENCY_KEY_REUSED"
          },
          "message": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean",
            "const": false
          }
        }
      },
      "BulkScheduleUnsupportedMediaTypeError": {
        "type": "object",
        "required": ["error", "message", "retryable"],
        "properties": {
          "error": {
            "type": "string",
            "const": "UNSUPPORTED_MEDIA_TYPE"
          },
          "message": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean",
            "const": false
          }
        }
      }
    }
  }
}
