{
  "openapi": "3.1.0",
  "info": {
    "title": "Ask Benny Partner API",
    "version": "1.0.0",
    "description": "Programmatic access to your partner workspace: manage clients, start their platform access, and keep your systems in sync.\n\n## How it fits together\n\n![Partner API architecture: your systems authenticate with an API key, walk the /v1 request pipeline, and reach the endpoints; endpoints call the shared domain cores, which read the workspace data store and coordinate payments, calling and email — the same cores behind the partner dashboard and the client application](./architecture.svg)\n\n## Quickstart\n\n1. Create an API key from **Dashboard -> Business -> API Keys** (an active platform subscription is required). The full key is shown **once** - store it in your secret manager.\n2. Send it on every request:\n\n```bash\ncurl https://api.askbennypartners.com/v1/account \\\n  -H \"Authorization: Bearer <your api key>\"\n```\n\n3. List your clients:\n\n```bash\ncurl \"https://api.askbennypartners.com/v1/clients?limit=25\" \\\n  -H \"Authorization: Bearer <your api key>\"\n```\n\n## Authentication\n\nEvery request carries `Authorization: Bearer <api key>`. Keys are scoped - a request needs the scope listed on its operation (a missing scope returns **403 MISSING_SCOPE** with the required scope in `details`). Revoking a key from the dashboard takes effect immediately. Keys only authenticate while your account is active.\n\nUse a dedicated low-scope key when experimenting here: requests from this page run against **live data**.\n\n## Errors\n\nEvery error uses one envelope:\n\n```json\n{ \"error\": \"Client not found\", \"code\": \"NOT_FOUND\", \"statusCode\": 404, \"traceId\": \"...\" }\n```\n\n`code` is stable and machine-readable: `VALIDATION_ERROR` (400 - every issue listed in `details.issues`), `UNAUTHORIZED` (401), `FORBIDDEN` / `MISSING_SCOPE` / `SETUP_INCOMPLETE` (403), `NOT_FOUND` (404), `CONFLICT` / `IDEMPOTENCY_CONFLICT` (409), `CARD_ON_FILE_REQUIRED` / `PAYMENT_FAILED` (402), `TOO_MANY_REQUESTS` (429), `INTERNAL_ERROR` (500). Include `traceId` when contacting support.\n\n## Pagination\n\nList endpoints return `{ \"data\": [...], \"nextCursor\": \"...\" | null }`. Pass `limit` (bounded per endpoint) and follow `nextCursor` - an opaque token with no format guarantee - until it is `null`. Filtered pages can hold fewer than `limit` items while more pages remain.\n\n## Partial updates\n\n`PATCH` merges. Send only the fields you are changing, and everything you omit keeps its current value - a client settings save can be as small as `{\"agent\": {\"selectedVoiceKey\": \"ava\"}}`. Sections and fields you leave out are never read, so there is no need to fetch the object first and echo it back. Each write operation on this page shows a minimal request example; copy that shape rather than a full object read from a `GET`, or you will write placeholder values over settings that are already correct.\n\n`PUT` replaces. The only one is `PUT /clients/{clientId}/call-plan`: the plan you send becomes the whole plan, and any node or edge you leave out is removed.\n\nLists are the exception to merging. An array you send replaces the stored list wholesale, so `business.coreServices`, `agent.supportedLanguages`, `dataCollection.fields`, and `hours.weeklyHours` must each carry the complete list you want to end up with - send every entry, not just the new ones, or omit the array to leave the stored list alone. Two of them also have required parts: `dataCollection.fields` is required whenever you send the `dataCollection` section, and every `hours.weeklyHours` row needs all four of `day`, `open`, `close`, and `isOpen`.\n\n## Idempotency\n\nOperations with billing or calling side effects require an `Idempotency-Key` header (any unique string, up to 255 chars). Retrying with the **same key and identical request** replays the original response (marked `Idempotency-Replayed: true`); the same key with a **different** request returns **409 IDEMPOTENCY_CONFLICT**; keys are remembered for 24 hours. If a request fails, retry with the same key - failed attempts are released so the retry executes. The exception is campaign create/retry: once dispatch to the calling network may have started, a failed attempt **consumes** the key (the same key replays the stored error) - check the campaign list, then use a fresh key, so a retry can never dial your recipients twice.\n\n## Rate limits\n\n120 requests/minute per key across the API; sensitive operations (like client creation) allow 10/minute. Responses carry `X-RateLimit-Limit`, `X-RateLimit-Remaining`, and `X-RateLimit-Reset`; a **429** includes `Retry-After` in seconds.\n\n## Getting a client ready\n\nOne call does most of it. `POST /clients` creates the client, starts its platform access on your card on file with a **7-day free trial** (your card is first charged when the trial ends), and - when you include the `onboarding` block - builds their voice agent from the business profile you supply.\n\n```bash\ncurl -X POST https://api.askbennypartners.com/v1/clients \\\n  -H \"Authorization: Bearer <your api key>\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{\n        \"name\": \"Acme Plumbing\",\n        \"contactEmail\": \"owner@acmeplumbing.com\",\n        \"onboarding\": {\n          \"businessName\": \"Acme Plumbing\",\n          \"businessPhone\": \"+14035550142\",\n          \"websiteUrl\": \"https://acmeplumbing.com\"\n        }\n      }'\n```\n\nWhat happens, in order:\n\n1. The client is created as a `draft` and your seat subscription starts its trial.\n2. Their voice agent is built from the `onboarding` profile - `businessName` and `businessPhone` are required, plus either `websiteUrl` or `businessAddress`. The website also seeds what the assistant knows about the business.\n3. Once the seat is confirmed, the client moves to `invited` and the owner is emailed. With an `onboarding` block that email is a branded **\"your account is ready\"** sign-in link rather than a setup invite - there are no onboarding steps left for them to complete.\n4. The owner gets portal access. Either they sign in from that email, or you skip the wait with `POST /clients/{clientId}/activate` - see below.\n\nOmit `onboarding` and the client instead receives a setup invite and completes the profile themselves; their agent is built at the end of that.\n\n### Correcting the business website\n\nThe create payload remains `onboarding.websiteUrl`. It seeds the internal training website and is returned as `business.websiteUrl` by `GET /clients/{clientId}/settings`. Updating another settings section preserves this source.\n\nAfter provisioning, use a key with `client_settings:write` and send only the website correction:\n\n```http\nPATCH /v1/clients/{clientId}/settings\nContent-Type: application/json\nAuthorization: Bearer <your api key>\n\n{ \"training\": { \"websiteUrl\": \"https://acmeplumbing.com\" } }\n```\n\nThe URL must be a non-empty HTTP or HTTPS URL, at most 2,000 characters. Omit it to leave the source unchanged; null and empty strings are rejected. The client's platform billing must be active or trialing. The update saves the source and queues a knowledge refresh; inspect `agent.knowledgeRefresh` for progress. A failed refresh keeps the saved source and reports its status. `business.websiteUrl` remains a read-only response field, so do not echo it into the business patch. Creating the client again is not an update mechanism.\n\n### Activating a client yourself\n\nUntil someone signs in, a client has no portal login - so the client is not `active`, and you cannot open a support session for them. If you are onboarding the client yourself and want their workspace usable straight away, activate it:\n\n```bash\ncurl -X POST https://api.askbennypartners.com/v1/clients/<clientId>/activate \\\n  -H \"Authorization: Bearer <your api key>\"\n```\n\nThat creates the owner's login from the `contactEmail` on the client, moves the client to `active`, and makes support impersonation possible. The owner can still sign in with their email whenever they like - nothing about their normal access changes.\n\nSafe to repeat: a client whose owner already has access returns `alreadyActive: true` and nothing changes. Two things to know:\n\n- Only clients created through this API can be activated. Clients created in the dashboard keep the ordinary email sign-in.\n- The client needs a **pending owner invite**. If it has already been accepted or has expired, send a fresh one with `POST /clients/{clientId}/invites/resend` and activate again.\n\nBecause this grants access without the owner confirming their email, it is recorded in your workspace audit trail against the API key that made the call.\n\nSettings, hours and services can be changed any time afterwards with `PATCH /clients/{clientId}/settings`.\n\n### Call recordings and active-client access\n\nCalls (including recordings), contacts, and outbound operations require the client to be `active` and its platform billing to be `active` or `trialing`. Otherwise the API returns `403 CLIENT_ACCESS_INACTIVE`. Client creation, client/billing reads, onboarding settings, knowledge-base setup, invitations and activation remain available before activation under their existing billing and scope rules.\n\nWhen a call has `audioAvailable: true`, request `GET /clients/{clientId}/calls/{callId}/audio` with a key that has `calls:read`. The response contains `audioUrl` and `expiresInSeconds: 300`. Use the URL as an audio player's source or fetch it to download the MP3; do not send your API key to that URL. Request a fresh URL after five minutes. The response must not be cached, and obtaining a URL does not mark the call viewed.\n\nAnyone holding the recording URL can access it until it expires, including if the client is paused or the API key is revoked after issuance. Keep it private. A missing call or recording returns 404.\n\n### Steering the assistant: the business prompt\n\n`business.businessInstructions` is free-text guidance the assistant follows on **every** call, on top of what it learned from the website or address. Use it for the things a new receptionist would need to be told and could not infer:\n\n- House rules — *\"we do not quote prices over the phone\"*, *\"always confirm the service address before booking\"*.\n- Tone — how formal to be, what to call the business.\n- Edge cases — what to do about after-hours emergencies, which jobs to decline, when to take a message instead of booking.\n\n```bash\ncurl -X PATCH https://api.askbennypartners.com/v1/clients/<clientId>/settings \\\n  -H \"Authorization: Bearer <your api key>\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n        \"business\": {\n          \"businessInstructions\": \"Always confirm the service address before booking. Never quote prices - offer a callback from the owner instead.\"\n        }\n      }'\n```\n\nIt is the same field the client edits as their **business prompt** in their own dashboard, so the two of you are writing to one place - a later edit from either side replaces it rather than merging. Read the current value from `GET /clients/{clientId}/settings` first if you are appending to it rather than replacing it.\n\nAt most 800 words and 16,000 characters. Send an empty string to clear it. Prefer plain, specific instructions over long prose - it is read on every call.\n\n### Retail plans and `planId`\n\nA **plan** is a tier you sell to your own clients - name, price, trial length. Create and price them in **Dashboard -> Business -> Plans**; read them with `GET /plans` (scope `clients:read`) to discover the `planId` values this endpoint accepts. Only `active` plans can be attached.\n\n`planId` is optional, and the choice decides who pays for the client:\n\n| `planId` | Who pays | The client's first sign-in |\n| --- | --- | --- |\n| omitted | You - your seat covers their access | Straight to their dashboard |\n| an ordinary plan | The client, through the platform | Lands on checkout for that plan |\n| a plan marked billed externally | You invoice them yourself, off-platform | Straight to their dashboard |\n\nAttaching an ordinary plan means the client is asked to pay before they can use anything. That is the right choice when you want the platform to collect for you and route the money to your connected account.\n\n### Plans you bill yourself\n\nIf you already invoice a client - an existing contract, a bundle, a retainer - you still want the record of which tier they are on, but you do not want the platform asking them for money. Tick **\"I bill clients for this plan myself\"** on the plan and it is returned by `GET /plans` as `billedExternally: true`.\n\nClients attached to such a plan skip checkout entirely and sign straight in to their dashboard, exactly as if no plan were attached - your seat still covers their access - while the plan records their tier. No subscription or invoice is ever created for them here, so they show as **Billed externally** in your dashboard rather than as a paying subscription.\n\nTwo things worth knowing:\n\n- The setting lives on the **plan**, not the price. A $0 plan is not automatically treated this way, and repricing a plan never changes who collects for the clients already on it.\n- The option only appears in the dashboard once you have an **active API key**, because it only changes behaviour for clients created through this API. Clients you create in the dashboard follow the ordinary retail flow whatever the plan says.\n\n### If billing cannot start\n\nYou get **402** with `details.clientId`. The client exists; only the billing step failed. Fix the payment method in the dashboard, then repeat the call with the same `contactEmail` and a **new** `Idempotency-Key` - the billing step resumes on that existing draft instead of failing as a duplicate.\n\n## Voices\n\n`GET /voices` lists the full voice catalog - the same voices, in the same order, your clients see in their own application. Each entry carries a stable `key`, a display name, `gender`, the `accent` it speaks with (American, British, Indian, Australian, Nigerian and more), short `tone` descriptors, a one-line `description`, and a `previewUrl`.\n\nListen before you choose: `GET /voices/{voiceKey}/preview` returns a short MP3 of that voice speaking the assistant's standard greeting. Samples are deterministic, so cache them freely.\n\nA voice's `languages` (and `primaryLanguage`) are the languages it sounds native in, using the same codes as `agent.supportedLanguages` - regional variants collapse to their base code, so a British voice reports `en` and carries \"British\" in `accent`. They are catalog facts, not a limit: what the assistant actually speaks is set by `agent.supportedLanguages`.\n\nApply a voice with `PATCH /clients/{clientId}/settings` and `{\"agent\": {\"selectedVoiceKey\": \"<key>\"}}` - any `key` from `GET /voices`. The client's assistant must already be set up. `GET /clients/{clientId}/settings` reports the current voice back as `agent.selectedVoiceKey`.\n\nTwo older keys, `ava` and `miles`, are still accepted; they are aliases of the `ava` and `jason` voices.\n\n## Bring your own API\n\nConnect a customer's existing system to their voice assistant with `/clients/{clientId}/api-endpoints`. This is the same configuration available in Settings → API Endpoints. Add a public HTTPS endpoint, HTTP method, when-to-use description, request fields, and a bearer token or API-key header. Credentials are encrypted and write-only; the assistant calls through an authenticated proxy.\n\nThe sequence is **create → verify → enable**. `POST /clients/{clientId}/api-endpoints` saves a disabled endpoint. `POST /clients/{clientId}/api-endpoints/{endpointId}/verify` sends one real request using `sampleValues`; use a customer sandbox or their supported no-write test mode, because verification can change records. No universal verification flag is added. Then `PATCH /clients/{clientId}/api-endpoints/{endpointId}` with `{\"enabled\":true}` attaches the tool to the voice assistant. Configuration edits require verification again. Disabling revokes access before detaching the tool.\n\nVerification returns `ok`, the redacted endpoint, a safe diagnostic message, and the customer HTTP `status` (null if no response arrived). HTTP 401/403 points to credentials or permissions; 404 to the path/method; 429 to rate limiting. A 2xx response can still fail the configured response schema. No customer response body is exposed by verification.\nReads use `client_settings:read`; writes use `client_settings:write`. POST creation and verification require `Idempotency-Key`. There are at most ten endpoints per client. GET request fields become query parameters; other methods send JSON. `requestTemplate` can map fields using `{{field_name}}` placeholders; leave it as `{}` to send the fields directly. Optional `responseSchema` supports structural type/properties/required/items validation. Requests have a 1–8 second timeout, a 1 MB response cap and a shared 30 requests/minute endpoint limit. Customer requests are never automatically retried.\n\n### Request template walkthrough\n\n`requestTemplate` and `responseSchema` are **JSON-encoded strings, not JSON objects** in the create/update request. The reference displays them as string fields, so there are no nested properties to expand. The examples below show the decoded JSON and the complete payload to send. In JavaScript, use `JSON.stringify(object)` for each field; in raw JSON, escape the inner quotes as shown in the complete creation example.\n\nStart simple: omit `requestTemplate` or send the string `\"{}\"` to forward the declared, collected fields directly. For example, `sampleValues: {\"caller_name\":\"Alex\"}` produces `{\"caller_name\":\"Alex\"}`. The template is not a list of fields for the agent to collect: declare those separately in `parameters`.\n\nTo match a customer API's nested payload, use this decoded template:\n\n```json\n{\n  \"customer\": {\n    \"name\": \"{{caller_name}}\"\n  },\n  \"request\": {\n    \"units\": \"{{units}}\",\n    \"urgent\": \"{{urgent}}\",\n    \"notes\": \"{{notes}}\"\n  },\n  \"source\": \"voice_assistant\"\n}\n```\n\nEvery placeholder must name a declared parameter. A whole-value placeholder such as `\"{{units}}\"` preserves the supplied number or boolean; embedding it in text such as `\"Units: {{units}}\"` produces a string. Fixed values such as `source` are sent unchanged. If an optional value is missing, a whole-value placeholder removes that property (or array item); an embedded placeholder becomes empty text. Missing required values fail before a customer request is sent. Keep credentials in `auth`, never in templates.\n\nWith `sampleValues` below (notice that numbers and booleans are not quoted):\n\n```json\n{\n  \"caller_name\": \"Alex\",\n  \"units\": 2,\n  \"urgent\": false\n}\n```\n\nThe customer's POST endpoint receives:\n\n```json\n{\n  \"customer\": {\n    \"name\": \"Alex\"\n  },\n  \"request\": {\n    \"units\": 2,\n    \"urgent\": false\n  },\n  \"source\": \"voice_assistant\"\n}\n```\n\nGET endpoints send the rendered fields as query parameters; use flat scalar fields for predictable query encoding. POST, PUT, PATCH and DELETE send a JSON body. Templates must decode to a JSON object and fit within 20 KB.\n\n### Response schema walkthrough\n\n`responseSchema` checks the customer API's JSON response during verification and live tool calls. It does not transform the response, configure request fields, or tell the assistant when to call the tool. Put tool-use instructions in `description`. Omit this field or send `\"\"` to disable response-shape validation. Even without a schema, the customer must return a successful HTTP status for verification to pass.\n\nThis decoded schema requires two string properties:\n\n```json\n{\n  \"type\": \"object\",\n  \"properties\": {\n    \"request_id\": {\n      \"type\": \"string\"\n    },\n    \"status\": {\n      \"type\": \"string\"\n    }\n  },\n  \"required\": [\n    \"request_id\",\n    \"status\"\n  ]\n}\n```\n\nMatching customer response:\n\n```json\n{\n  \"request_id\": \"REQ-123\",\n  \"status\": \"received\"\n}\n```\n\nA missing `request_id` or a numeric `request_id` fails validation, even with HTTP 200. Extra properties are allowed. The word `received` is illustrative: this schema checks that `status` is a string, not a particular business outcome.\n\nSupported validation keywords: `type`, `properties`, `required`, and `items`. Supported types: `object`, `array`, `string`, `number`, `integer`, `boolean`, and `null`. Use `items` to validate array elements. `title` and `description` are accepted annotations. This is a structural subset, not full JSON Schema: constraints such as `enum`, `format`, `additionalProperties`, `$ref`, `oneOf`, and numeric bounds are rejected. Schemas are limited to 20 KB and eight nested levels below the root. Verification reports success/failure and safe diagnostics, not the customer response body.\n\n### Complete creation example\n\nSend this body to `POST /clients/{clientId}/api-endpoints` with your Partner bearer token, `Content-Type: application/json`, and a new `Idempotency-Key`. Replace the example URL and customer token with your sandbox details. The Partner bearer token authenticates to our API; `auth.secret` authenticates to the customer's API. In the create operation's example selector, choose **Send fields directly (simplest)** or **Map a nested request and validate its response** to load a complete body.\n\n```json\n{\n  \"name\": \"create_service_request\",\n  \"description\": \"Create a service request after confirming the caller's name, number of units, and urgency. Collect notes if offered. Only confirm receipt when the API returns a request_id; do not promise a booking.\",\n  \"method\": \"POST\",\n  \"url\": \"https://api.example.com/service-requests\",\n  \"auth\": {\n    \"type\": \"bearer\",\n    \"secret\": \"YOUR_CUSTOMER_API_TOKEN\"\n  },\n  \"parameters\": [\n    {\n      \"name\": \"caller_name\",\n      \"type\": \"string\",\n      \"description\": \"The caller's name\",\n      \"required\": true\n    },\n    {\n      \"name\": \"units\",\n      \"type\": \"number\",\n      \"description\": \"Number of units requiring service\",\n      \"required\": true\n    },\n    {\n      \"name\": \"urgent\",\n      \"type\": \"boolean\",\n      \"description\": \"Whether the caller says the request is urgent\",\n      \"required\": true\n    },\n    {\n      \"name\": \"notes\",\n      \"type\": \"string\",\n      \"description\": \"Optional additional details from the caller\",\n      \"required\": false\n    }\n  ],\n  \"requestTemplate\": \"{\\\"customer\\\":{\\\"name\\\":\\\"{{caller_name}}\\\"},\\\"request\\\":{\\\"units\\\":\\\"{{units}}\\\",\\\"urgent\\\":\\\"{{urgent}}\\\",\\\"notes\\\":\\\"{{notes}}\\\"},\\\"source\\\":\\\"voice_assistant\\\"}\",\n  \"responseSchema\": \"{\\\"type\\\":\\\"object\\\",\\\"properties\\\":{\\\"request_id\\\":{\\\"type\\\":\\\"string\\\"},\\\"status\\\":{\\\"type\\\":\\\"string\\\"}},\\\"required\\\":[\\\"request_id\\\",\\\"status\\\"]}\"\n}\n```\n\nThe response contains the new endpoint `id`, with `enabled:false`. Next, send the following body to `POST /clients/{clientId}/api-endpoints/{endpointId}/verify` with a different `Idempotency-Key`. **Verification sends one real request and can create a record**; use a sandbox or a request the customer explicitly supports for safe testing.\n\n```json\n{\n  \"sampleValues\": {\n    \"caller_name\": \"Alex\",\n    \"units\": 2,\n    \"urgent\": false\n  }\n}\n```\n\nOnly after verification returns `ok:true`, enable it using `PATCH /clients/{clientId}/api-endpoints/{endpointId}` with `{\"enabled\":true}`. To edit later, send only changed fields. `requestTemplate: \"{}\"` restores direct field forwarding; `responseSchema: \"\"` removes validation. An omitted PATCH field stays unchanged. Configuration edits disable the endpoint and require verification again before enabling.\n\n## Knowledge-base documents\n\nUse `client_settings:read` for document reads and `client_settings:write` for uploads, usage changes, replacement and deletion. The client must have active platform access and a ready assistant before uploading. Supported files: PDF, TXT, DOCX, HTML and EPUB, up to 20 MiB.\n\n1. `POST /clients/{clientId}/knowledge-base/uploads` with `fileName` and the exact `fileSizeBytes`. Send a unique `Idempotency-Key`.\n2. POST multipart form data to the returned `url`, copying every entry in `fields` unchanged and adding the file **last**. Do not send your API bearer token to this temporary URL.\n3. Within five minutes, `POST /clients/{clientId}/knowledge-base/documents` with `uploadId` and optional `usageMode` (`auto` by default), using a new `Idempotency-Key`. The returned document is attached to the assistant.\n\n`GET /clients/{clientId}/knowledge-base/documents` lists documents (25 per page by default; follow `nextCursor`). Append `/{documentId}` to read a document, or `/{documentId}/download` for a temporary original-file download URL. Generated or older documents may not have an original file available.\n\n`PATCH /clients/{clientId}/knowledge-base/documents/{documentId}` with `{\"usageMode\":\"prompt\"}` includes the document in the assistant prompt; `auto` lets the assistant retrieve relevant passages when needed.\n\nTo replace file contents, prepare and upload a new file, then `POST /clients/{clientId}/knowledge-base/documents/{documentId}/replace` with its `uploadId`. Usage settings are inherited unless supplied. Replacement attaches the new document before removing the previous one and returns a **new document ID**. If removing the previous document fails, the 409 response provides both IDs for reconciliation. Generated website knowledge is read-only through this API.\n\n`DELETE /clients/{clientId}/knowledge-base/documents/{documentId}` removes the document from the agent and deletes its stored original. Send an `Idempotency-Key` for replayable deletion.\n\nRetry an uncertain upload or replacement with the **same request and original Idempotency-Key**. A submitted upload cannot be reused with a different key; list documents before starting another upload after an ambiguous failure. Keep temporary upload fields and download URLs private."
  },
  "servers": [
    {
      "url": "https://api.askbennypartners.com/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Account",
      "description": "The partner account your API key belongs to."
    },
    {
      "name": "Plans",
      "description": "Your retail plans: the subscription tiers you sell to clients. List them to discover the `planId` values accepted by client creation."
    },
    {
      "name": "Clients",
      "description": "The businesses in your workspace: create them, manage their lifecycle and contact details, and read their platform access billing state."
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "A partner API key created from Dashboard → Business → API Keys. Keys are shown once at creation."
      }
    },
    "schemas": {
      "Account": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Your partner account id.",
            "example": "8f14e45f-…"
          },
          "name": {
            "type": "string",
            "example": "Riverstone Agency"
          },
          "slug": {
            "type": "string",
            "example": "riverstone"
          },
          "status": {
            "type": "string",
            "enum": [
              "applied",
              "approved",
              "active",
              "paused"
            ],
            "description": "Account lifecycle status. API keys only authenticate for active accounts."
          },
          "contactEmail": {
            "type": "string",
            "example": "hello@riverstoneagency.com"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "ISO-8601 UTC timestamp."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Last update, as an ISO-8601 UTC timestamp."
          }
        },
        "required": [
          "id",
          "name",
          "slug",
          "status",
          "contactEmail",
          "createdAt",
          "updatedAt"
        ]
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "description": "Human-readable error message."
          },
          "code": {
            "type": "string",
            "description": "Stable machine-readable error code, e.g. VALIDATION_ERROR, UNAUTHORIZED, MISSING_SCOPE, NOT_FOUND, CONFLICT, TOO_MANY_REQUESTS."
          },
          "statusCode": {
            "type": "integer",
            "description": "HTTP status code, mirrored in the body."
          },
          "traceId": {
            "type": "string",
            "description": "Request trace id — include it when contacting support."
          },
          "details": {
            "description": "Structured context for some errors (e.g. validation issues, required scope)."
          }
        },
        "required": [
          "error",
          "code",
          "statusCode"
        ]
      },
      "PlanList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Plan"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "Plan": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The plan id. Pass an active plan's id as `planId` when creating a client."
          },
          "name": {
            "type": "string",
            "example": "Growth"
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "Optional plan description."
          },
          "priceCents": {
            "type": "integer",
            "description": "Monthly price in integer minor units (cents). 0 is a free plan.",
            "example": 29900
          },
          "currency": {
            "type": "string",
            "enum": [
              "cad"
            ],
            "description": "Billing currency."
          },
          "interval": {
            "type": "string",
            "enum": [
              "month"
            ],
            "description": "Billing interval."
          },
          "freeTrialDays": {
            "type": "integer",
            "description": "Free-trial length in days; 0 means no trial."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "archived"
            ],
            "description": "Plan lifecycle status. Only active plans can be attached to new clients; archived plans remain listed so historical plan ids stay resolvable."
          },
          "billedExternally": {
            "type": "boolean",
            "description": "True when you collect for this plan yourself rather than through the platform. A client on such a plan is never sent to checkout: they sign in straight to their dashboard, covered by the client seat you already pay, and the plan simply records which tier they are on. Set this on the plan in Dashboard → Business → Plans."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "ISO-8601 UTC timestamp."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Last update, as an ISO-8601 UTC timestamp."
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "priceCents",
          "currency",
          "interval",
          "freeTrialDays",
          "status",
          "billedExternally",
          "createdAt",
          "updatedAt"
        ]
      },
      "Voice": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "Stable voice key. Set it as `agent.selectedVoiceKey` on a client's settings.",
            "example": "ava"
          },
          "name": {
            "type": "string",
            "example": "Ava"
          },
          "gender": {
            "type": "string",
            "enum": [
              "female",
              "male"
            ]
          },
          "accent": {
            "type": "string",
            "description": "The regional accent the voice speaks with.",
            "example": "American"
          },
          "tone": {
            "type": "string",
            "description": "Short descriptors of the voice's character.",
            "example": "Clear, Helpful, Friendly"
          },
          "description": {
            "type": "string",
            "description": "What the voice sounds like and the conversations it suits."
          },
          "languages": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Language codes this voice speaks, in the same vocabulary as `agent.supportedLanguages`. Regional variants collapse to their base code — the accent is carried by `accent`.",
            "example": [
              "en",
              "fr"
            ]
          },
          "primaryLanguage": {
            "type": "string",
            "description": "The language this voice sounds most native in.",
            "example": "en"
          },
          "previewUrl": {
            "type": "string",
            "description": "Relative URL of an MP3 sample of this voice.",
            "example": "/v1/voices/ava/preview"
          }
        },
        "required": [
          "key",
          "name",
          "gender",
          "accent",
          "tone",
          "description",
          "languages",
          "primaryLanguage",
          "previewUrl"
        ]
      },
      "ClientList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Client"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Opaque cursor for the next page; null when there are no more results."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "Client": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The client id."
          },
          "name": {
            "type": "string",
            "example": "Acme Plumbing"
          },
          "slug": {
            "type": [
              "string",
              "null"
            ],
            "description": "Workspace-unique slug, when set."
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "invited",
              "onboarding",
              "active",
              "paused",
              "churned"
            ],
            "description": "Client lifecycle status."
          },
          "contactEmail": {
            "type": "string",
            "description": "Primary contact email."
          },
          "planId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Retail plan selected at API client creation; matches an id from GET /plans. Null when none was selected, including dashboard-created clients whose retail subscription is managed separately."
          },
          "createdVia": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "api",
              "dashboard",
              null
            ],
            "description": "How the client was created. Only api clients support API activation. Null for legacy records whose creation source was not recorded."
          },
          "retailPlanBilledExternally": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Client's stored snapshot of the selected plan's external billing mode. True means the Partner invoices this client directly. Null means no snapshot was recorded; it must not be interpreted as false or inferred from a zero price."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "ISO-8601 UTC timestamp."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "ISO-8601 UTC timestamp."
          }
        },
        "required": [
          "id",
          "name",
          "slug",
          "status",
          "contactEmail",
          "planId",
          "createdVia",
          "retailPlanBilledExternally",
          "createdAt",
          "updatedAt"
        ]
      },
      "ClientDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Client"
          },
          {
            "type": "object",
            "properties": {
              "billing": {
                "$ref": "#/components/schemas/ClientBilling"
              }
            },
            "required": [
              "billing"
            ]
          }
        ]
      },
      "ClientBilling": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "checkout_started",
              "incomplete",
              "incomplete_expired",
              "trialing",
              "active",
              "past_due",
              "canceled",
              "unpaid",
              "paused"
            ],
            "description": "Platform access billing status for this client."
          },
          "recurringPrice": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "unitAmountCents": {
                "type": "integer"
              },
              "quantity": {
                "type": "integer"
              },
              "currency": {
                "type": "string"
              },
              "interval": {
                "type": "string",
                "enum": [
                  "day",
                  "week",
                  "month",
                  "year"
                ]
              },
              "intervalCount": {
                "type": "integer"
              }
            },
            "required": [
              "unitAmountCents",
              "quantity",
              "currency",
              "interval",
              "intervalCount"
            ],
            "description": "Recorded fixed recurring seat price, before taxes, discounts and prorations. Multiply unitAmountCents by quantity for the recurring subtotal. Null until pricing is known or when no single fixed price applies; never assumes a default price."
          },
          "trialEndsAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the free trial ends; null unless the client is trialing. Immediately after a hosted-checkout trial starts this can briefly be null until billing reconciliation records the period end."
          },
          "currentPeriodEnd": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "End of the current billing period, when known."
          },
          "cancelAtPeriodEnd": {
            "type": "boolean",
            "description": "True when access is scheduled to end at the period boundary."
          }
        },
        "required": [
          "status",
          "recurringPrice",
          "trialEndsAt",
          "currentPeriodEnd",
          "cancelAtPeriodEnd"
        ],
        "description": "Platform access billing summary; null before billing is set up."
      },
      "ClientCreate": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "example": "Acme Plumbing"
          },
          "contactEmail": {
            "type": "string",
            "minLength": 3,
            "maxLength": 320,
            "description": "Primary contact email; must be unique within your workspace."
          },
          "slug": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "description": "Optional workspace-unique slug (lowercase letters, digits, hyphens)."
          },
          "planId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Optional retail plan to attach (one of your active plans with a price). When set, the client's first sign-in lands on checkout for this plan, paid by the client. When omitted — the default — no retail plan is attached and the client's platform access is covered entirely by your seat subscription."
          },
          "onboarding": {
            "$ref": "#/components/schemas/ClientOnboarding"
          }
        },
        "required": [
          "name",
          "contactEmail"
        ],
        "additionalProperties": false
      },
      "ClientOnboarding": {
        "type": "object",
        "properties": {
          "businessName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "example": "Acme Plumbing"
          },
          "businessPhone": {
            "type": "string",
            "minLength": 7,
            "maxLength": 40,
            "description": "Phone number where a human at the business can be reached; used as the call-transfer destination."
          },
          "websiteUrl": {
            "type": "string",
            "maxLength": 2000,
            "format": "uri",
            "description": "The business website. Provide this or businessAddress; the website also seeds the assistant's knowledge."
          },
          "businessAddress": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "The business street address, when there is no website to work from."
          },
          "industry": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "What the business does, e.g. \"plumbing\"; helps when only an address is given."
          }
        },
        "required": [
          "businessName",
          "businessPhone"
        ],
        "additionalProperties": false,
        "description": "Business-profile details collected up front so the client can sign straight in to their dashboard with no onboarding steps. When omitted, the client completes onboarding themselves from the emailed invite. Services and opening hours can be set any time via PATCH /clients/{clientId}/settings."
      },
      "ClientUpdate": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "invited",
              "onboarding",
              "active",
              "paused",
              "churned"
            ]
          },
          "contactEmail": {
            "type": "string",
            "minLength": 3,
            "maxLength": 320
          },
          "slug": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63
          }
        },
        "additionalProperties": false
      },
      "ClientActivation": {
        "type": "object",
        "properties": {
          "clientId": {
            "type": "string",
            "description": "The activated client."
          },
          "status": {
            "type": "string",
            "description": "The client's lifecycle status after activation.",
            "example": "active"
          },
          "alreadyActive": {
            "type": "boolean",
            "description": "True when the client's owner already had portal access, so this call changed nothing. The endpoint is safe to repeat."
          }
        },
        "required": [
          "clientId",
          "status",
          "alreadyActive"
        ]
      },
      "ClientInvite": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "description": "Invite status."
          },
          "email": {
            "type": "string",
            "description": "Where the invite was sent."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "ISO-8601 UTC expiry."
          }
        },
        "required": [
          "status",
          "email",
          "expiresAt"
        ]
      },
      "ClientSettings": {
        "type": "object",
        "properties": {
          "business": {
            "type": "object",
            "properties": {
              "businessName": {
                "type": "string",
                "example": "Acme Plumbing"
              },
              "businessPhone": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The business contact number, distinct from the assistant's assigned phoneNumber."
              },
              "websiteUrl": {
                "type": [
                  "string",
                  "null"
                ],
                "readOnly": true,
                "description": "Business website used as a knowledge source. Null when no website is configured. Supplied as onboarding.websiteUrl at creation; correct it later with training.websiteUrl in PATCH /clients/{clientId}/settings. This response field is read-only.",
                "example": "https://acmeplumbing.com"
              },
              "businessAddress": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "businessInstructions": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Free-text guidance the assistant follows on every call — tone, house rules, things it should always or never say. Shown to the client as their business prompt."
              },
              "appointmentLinkEnabled": {
                "type": "boolean",
                "description": "Whether callers can be offered a booking link."
              },
              "bookingUrl": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "callTransferEnabled": {
                "type": "boolean"
              },
              "transferPhoneNumber": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Human transfer destination, when call transfer is enabled."
              },
              "coreServices": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "businessName",
              "businessPhone",
              "websiteUrl",
              "businessAddress",
              "businessInstructions",
              "appointmentLinkEnabled",
              "bookingUrl",
              "callTransferEnabled",
              "transferPhoneNumber",
              "coreServices"
            ]
          },
          "hours": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "always",
                  "custom"
                ],
                "description": "\"always\" ignores the weekly schedule; \"custom\" applies it."
              },
              "timezone": {
                "type": "string",
                "example": "America/Toronto"
              },
              "weeklyHours": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "day": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 20,
                      "example": "monday"
                    },
                    "open": {
                      "type": "string",
                      "pattern": "^\\d{2}:\\d{2}$",
                      "example": "09:00",
                      "description": "24-hour HH:MM opening time."
                    },
                    "close": {
                      "type": "string",
                      "pattern": "^\\d{2}:\\d{2}$",
                      "example": "17:00",
                      "description": "24-hour HH:MM closing time."
                    },
                    "isOpen": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "day",
                    "open",
                    "close",
                    "isOpen"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "mode",
              "timezone",
              "weeklyHours"
            ]
          },
          "notifications": {
            "type": "object",
            "properties": {
              "emailEnabled": {
                "type": "boolean"
              },
              "emailAddress": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "smsEnabled": {
                "type": "boolean"
              },
              "smsPhone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "additionalEmails": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "additionalPhones": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "emailEnabled",
              "emailAddress",
              "smsEnabled",
              "smsPhone",
              "additionalEmails",
              "additionalPhones"
            ]
          },
          "agent": {
            "type": "object",
            "properties": {
              "phoneNumber": {
                "type": [
                  "string",
                  "null"
                ],
                "readOnly": true,
                "description": "Assigned assistant phone number in E.164 format. Null until a number is assigned. Separate from business.businessPhone (the business contact) and business.transferPhoneNumber (the human transfer destination).",
                "example": "+14155550111"
              },
              "provisioning": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "not_started",
                      "queued",
                      "running",
                      "ready",
                      "failed_retryable",
                      "failed_terminal",
                      "needs_manual_reconciliation",
                      "unsupported_country",
                      "cleanup_required"
                    ]
                  },
                  "updatedAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  }
                },
                "required": [
                  "status",
                  "updatedAt"
                ],
                "readOnly": true,
                "description": "Assistant and phone setup state. A phone number can be assigned before setup is ready; ready means provisioning completed. UpdatedAt is null when setup has not started. Internal stages and failure details are omitted."
              },
              "knowledgeRefresh": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "idle",
                      "queued",
                      "running",
                      "ready",
                      "failed"
                    ]
                  },
                  "updatedAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  }
                },
                "required": [
                  "status",
                  "updatedAt"
                ],
                "readOnly": true,
                "description": "Latest business-knowledge refresh state, separate from initial provisioning. Idle means no refresh has been requested; updatedAt is null until a refresh is recorded."
              },
              "agentName": {
                "type": "string",
                "description": "Name the assistant introduces itself with."
              },
              "firstMessage": {
                "type": "string",
                "description": "Opening line for inbound calls."
              },
              "language": {
                "type": "string",
                "description": "Primary conversation language code."
              },
              "supportedLanguages": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Language codes the assistant can switch to mid-call."
              },
              "requireCallerName": {
                "type": "boolean"
              },
              "requireCallerEmail": {
                "type": "boolean"
              },
              "rememberPastCalls": {
                "type": "boolean",
                "description": "Whether the assistant recalls a caller's previous calls."
              },
              "takeMessages": {
                "type": "boolean"
              },
              "specificQuestions": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Extra questions the assistant asks every caller."
              },
              "selectedVoiceKey": {
                "type": "string",
                "enum": [
                  "mark",
                  "sam",
                  "chris",
                  "helen",
                  "samara",
                  "jessica",
                  "eve",
                  "juniper",
                  "hope",
                  "monika",
                  "arabella",
                  "blondie",
                  "alexandra",
                  "ivanna",
                  "marcela",
                  "santiago",
                  "brad",
                  "ben",
                  "agustin",
                  "adam",
                  "archer",
                  "abraham",
                  "mark-2",
                  "danielle",
                  "felix",
                  "alexadre",
                  "skel",
                  "nova",
                  "jarnathan",
                  "lucy",
                  "burt",
                  "jennifer",
                  "clarice",
                  "yohankoo",
                  "drew",
                  "ololade",
                  "gaby",
                  "carolina",
                  "eryn",
                  "gozde",
                  "bukola",
                  "hope-ii",
                  "callie",
                  "jenna",
                  "patrick",
                  "amelie",
                  "tremblay",
                  "leblong",
                  "anika",
                  "ivy",
                  "ava",
                  "christopher",
                  "michael",
                  "archer-2",
                  "tom",
                  "anne",
                  "johnathan",
                  "pete",
                  "jason",
                  "joseph",
                  "josh",
                  "pike",
                  "belle",
                  "jack",
                  "nathaniel",
                  "tiffany",
                  "tripti",
                  "emma",
                  "lauren",
                  "amy",
                  "karl",
                  "finn",
                  "kensington",
                  "raju",
                  "nova-ii",
                  "sekou",
                  "miles",
                  "adeline",
                  "brayden",
                  "andrew",
                  "lucas",
                  "heyez",
                  "yvonne",
                  "roberto"
                ],
                "description": "The assistant's current voice, as a `key` from `GET /voices`. Clients still on a legacy voice key keep reporting that key until their voice is changed, and a client whose voice has since been withdrawn from the catalog keeps reporting its former key — send a current `key` to move them.",
                "example": "ava"
              },
              "voiceModel": {
                "type": "string",
                "enum": [
                  "standard",
                  "expressive",
                  "studio"
                ],
                "description": "How the assistant's voice sounds on calls. `standard` is the original lifelike voice, dependable on every call, and the default for clients that never chose one; `expressive` adds warm, lifelike emotion with the fastest replies; `studio` is the richest, most human delivery, with replies that take a beat longer. The voice itself stays the same.",
                "example": "standard"
              },
              "voicemail": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "message": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "When the assistant should treat a call as reaching voicemail."
                  }
                },
                "required": [
                  "enabled",
                  "message",
                  "description"
                ]
              }
            },
            "required": [
              "phoneNumber",
              "provisioning",
              "knowledgeRefresh",
              "agentName",
              "firstMessage",
              "language",
              "supportedLanguages",
              "requireCallerName",
              "requireCallerEmail",
              "rememberPastCalls",
              "takeMessages",
              "specificQuestions",
              "selectedVoiceKey",
              "voiceModel",
              "voicemail"
            ],
            "description": "Assistant configuration: conversation script, languages, caller requirements, voice persona, and voicemail behavior."
          },
          "calendar": {
            "type": "object",
            "properties": {
              "bookingStartTime": {
                "type": "string",
                "example": "09:00"
              },
              "bookingEndTime": {
                "type": "string",
                "example": "17:00"
              },
              "defaultDuration": {
                "type": "integer",
                "description": "Minutes per booking."
              },
              "meetingType": {
                "type": "string",
                "enum": [
                  "online",
                  "in_person",
                  "both"
                ]
              },
              "bufferBetweenMeetings": {
                "type": "integer",
                "description": "Minutes between bookings."
              },
              "allowSameDayBooking": {
                "type": "boolean"
              },
              "advanceBookingDays": {
                "type": "integer"
              },
              "includeLocation": {
                "type": "boolean"
              },
              "availabilityMode": {
                "type": "string",
                "enum": [
                  "agent_suggests",
                  "caller_requests"
                ]
              }
            },
            "required": [
              "bookingStartTime",
              "bookingEndTime",
              "defaultDuration",
              "meetingType",
              "bufferBetweenMeetings",
              "allowSameDayBooking",
              "advanceBookingDays",
              "includeLocation",
              "availabilityMode"
            ],
            "description": "Booking policy applied when a connected calendar schedules appointments."
          },
          "dataCollection": {
            "type": "object",
            "properties": {
              "fields": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "string",
                        "boolean",
                        "integer",
                        "number"
                      ]
                    },
                    "description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "key",
                    "type",
                    "description"
                  ]
                }
              }
            },
            "required": [
              "fields"
            ],
            "description": "Structured fields the assistant extracts from every conversation."
          },
          "privacy": {
            "type": "object",
            "properties": {
              "recordVoice": {
                "type": "boolean"
              },
              "retentionDays": {
                "type": "integer",
                "description": "Days conversation data is retained; -1 means no retention limit."
              },
              "deleteTranscriptAndPii": {
                "type": "boolean"
              },
              "deleteAudio": {
                "type": "boolean"
              },
              "zeroRetentionMode": {
                "type": "boolean"
              }
            },
            "required": [
              "recordVoice",
              "retentionDays",
              "deleteTranscriptAndPii",
              "deleteAudio",
              "zeroRetentionMode"
            ],
            "description": "Call recording and conversation-data retention policy."
          },
          "guardrails": {
            "type": "object",
            "properties": {
              "focusEnabled": {
                "type": "boolean",
                "description": "Keeps the assistant on the configured business topics."
              },
              "promptInjectionEnabled": {
                "type": "boolean",
                "description": "Blocks caller attempts to override the assistant's instructions."
              },
              "contentExecutionMode": {
                "type": "string",
                "enum": [
                  "streaming",
                  "blocking"
                ]
              },
              "contentTriggerAction": {
                "type": "string",
                "enum": [
                  "retry",
                  "end_call"
                ]
              },
              "contentRetryMessage": {
                "type": "string"
              },
              "categories": {
                "type": "object",
                "properties": {
                  "sexual": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "threshold": {
                        "type": "string",
                        "enum": [
                          "low",
                          "medium",
                          "high"
                        ]
                      }
                    },
                    "required": [
                      "enabled",
                      "threshold"
                    ],
                    "description": "Per-category guardrail state and sensitivity threshold."
                  },
                  "violence": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "threshold": {
                        "type": "string",
                        "enum": [
                          "low",
                          "medium",
                          "high"
                        ]
                      }
                    },
                    "required": [
                      "enabled",
                      "threshold"
                    ],
                    "description": "Per-category guardrail state and sensitivity threshold."
                  },
                  "harassment": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "threshold": {
                        "type": "string",
                        "enum": [
                          "low",
                          "medium",
                          "high"
                        ]
                      }
                    },
                    "required": [
                      "enabled",
                      "threshold"
                    ],
                    "description": "Per-category guardrail state and sensitivity threshold."
                  },
                  "selfHarm": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "threshold": {
                        "type": "string",
                        "enum": [
                          "low",
                          "medium",
                          "high"
                        ]
                      }
                    },
                    "required": [
                      "enabled",
                      "threshold"
                    ],
                    "description": "Per-category guardrail state and sensitivity threshold."
                  },
                  "profanity": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "threshold": {
                        "type": "string",
                        "enum": [
                          "low",
                          "medium",
                          "high"
                        ]
                      }
                    },
                    "required": [
                      "enabled",
                      "threshold"
                    ],
                    "description": "Per-category guardrail state and sensitivity threshold."
                  },
                  "religionOrPolitics": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "threshold": {
                        "type": "string",
                        "enum": [
                          "low",
                          "medium",
                          "high"
                        ]
                      }
                    },
                    "required": [
                      "enabled",
                      "threshold"
                    ],
                    "description": "Per-category guardrail state and sensitivity threshold."
                  },
                  "medicalAndLegalInformation": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "threshold": {
                        "type": "string",
                        "enum": [
                          "low",
                          "medium",
                          "high"
                        ]
                      }
                    },
                    "required": [
                      "enabled",
                      "threshold"
                    ],
                    "description": "Per-category guardrail state and sensitivity threshold."
                  }
                },
                "required": [
                  "sexual",
                  "violence",
                  "harassment",
                  "selfHarm",
                  "profanity",
                  "religionOrPolitics",
                  "medicalAndLegalInformation"
                ]
              }
            },
            "required": [
              "focusEnabled",
              "promptInjectionEnabled",
              "contentExecutionMode",
              "contentTriggerAction",
              "contentRetryMessage",
              "categories"
            ],
            "description": "Content guardrails, with per-category enablement and sensitivity."
          },
          "advanced": {
            "type": "object",
            "properties": {
              "llmModel": {
                "type": "string",
                "description": "Conversation model. One of: claude-haiku-5-5, claude-haiku-4-5, gpt-5.6-terra, gpt-5.6-luna, gpt-5.4-mini, gpt-5.6-sol, gemini-3.5-flash, claude-sonnet-5, qwen36-35b-a3b."
              },
              "temperature": {
                "type": "number"
              },
              "maxTokens": {
                "type": "integer"
              },
              "turnTimeout": {
                "type": "integer",
                "description": "Seconds, 1-30."
              },
              "turnEagerness": {
                "type": "string",
                "enum": [
                  "patient",
                  "normal",
                  "eager"
                ]
              },
              "speculativeTurn": {
                "type": "boolean"
              },
              "maxDurationSeconds": {
                "type": "integer"
              },
              "silenceEndCallTimeout": {
                "type": "integer",
                "description": "Seconds of caller silence before the call ends; -1 disables the timeout."
              },
              "backgroundMusic": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "presetId": {
                    "type": "string",
                    "enum": [
                      "office1",
                      "office2",
                      "restaurant",
                      "city",
                      "typing",
                      "elevator1",
                      "elevator2",
                      "elevator3",
                      "elevator4"
                    ]
                  },
                  "volume": {
                    "type": "number"
                  },
                  "crossfadeLoop": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "enabled",
                  "presetId",
                  "volume",
                  "crossfadeLoop"
                ]
              }
            },
            "required": [
              "llmModel",
              "temperature",
              "maxTokens",
              "turnTimeout",
              "turnEagerness",
              "speculativeTurn",
              "maxDurationSeconds",
              "silenceEndCallTimeout",
              "backgroundMusic"
            ],
            "description": "Advanced assistant tuning: model choice, turn taking, and ambient sound."
          }
        },
        "required": [
          "business",
          "hours",
          "notifications",
          "agent",
          "calendar",
          "dataCollection",
          "privacy",
          "guardrails",
          "advanced"
        ]
      },
      "ClientSettingsUpdate": {
        "type": "object",
        "properties": {
          "training": {
            "type": "object",
            "properties": {
              "websiteUrl": {
                "type": "string",
                "maxLength": 2000,
                "pattern": "^[hH][tT][tT][pP][sS]?:\\/\\/",
                "description": "Replace the business website knowledge source with a non-empty HTTP or HTTPS URL. Omit it to keep the current source. Requires active or trialing platform access and assistant provisioning to have started. A change queues a knowledge refresh; inspect agent.knowledgeRefresh for its status. The resolved URL is returned as business.websiteUrl.",
                "example": "https://acmeplumbing.com"
              }
            },
            "additionalProperties": false
          },
          "business": {
            "type": "object",
            "properties": {
              "businessName": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "businessPhone": {
                "type": "string",
                "maxLength": 40
              },
              "businessAddress": {
                "type": "string",
                "maxLength": 500
              },
              "businessInstructions": {
                "type": "string",
                "maxLength": 16000,
                "description": "Free-text guidance the assistant follows on every call. At most 800 words and 16000 characters. Send an empty string to clear it."
              },
              "appointmentLinkEnabled": {
                "type": "boolean"
              },
              "bookingUrl": {
                "type": "string",
                "maxLength": 2000
              },
              "callTransferEnabled": {
                "type": "boolean"
              },
              "transferPhoneNumber": {
                "type": "string",
                "maxLength": 40
              },
              "coreServices": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "maxItems": 50
              }
            },
            "additionalProperties": false
          },
          "hours": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "always",
                  "custom"
                ]
              },
              "timezone": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "weeklyHours": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "day": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 20,
                      "example": "monday"
                    },
                    "open": {
                      "type": "string",
                      "pattern": "^\\d{2}:\\d{2}$",
                      "example": "09:00",
                      "description": "24-hour HH:MM opening time."
                    },
                    "close": {
                      "type": "string",
                      "pattern": "^\\d{2}:\\d{2}$",
                      "example": "17:00",
                      "description": "24-hour HH:MM closing time."
                    },
                    "isOpen": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "day",
                    "open",
                    "close",
                    "isOpen"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 7,
                "description": "The complete weekly schedule, replacing the stored one. Every row needs all four of `day`, `open`, `close`, and `isOpen` — a row is a whole day, not a patch of one. Omit `weeklyHours` to leave the stored schedule alone."
              }
            },
            "additionalProperties": false
          },
          "notifications": {
            "type": "object",
            "properties": {
              "emailEnabled": {
                "type": "boolean"
              },
              "emailAddress": {
                "type": "string",
                "maxLength": 320
              },
              "smsEnabled": {
                "type": "boolean"
              },
              "smsPhone": {
                "type": "string",
                "maxLength": 40
              },
              "additionalEmails": {
                "type": "array",
                "items": {
                  "type": "string",
                  "maxLength": 320
                },
                "maxItems": 30
              },
              "additionalPhones": {
                "type": "array",
                "items": {
                  "type": "string",
                  "maxLength": 40
                },
                "maxItems": 30
              }
            },
            "additionalProperties": false
          },
          "agent": {
            "type": "object",
            "properties": {
              "agentName": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "firstMessage": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "language": {
                "type": "string",
                "minLength": 2,
                "maxLength": 20
              },
              "supportedLanguages": {
                "type": "array",
                "items": {
                  "type": "string",
                  "description": "A supported ISO 639 language code, e.g. \"en\".",
                  "example": "en"
                },
                "minItems": 1,
                "maxItems": 84
              },
              "requireCallerName": {
                "type": "boolean"
              },
              "requireCallerEmail": {
                "type": "boolean"
              },
              "rememberPastCalls": {
                "type": "boolean"
              },
              "takeMessages": {
                "type": "boolean"
              },
              "specificQuestions": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 240
                },
                "maxItems": 30
              },
              "selectedVoiceKey": {
                "type": "string",
                "enum": [
                  "mark",
                  "sam",
                  "chris",
                  "helen",
                  "samara",
                  "jessica",
                  "eve",
                  "juniper",
                  "hope",
                  "monika",
                  "arabella",
                  "blondie",
                  "alexandra",
                  "ivanna",
                  "marcela",
                  "santiago",
                  "brad",
                  "ben",
                  "agustin",
                  "adam",
                  "archer",
                  "abraham",
                  "mark-2",
                  "danielle",
                  "felix",
                  "alexadre",
                  "skel",
                  "nova",
                  "jarnathan",
                  "lucy",
                  "burt",
                  "jennifer",
                  "clarice",
                  "yohankoo",
                  "drew",
                  "ololade",
                  "gaby",
                  "carolina",
                  "eryn",
                  "gozde",
                  "bukola",
                  "hope-ii",
                  "callie",
                  "jenna",
                  "patrick",
                  "amelie",
                  "tremblay",
                  "leblong",
                  "anika",
                  "ivy",
                  "ava",
                  "christopher",
                  "michael",
                  "archer-2",
                  "tom",
                  "anne",
                  "johnathan",
                  "pete",
                  "jason",
                  "joseph",
                  "josh",
                  "pike",
                  "belle",
                  "jack",
                  "nathaniel",
                  "tiffany",
                  "tripti",
                  "emma",
                  "lauren",
                  "amy",
                  "karl",
                  "finn",
                  "kensington",
                  "raju",
                  "nova-ii",
                  "sekou",
                  "miles",
                  "adeline",
                  "brayden",
                  "andrew",
                  "lucas",
                  "heyez",
                  "yvonne",
                  "roberto"
                ],
                "description": "Switch the assistant's voice to any `key` from `GET /voices`. The legacy keys `ava` and `miles` remain accepted. A key for a voice that has since been withdrawn from the catalog is rejected with a 400 naming the voice.",
                "example": "ava"
              },
              "voiceModel": {
                "type": "string",
                "enum": [
                  "standard",
                  "expressive",
                  "studio"
                ],
                "description": "Switch how the assistant's voice sounds on calls: `standard`, `expressive`, or `studio` (see the read field). Requires the client's assistant to be fully set up, and is applied with the voice before the other sections.",
                "example": "expressive"
              },
              "voicemail": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            },
            "additionalProperties": false
          },
          "calendar": {
            "type": "object",
            "properties": {
              "bookingStartTime": {
                "type": "string",
                "pattern": "^\\d{2}:\\d{2}$"
              },
              "bookingEndTime": {
                "type": "string",
                "pattern": "^\\d{2}:\\d{2}$"
              },
              "defaultDuration": {
                "type": "integer",
                "minimum": 5,
                "maximum": 480
              },
              "meetingType": {
                "type": "string",
                "enum": [
                  "online",
                  "in_person",
                  "both"
                ]
              },
              "bufferBetweenMeetings": {
                "type": "integer",
                "minimum": 0,
                "maximum": 60
              },
              "allowSameDayBooking": {
                "type": "boolean"
              },
              "advanceBookingDays": {
                "type": "integer",
                "minimum": 1,
                "maximum": 365
              },
              "includeLocation": {
                "type": "boolean"
              },
              "availabilityMode": {
                "type": "string",
                "enum": [
                  "agent_suggests",
                  "caller_requests"
                ]
              }
            },
            "additionalProperties": false
          },
          "dataCollection": {
            "type": "object",
            "properties": {
              "fields": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "maxLength": 64,
                      "pattern": "^[a-zA-Z][a-zA-Z0-9]*$"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "string",
                        "boolean",
                        "integer",
                        "number"
                      ]
                    },
                    "description": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 500
                    }
                  },
                  "required": [
                    "key",
                    "type",
                    "description"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 40,
                "description": "The complete list of fields to collect, replacing the stored one on save."
              }
            },
            "required": [
              "fields"
            ],
            "additionalProperties": false,
            "description": "Structured fields the assistant extracts from every conversation. `fields` is required whenever you send the `dataCollection` section, because the list you send replaces the stored one wholesale — send every field you want to keep, or omit the section entirely to leave it untouched."
          },
          "privacy": {
            "type": "object",
            "properties": {
              "recordVoice": {
                "type": "boolean"
              },
              "retentionDays": {
                "type": "integer",
                "minimum": -1,
                "maximum": 3650
              },
              "deleteTranscriptAndPii": {
                "type": "boolean"
              },
              "deleteAudio": {
                "type": "boolean"
              },
              "zeroRetentionMode": {
                "type": "boolean"
              },
              "applyToExistingConversations": {
                "type": "boolean",
                "description": "One-shot flag: when true, the retention rules in this save are also applied to existing conversations. Applies to this save only and is never stored or returned."
              }
            },
            "additionalProperties": false
          },
          "guardrails": {
            "type": "object",
            "properties": {
              "focusEnabled": {
                "type": "boolean"
              },
              "promptInjectionEnabled": {
                "type": "boolean"
              },
              "contentExecutionMode": {
                "type": "string",
                "enum": [
                  "streaming",
                  "blocking"
                ]
              },
              "contentTriggerAction": {
                "type": "string",
                "enum": [
                  "retry",
                  "end_call"
                ]
              },
              "contentRetryMessage": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              },
              "categories": {
                "type": "object",
                "properties": {
                  "sexual": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "threshold": {
                        "type": "string",
                        "enum": [
                          "low",
                          "medium",
                          "high"
                        ]
                      }
                    },
                    "additionalProperties": false
                  },
                  "violence": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "threshold": {
                        "type": "string",
                        "enum": [
                          "low",
                          "medium",
                          "high"
                        ]
                      }
                    },
                    "additionalProperties": false
                  },
                  "harassment": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "threshold": {
                        "type": "string",
                        "enum": [
                          "low",
                          "medium",
                          "high"
                        ]
                      }
                    },
                    "additionalProperties": false
                  },
                  "selfHarm": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "threshold": {
                        "type": "string",
                        "enum": [
                          "low",
                          "medium",
                          "high"
                        ]
                      }
                    },
                    "additionalProperties": false
                  },
                  "profanity": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "threshold": {
                        "type": "string",
                        "enum": [
                          "low",
                          "medium",
                          "high"
                        ]
                      }
                    },
                    "additionalProperties": false
                  },
                  "religionOrPolitics": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "threshold": {
                        "type": "string",
                        "enum": [
                          "low",
                          "medium",
                          "high"
                        ]
                      }
                    },
                    "additionalProperties": false
                  },
                  "medicalAndLegalInformation": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "threshold": {
                        "type": "string",
                        "enum": [
                          "low",
                          "medium",
                          "high"
                        ]
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "additionalProperties": false
              }
            },
            "additionalProperties": false
          },
          "advanced": {
            "type": "object",
            "properties": {
              "llmModel": {
                "type": "string",
                "enum": [
                  "claude-haiku-5-5",
                  "claude-haiku-4-5",
                  "gpt-5.6-terra",
                  "gpt-5.6-luna",
                  "gpt-5.4-mini",
                  "gpt-5.6-sol",
                  "gemini-3.5-flash",
                  "claude-sonnet-5",
                  "qwen36-35b-a3b"
                ],
                "description": "Conversation model powering the assistant."
              },
              "temperature": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "maxTokens": {
                "type": "integer",
                "minimum": 100,
                "maximum": 5000
              },
              "turnTimeout": {
                "type": "integer",
                "minimum": 1,
                "maximum": 30
              },
              "turnEagerness": {
                "type": "string",
                "enum": [
                  "patient",
                  "normal",
                  "eager"
                ]
              },
              "speculativeTurn": {
                "type": "boolean"
              },
              "maxDurationSeconds": {
                "type": "integer",
                "minimum": 60,
                "maximum": 3600
              },
              "silenceEndCallTimeout": {
                "type": "integer"
              },
              "backgroundMusic": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "presetId": {
                    "type": "string",
                    "enum": [
                      "office1",
                      "office2",
                      "restaurant",
                      "city",
                      "typing",
                      "elevator1",
                      "elevator2",
                      "elevator3",
                      "elevator4"
                    ]
                  },
                  "volume": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "crossfadeLoop": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "CallPlan": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "nodes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CallPlanNode"
            }
          },
          "edges": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CallPlanEdge"
            }
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO-8601 UTC timestamp, when known."
          }
        },
        "required": [
          "enabled",
          "nodes",
          "edges",
          "updatedAt"
        ]
      },
      "CallPlanNode": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Plan-unique node id."
          },
          "type": {
            "type": "string",
            "enum": [
              "greeting",
              "case",
              "send_link",
              "transfer",
              "end"
            ]
          },
          "position": {
            "type": "object",
            "properties": {
              "x": {
                "type": "number"
              },
              "y": {
                "type": "number"
              }
            },
            "required": [
              "x",
              "y"
            ],
            "description": "Canvas position; cosmetic only."
          },
          "data": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string"
              },
              "firstMessage": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "instructions": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "linkUrl": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "linkText": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "message": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "transferPhoneNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "transferExtension": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "transferType": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "conference",
                  "blind",
                  null
                ]
              }
            },
            "required": [
              "label",
              "firstMessage",
              "instructions",
              "linkUrl",
              "linkText",
              "message",
              "transferPhoneNumber",
              "transferExtension",
              "transferType"
            ]
          }
        },
        "required": [
          "id",
          "type",
          "position",
          "data"
        ]
      },
      "CallPlanEdge": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "target": {
            "type": "string"
          },
          "conditionType": {
            "type": "string",
            "enum": [
              "llm",
              "unconditional"
            ],
            "description": "\"llm\" edges are taken when the caller conversation matches the condition; \"unconditional\" edges are always taken."
          },
          "condition": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "source",
          "target",
          "conditionType",
          "condition"
        ]
      },
      "CallPlanUpdate": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "nodes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "greeting",
                    "case",
                    "send_link",
                    "transfer",
                    "end"
                  ]
                },
                "position": {
                  "type": "object",
                  "properties": {
                    "x": {
                      "type": "number"
                    },
                    "y": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "x",
                    "y"
                  ],
                  "additionalProperties": false
                },
                "data": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    },
                    "firstMessage": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 500
                    },
                    "instructions": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 16000
                    },
                    "linkUrl": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 1000
                    },
                    "linkText": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 160
                    },
                    "message": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 1000
                    },
                    "transferPhoneNumber": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 80
                    },
                    "transferExtension": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 80
                    },
                    "transferType": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "conference",
                        "blind",
                        null
                      ]
                    }
                  },
                  "required": [
                    "label"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "id",
                "type",
                "position",
                "data"
              ],
              "additionalProperties": false
            },
            "maxItems": 200
          },
          "edges": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "source": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "target": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "conditionType": {
                  "type": "string",
                  "enum": [
                    "llm",
                    "unconditional"
                  ]
                },
                "condition": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "maxLength": 500
                }
              },
              "required": [
                "id",
                "source",
                "target",
                "conditionType"
              ],
              "additionalProperties": false
            },
            "maxItems": 400
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 80
          }
        },
        "required": [
          "enabled",
          "nodes",
          "edges"
        ],
        "additionalProperties": false,
        "description": "Replaces the whole call plan. The structure is validated deeply on save (one greeting start node, one terminal end node, reachable edges, transfer/link requirements)."
      },
      "CallList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Call"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Opaque cursor for the next page; null when there are no more results."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "Call": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Opaque call id. No format guarantee."
          },
          "direction": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "inbound",
              "outbound",
              null
            ]
          },
          "from": {
            "type": [
              "string",
              "null"
            ],
            "description": "Caller number, when known."
          },
          "to": {
            "type": [
              "string",
              "null"
            ],
            "description": "Number that was called, when known."
          },
          "contactName": {
            "type": [
              "string",
              "null"
            ],
            "description": "Saved contact name matching the caller number, when one exists."
          },
          "startedAt": {
            "type": "string",
            "format": "date-time",
            "description": "ISO-8601 UTC call time. Falls back to createdAt when the call time is unavailable."
          },
          "durationSeconds": {
            "type": [
              "number",
              "null"
            ]
          },
          "summary": {
            "type": [
              "string",
              "null"
            ],
            "description": "Post-call summary, when ready."
          },
          "audioAvailable": {
            "type": "boolean",
            "description": "Whether a recording is available. Request a five-minute playback/download URL from GET /clients/{clientId}/calls/{callId}/audio."
          },
          "isViewed": {
            "type": "boolean",
            "description": "Whether this call has been viewed in the client portal. GET requests do not mark calls as viewed."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the call record was stored, when available. Otherwise the recorded call time, or last update time if neither is available. May differ from startedAt."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Last call-record update, including post-call processing. Falls back to createdAt when unavailable."
          }
        },
        "required": [
          "id",
          "direction",
          "from",
          "to",
          "contactName",
          "startedAt",
          "durationSeconds",
          "summary",
          "audioAvailable",
          "isViewed",
          "createdAt",
          "updatedAt"
        ]
      },
      "CallAudio": {
        "type": "object",
        "properties": {
          "audioUrl": {
            "type": "string",
            "format": "uri",
            "description": "Temporary MP3 playback/download URL. Anyone holding this URL can use it until expiry; do not share it or persist it in logs. Use it without an API Authorization header."
          },
          "expiresInSeconds": {
            "type": "number",
            "enum": [
              300
            ],
            "description": "URL lifetime in seconds. Request a fresh URL after five minutes."
          }
        },
        "required": [
          "audioUrl",
          "expiresInSeconds"
        ]
      },
      "CallDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Call"
          },
          {
            "type": "object",
            "properties": {
              "transcriptText": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Stored plain-text transcript, when available. May be present on older calls without structured transcript turns; null when unavailable."
              },
              "transcript": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "$ref": "#/components/schemas/CallTranscriptTurn"
                },
                "description": "Structured transcript turns; null when unavailable, including older calls with only transcriptText or while post-call processing runs."
              }
            },
            "required": [
              "transcriptText",
              "transcript"
            ]
          }
        ]
      },
      "CallTranscriptTurn": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "description": "Speaker role, e.g. \"agent\" or \"user\"."
          },
          "message": {
            "type": "string"
          },
          "secondsIntoCall": {
            "type": [
              "number",
              "null"
            ],
            "description": "Offset of this turn from the start of the call, when known."
          }
        },
        "required": [
          "role",
          "message",
          "secondsIntoCall"
        ]
      },
      "ContactList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Contact"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Opaque cursor for the next page; null when there are no more results."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "Contact": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Opaque contact id. No format guarantee."
          },
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "description": "Caller phone number, when known."
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "company": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "summary": {
            "type": [
              "string",
              "null"
            ],
            "description": "Rolling summary of this contact's calls, when available."
          },
          "callCount": {
            "type": "integer"
          },
          "lastCallAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "phone",
          "name",
          "email",
          "company",
          "notes",
          "summary",
          "callCount",
          "lastCallAt",
          "createdAt",
          "updatedAt"
        ]
      },
      "ContactUpdate": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "email": {
            "type": "string",
            "maxLength": 320
          },
          "company": {
            "type": "string",
            "maxLength": 200
          },
          "notes": {
            "type": "string",
            "maxLength": 2000
          }
        },
        "additionalProperties": false
      },
      "CampaignList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Campaign"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Opaque cursor for the next page; null when there are no more results."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "Campaign": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Opaque campaign id. No format guarantee."
          },
          "name": {
            "type": "string",
            "example": "September win-back"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "in_progress",
              "completed",
              "failed",
              "cancelled"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "ISO-8601 UTC timestamp."
          },
          "scheduledAt": {
            "type": "string",
            "format": "date-time",
            "description": "When calling starts; matches createdAt for immediate campaigns."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "timezone": {
            "type": [
              "string",
              "null"
            ]
          },
          "totalCallsScheduled": {
            "type": "integer"
          },
          "totalCallsDispatched": {
            "type": "integer"
          },
          "totalCallsFinished": {
            "type": "integer"
          },
          "retryCount": {
            "type": "integer"
          },
          "targetConcurrencyLimit": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Maximum simultaneous calls, when a limit was set."
          },
          "paused": {
            "type": "boolean",
            "description": "True while the campaign is paused: `status` stays `in_progress` (or `pending`) and no new calls go out until it is resumed."
          },
          "needsAttention": {
            "type": "boolean",
            "description": "True while a problem is holding calls back. Fix the cause, then call the retry endpoint."
          },
          "callingRules": {
            "$ref": "#/components/schemas/CampaignCallingRules"
          }
        },
        "required": [
          "id",
          "name",
          "status",
          "createdAt",
          "scheduledAt",
          "updatedAt",
          "timezone",
          "totalCallsScheduled",
          "totalCallsDispatched",
          "totalCallsFinished",
          "retryCount",
          "targetConcurrencyLimit",
          "paused",
          "needsAttention",
          "callingRules"
        ]
      },
      "CampaignCallingRules": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "attempts": {
            "type": "integer",
            "description": "Calls placed to one recipient before the campaign gives up on them."
          },
          "retryDelayMinutes": {
            "type": "integer",
            "description": "Minutes between two attempts to the same recipient."
          },
          "callingHours": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "days": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "mon",
                    "tue",
                    "wed",
                    "thu",
                    "fri",
                    "sat",
                    "sun"
                  ]
                },
                "minItems": 1,
                "maxItems": 7,
                "description": "Days calls may go out.",
                "example": [
                  "mon",
                  "tue",
                  "wed",
                  "thu",
                  "fri"
                ]
              },
              "start": {
                "type": "string",
                "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                "description": "Earliest call time, 24-hour HH:MM.",
                "example": "09:00"
              },
              "end": {
                "type": "string",
                "pattern": "^(([01]\\d|2[0-3]):[0-5]\\d|24:00)$",
                "description": "Latest call time, 24-hour HH:MM (24:00 for midnight).",
                "example": "17:00"
              }
            },
            "required": [
              "days",
              "start",
              "end"
            ],
            "description": "When calls may go out, in the campaign timezone; null means any time."
          }
        },
        "required": [
          "attempts",
          "retryDelayMinutes",
          "callingHours"
        ],
        "description": "The retries and calling hours the campaign runs on; null for one call per recipient at any time."
      },
      "CampaignCreate": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "example": "September win-back"
          },
          "objective": {
            "type": "string",
            "minLength": 1,
            "maxLength": 8000,
            "description": "What the calls should accomplish; drives the conversation."
          },
          "firstMessage": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000,
            "description": "Overrides the default opening line for this campaign."
          },
          "language": {
            "type": "string",
            "minLength": 2,
            "maxLength": 20,
            "description": "Overrides the default call language for this campaign."
          },
          "scheduledAt": {
            "type": "string",
            "format": "date-time",
            "description": "Future ISO-8601 start time; omit to start immediately."
          },
          "timezone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "example": "America/Toronto"
          },
          "targetConcurrencyLimit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "description": "Maximum simultaneous calls (1–100)."
          },
          "callingRules": {
            "$ref": "#/components/schemas/CampaignCallingRulesInput"
          },
          "consentConfirmed": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Literal true, confirming every recipient has consented to receive this automated call."
          },
          "recipients": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "phoneNumber": {
                  "type": "string",
                  "minLength": 8,
                  "maxLength": 40,
                  "description": "E.164 number including the + country code."
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "variables": {
                  "type": "object",
                  "additionalProperties": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "number"
                      },
                      {
                        "type": "boolean"
                      }
                    ]
                  },
                  "description": "Personalization variables available to the conversation."
                }
              },
              "required": [
                "phoneNumber"
              ],
              "additionalProperties": false
            },
            "minItems": 1,
            "maxItems": 1000,
            "description": "Up to 1,000 unique recipients."
          }
        },
        "required": [
          "name",
          "objective",
          "consentConfirmed",
          "recipients"
        ],
        "additionalProperties": false
      },
      "CampaignCallingRulesInput": {
        "type": "object",
        "properties": {
          "attempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 6,
            "description": "Calls placed to one recipient before the campaign gives up on them (1–6). Defaults to 1."
          },
          "retryDelayMinutes": {
            "type": "integer",
            "minimum": 5,
            "maximum": 1440,
            "description": "Minutes between two attempts to the same recipient (5–1440). Defaults to 60."
          },
          "callingHours": {
            "type": "object",
            "properties": {
              "days": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "mon",
                    "tue",
                    "wed",
                    "thu",
                    "fri",
                    "sat",
                    "sun"
                  ]
                },
                "minItems": 1,
                "maxItems": 7,
                "description": "Days calls may go out.",
                "example": [
                  "mon",
                  "tue",
                  "wed",
                  "thu",
                  "fri"
                ]
              },
              "start": {
                "type": "string",
                "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                "description": "Earliest call time, 24-hour HH:MM.",
                "example": "09:00"
              },
              "end": {
                "type": "string",
                "pattern": "^(([01]\\d|2[0-3]):[0-5]\\d|24:00)$",
                "description": "Latest call time, 24-hour HH:MM (24:00 for midnight).",
                "example": "17:00"
              }
            },
            "required": [
              "days",
              "start",
              "end"
            ],
            "additionalProperties": false,
            "description": "Only place calls on these days between these times, in the campaign `timezone` (required with calling hours). Omit to call at any time."
          }
        },
        "additionalProperties": false,
        "description": "Retries and calling hours. Omit for one call per recipient at any time, exactly as before this field existed."
      },
      "CampaignDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Campaign"
          },
          {
            "type": "object",
            "properties": {
              "recipients": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CampaignRecipient"
                }
              },
              "progress": {
                "$ref": "#/components/schemas/CampaignProgress"
              },
              "attention": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CampaignAttention"
                },
                "description": "Open problems holding calls back; empty when there are none."
              }
            },
            "required": [
              "recipients",
              "progress",
              "attention"
            ]
          }
        ]
      },
      "CampaignRecipient": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Opaque recipient id."
          },
          "phoneNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "dispatched",
              "initiated",
              "in_progress",
              "completed",
              "failed",
              "cancelled",
              "voicemail"
            ]
          },
          "callId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Opaque id of the resulting call once one exists; readable via GET /clients/{clientId}/calls/{callId}."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "attempts": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Calls placed to this recipient so far; null when attempts are not tracked."
          },
          "lastResult": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "answered",
              "voicemail",
              "busy",
              "no_answer",
              "failed",
              null
            ],
            "description": "How the most recent call to this recipient ended, once one has."
          },
          "done": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "True once no further call will be placed to this recipient; null when it is not tracked."
          }
        },
        "required": [
          "id",
          "phoneNumber",
          "status",
          "callId",
          "createdAt",
          "updatedAt",
          "attempts",
          "lastResult",
          "done"
        ]
      },
      "CampaignProgress": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "waiting": {
            "type": "integer",
            "description": "Recipients not called yet."
          },
          "inProgress": {
            "type": "integer",
            "description": "Recipients called at least once and not finished (for example awaiting a retry)."
          },
          "done": {
            "type": "integer",
            "description": "Recipients that will not be called again."
          },
          "callingNow": {
            "type": "integer",
            "description": "Calls in progress right now."
          },
          "nextCallAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the next call is due; null when none is scheduled."
          }
        },
        "required": [
          "waiting",
          "inProgress",
          "done",
          "callingNow",
          "nextCallAt"
        ],
        "description": "Live recipient counts; null when they are not tracked for this campaign."
      },
      "CampaignAttention": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Machine-readable cause. Treat unknown values as a generic problem.",
            "example": "phone_number_unavailable"
          },
          "retryable": {
            "type": "boolean",
            "description": "Whether the retry endpoint can place the held-back calls once the cause is fixed."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "reason",
          "retryable",
          "createdAt"
        ]
      },
      "CampaignCancelled": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "cancelled": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "id",
          "cancelled"
        ]
      },
      "CampaignRetried": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "retried": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "id",
          "retried"
        ]
      },
      "CampaignPaused": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "paused": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "id",
          "paused"
        ]
      },
      "CampaignResumed": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "resumed": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "id",
          "resumed"
        ]
      },
      "KnowledgeDocument": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          },
          "contentType": {
            "type": [
              "string",
              "null"
            ]
          },
          "fileSizeBytes": {
            "type": "integer",
            "minimum": 0
          },
          "usageMode": {
            "type": "string",
            "enum": [
              "auto",
              "prompt"
            ],
            "description": "auto: retrieve relevant passages as needed. prompt: include the document in the assistant prompt."
          },
          "downloadAvailable": {
            "type": "boolean"
          },
          "uploadedAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "fileName",
          "contentType",
          "fileSizeBytes",
          "usageMode",
          "downloadAvailable",
          "uploadedAt",
          "createdAt",
          "updatedAt"
        ]
      },
      "KnowledgeUploadCreate": {
        "type": "object",
        "properties": {
          "fileName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "fileSizeBytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20971520
          }
        },
        "required": [
          "fileName",
          "fileSizeBytes"
        ],
        "additionalProperties": false
      },
      "KnowledgeDocumentCreate": {
        "type": "object",
        "properties": {
          "uploadId": {
            "type": "string",
            "format": "uuid"
          },
          "usageMode": {
            "type": "string",
            "enum": [
              "auto",
              "prompt"
            ],
            "default": "auto",
            "description": "auto: retrieve relevant passages as needed. prompt: include the document in the assistant prompt."
          }
        },
        "required": [
          "uploadId"
        ],
        "additionalProperties": false
      },
      "KnowledgeDocumentUpdate": {
        "type": "object",
        "properties": {
          "usageMode": {
            "type": "string",
            "enum": [
              "auto",
              "prompt"
            ],
            "description": "auto: retrieve relevant passages as needed. prompt: include the document in the assistant prompt."
          }
        },
        "required": [
          "usageMode"
        ],
        "additionalProperties": false
      },
      "KnowledgeDocumentReplace": {
        "type": "object",
        "properties": {
          "uploadId": {
            "type": "string",
            "format": "uuid"
          },
          "usageMode": {
            "type": "string",
            "enum": [
              "auto",
              "prompt"
            ],
            "description": "auto: retrieve relevant passages as needed. prompt: include the document in the assistant prompt."
          }
        },
        "required": [
          "uploadId"
        ],
        "additionalProperties": false
      }
    },
    "parameters": {}
  },
  "paths": {
    "/account": {
      "get": {
        "operationId": "getAccount",
        "summary": "Get the authenticated account",
        "description": "Returns the partner account this API key belongs to.",
        "tags": [
          "Account"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The authenticated partner account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, or the account is not active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/plans": {
      "get": {
        "operationId": "listPlans",
        "summary": "List retail plans",
        "description": "Your retail plans, oldest first (creation order, matching the dashboard). Returns every plan — at most three can be active at once, so the list is small and not paginated. Only plans with status `active` can be passed as `planId` when creating a client; archived plans stay listed so historical plan ids remain resolvable.",
        "tags": [
          "Plans"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "All of your retail plans.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanList"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, or the account is not active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/voices": {
      "get": {
        "operationId": "listVoices",
        "summary": "List assistant voices",
        "description": "Every voice the phone assistant can speak with, with context on how each sounds — the same catalog, in the same order, that your clients see in their own application. Use a voice's `key` as `agent.selectedVoiceKey` when updating a client's settings, and its `previewUrl` to hear a sample. A voice's `languages` are the languages it sounds native in; the languages the assistant actually speaks are set by `agent.supportedLanguages`.",
        "tags": [
          "Voices"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The voice catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Voice"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, or the account is not active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/voices/{voiceKey}/preview": {
      "get": {
        "operationId": "getVoicePreview",
        "summary": "Hear a voice sample",
        "description": "A short MP3 of the voice speaking the assistant's standard greeting — the same line callers hear. The sample is deterministic, so cache it freely.",
        "tags": [
          "Voices"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "mark",
                "sam",
                "chris",
                "helen",
                "samara",
                "jessica",
                "eve",
                "juniper",
                "hope",
                "monika",
                "arabella",
                "blondie",
                "alexandra",
                "ivanna",
                "marcela",
                "santiago",
                "brad",
                "ben",
                "agustin",
                "adam",
                "archer",
                "abraham",
                "mark-2",
                "danielle",
                "felix",
                "alexadre",
                "skel",
                "nova",
                "jarnathan",
                "lucy",
                "burt",
                "jennifer",
                "clarice",
                "yohankoo",
                "drew",
                "ololade",
                "gaby",
                "carolina",
                "eryn",
                "gozde",
                "bukola",
                "hope-ii",
                "callie",
                "jenna",
                "patrick",
                "amelie",
                "tremblay",
                "leblong",
                "anika",
                "ivy",
                "ava",
                "christopher",
                "michael",
                "archer-2",
                "tom",
                "anne",
                "johnathan",
                "pete",
                "jason",
                "joseph",
                "josh",
                "pike",
                "belle",
                "jack",
                "nathaniel",
                "tiffany",
                "tripti",
                "emma",
                "lauren",
                "amy",
                "karl",
                "finn",
                "kensington",
                "raju",
                "nova-ii",
                "sekou",
                "miles",
                "adeline",
                "brayden",
                "andrew",
                "lucas",
                "heyez",
                "yvonne",
                "roberto"
              ],
              "description": "A voice `key` from `GET /voices`. The legacy key `miles` is still accepted and previews the `jason` voice. A key for a voice that has since been withdrawn from the catalog is rejected with a 400.",
              "example": "ava"
            },
            "required": true,
            "description": "A voice `key` from `GET /voices`. The legacy key `miles` is still accepted and previews the `jason` voice. A key for a voice that has since been withdrawn from the catalog is rejected with a 400.",
            "name": "voiceKey",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "MP3 audio sample of the voice.",
            "content": {
              "audio/mpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, or the account is not active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients": {
      "get": {
        "operationId": "listClients",
        "summary": "List clients",
        "description": "Clients in your workspace, newest first. Page with `limit` and the opaque `nextCursor`.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "description": "Page size (1–100)."
            },
            "required": false,
            "description": "Page size (1–100).",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 300,
              "description": "Opaque cursor from a previous response's nextCursor."
            },
            "required": false,
            "description": "Opaque cursor from a previous response's nextCursor.",
            "name": "cursor",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "invited",
                "onboarding",
                "active",
                "paused",
                "churned"
              ],
              "description": "Only return clients with this status. Filtering applies within each page, so filtered pages can hold fewer than `limit` items — keep following nextCursor."
            },
            "required": false,
            "description": "Only return clients with this status. Filtering applies within each page, so filtered pages can hold fewer than `limit` items — keep following nextCursor.",
            "name": "status",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "One page of clients.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClientList"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, or the account is not active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createClient",
        "summary": "Create a client",
        "description": "Creates a client and starts its platform access subscription on your card on file with a 7-day free trial (your card is first charged when the trial ends). Requires an Idempotency-Key header. If a previous attempt created the client but billing did not start, repeating the call with the same contactEmail resumes the billing step. By default no retail plan is attached: your seat subscription covers the client's platform access, and providing the optional `onboarding` block lets the client sign straight in to their dashboard with zero onboarding steps (they receive a branded account-ready email instead of a setup invite). Pass `planId` to attach one of your active retail plans instead (discover plan ids via `GET /plans`) — that client's first sign-in then lands on checkout for the plan, paid by the client.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "Acme Plumbing",
                "contactEmail": "owner@acmeplumbing.com"
              },
              "schema": {
                "$ref": "#/components/schemas/ClientCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Client created (or resumed) with its billing summary.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClientDetail"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The client exists but billing could not start: CARD_ON_FILE_REQUIRED (add a card from the dashboard) or PAYMENT_FAILED. details.clientId identifies the created client; repeat the call with a new Idempotency-Key to retry billing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, or the account is not active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: duplicate contact email or slug, an Idempotency-Key reuse, or a billing operation already in progress.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}": {
      "patch": {
        "operationId": "updateClient",
        "summary": "Update a client",
        "description": "Partial update — send only the fields you want to change. Anything you omit keeps its current value. Supported fields: name, status, contactEmail, slug. Status can only be toggled between active and paused — other lifecycle states are managed by the platform's billing and onboarding flows.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "clientId",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "Acme Plumbing"
              },
              "schema": {
                "$ref": "#/components/schemas/ClientUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated client.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClientDetail"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, or the account is not active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The new slug or contactEmail is already in use in your workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getClient",
        "summary": "Get one client",
        "description": "A single client with its platform access billing summary.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The client id."
            },
            "required": true,
            "description": "The client id.",
            "name": "clientId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The client.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClientDetail"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, or the account is not active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/activate": {
      "post": {
        "operationId": "activateClient",
        "summary": "Activate a client",
        "description": "Gives the client's owner portal access without waiting for them to sign in: their login is created from the contact email on the client, and the client moves to `active`. Use it when you are onboarding a client yourself and want their workspace usable — and support-impersonable — immediately. Safe to repeat: a client whose owner already has access returns `alreadyActive: true` and nothing changes. Only clients created through this API can be activated, and the client needs a pending owner invite (send one with `POST /clients/{clientId}/invites/resend` if it has already been accepted or has expired).",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "clientId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The client's owner has portal access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClientActivation"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, or the account is not active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The client has no pending owner invite to activate; resend the invite first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/invites/resend": {
      "post": {
        "operationId": "resendClientInvite",
        "summary": "Resend the owner invite",
        "description": "Revokes any pending invite and emails a fresh owner invite. Requires the client's platform access to be active or trialing.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "clientId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The new invite.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClientInvite"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, or the account is not active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/settings": {
      "get": {
        "operationId": "getClientSettings",
        "summary": "Get client settings",
        "description": "Every portal Settings section except subscription billing: business profile, opening hours, notification preferences, assistant configuration (script, voice persona, voicemail), assigned assistant phone number, business website URL, provisioning and knowledge-refresh status, calendar booking policy, data collection fields, privacy, guardrails, and advanced tuning. Requires the client's platform access to be active or trialing.",
        "tags": [
          "Client Settings"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The client id."
            },
            "required": true,
            "description": "The client id.",
            "name": "clientId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The client's settings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClientSettings"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, the account is not active, or the client's platform access billing is not active or trialing, or a calls/contacts/outbound operation targets a Client whose status is not active (CLIENT_ACCESS_INACTIVE).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateClientSettings",
        "summary": "Update client settings",
        "description": "Partial update — send only the fields you want to change. Anything you omit keeps its current value. Send one section with one field in it if that is all you are changing; sections you leave out are never read. Two things inside the body are complete lists rather than merges: `dataCollection.fields` replaces the whole field list and is required whenever you send the `dataCollection` section, and every `hours.weeklyHours` row needs all four of `day`, `open`, `close`, and `isOpen`. `privacy.applyToExistingConversations` additionally applies the retention rules to existing conversations on that save only. `agent.selectedVoiceKey` switches the assistant's voice persona and requires the client's assistant to be fully set up; when it is sent alongside other changes, the voice change is applied first, and the two steps are sequential rather than one transaction — if the second step fails, the applied change is kept (and audited), and repeating the request with the same Idempotency-Key safely retries both steps. After assistant provisioning has started, `training.websiteUrl` replaces the website knowledge source and queues a refresh; read the saved URL from `business.websiteUrl` and progress from `agent.knowledgeRefresh`. An Idempotency-Key header is honored when provided.",
        "tags": [
          "Client Settings"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The client id."
            },
            "required": true,
            "description": "The client id.",
            "name": "clientId",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "agent": {
                  "selectedVoiceKey": "ava"
                },
                "business": {
                  "businessPhone": "+14155550142"
                }
              },
              "schema": {
                "$ref": "#/components/schemas/ClientSettingsUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated settings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClientSettings"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, the account is not active, or the client's platform access billing is not active or trialing, or a calls/contacts/outbound operation targets a Client whose status is not active (CLIENT_ACCESS_INACTIVE).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/call-plan": {
      "get": {
        "operationId": "getClientCallPlan",
        "summary": "Get the call-handling plan",
        "description": "The client's call-handling plan: the greeting, routing cases, link/transfer actions, and end state.",
        "tags": [
          "Client Settings"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The client id."
            },
            "required": true,
            "description": "The client id.",
            "name": "clientId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The call-handling plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallPlan"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, the account is not active, or the client's platform access billing is not active or trialing, or a calls/contacts/outbound operation targets a Client whose status is not active (CLIENT_ACCESS_INACTIVE).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateClientCallPlan",
        "summary": "Replace the call-handling plan",
        "description": "Full replacement — the plan you send becomes the whole plan. Any node or edge you leave out is removed, so unlike the settings PATCH there is no merge here: read the current plan first if you only mean to adjust part of it. Saved after deep validation (exactly one greeting start node with a first message, one terminal end node, valid edges, terminal transfers). An Idempotency-Key header is honored when provided.",
        "tags": [
          "Client Settings"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The client id."
            },
            "required": true,
            "description": "The client id.",
            "name": "clientId",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "enabled": true,
                "nodes": [
                  {
                    "id": "start_node",
                    "type": "greeting",
                    "position": {
                      "x": 0,
                      "y": 0
                    },
                    "data": {
                      "label": "Greeting",
                      "firstMessage": "Thanks for calling Acme Plumbing — how can I help?"
                    }
                  },
                  {
                    "id": "end_node",
                    "type": "end",
                    "position": {
                      "x": 0,
                      "y": 260
                    },
                    "data": {
                      "label": "Wrap up"
                    }
                  }
                ],
                "edges": [
                  {
                    "id": "start_node_to_end_node",
                    "source": "start_node",
                    "target": "end_node",
                    "conditionType": "llm",
                    "condition": "The caller has everything they need."
                  }
                ]
              },
              "schema": {
                "$ref": "#/components/schemas/CallPlanUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The saved plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallPlan"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, the account is not active, or the client's platform access billing is not active or trialing, or a calls/contacts/outbound operation targets a Client whose status is not active (CLIENT_ACCESS_INACTIVE).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/calls": {
      "get": {
        "operationId": "listClientCalls",
        "summary": "List calls",
        "description": "The client's calls, newest first. Page with `limit` and the opaque `nextCursor`; transcripts are returned only by the single-call read.",
        "tags": [
          "Calls"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The client id."
            },
            "required": true,
            "description": "The client id.",
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "description": "Page size (1–100)."
            },
            "required": false,
            "description": "Page size (1–100).",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 300,
              "description": "Opaque cursor from a previous response's nextCursor."
            },
            "required": false,
            "description": "Opaque cursor from a previous response's nextCursor.",
            "name": "cursor",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "inbound",
                "outbound"
              ],
              "description": "Only return calls with this direction. Filtering applies within each page, so filtered pages can hold fewer than `limit` items — keep following nextCursor."
            },
            "required": false,
            "description": "Only return calls with this direction. Filtering applies within each page, so filtered pages can hold fewer than `limit` items — keep following nextCursor.",
            "name": "direction",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "One page of calls.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallList"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, the account is not active, or the client's platform access billing is not active or trialing, or a calls/contacts/outbound operation targets a Client whose status is not active (CLIENT_ACCESS_INACTIVE).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/calls/{callId}/audio": {
      "get": {
        "operationId": "getClientCallAudio",
        "summary": "Get a call recording URL",
        "description": "Returns a signed MP3 URL valid for five minutes for playback or download. Requires calls:read, an active Client and active or trialing platform billing. Request this endpoint again when the URL expires. The URL grants access to anyone holding it until expiry, even if the Client is paused or the API key is revoked afterward. Do not forward your API key when using the URL. Returns 404 when the call or its recording is unavailable. This read does not mark the call viewed.",
        "tags": [
          "Calls"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The client id."
            },
            "required": true,
            "description": "The client id.",
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The opaque call id returned by the calls list."
            },
            "required": true,
            "description": "The opaque call id returned by the calls list.",
            "name": "callId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "A private, non-cacheable recording URL valid for 300 seconds.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallAudio"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, the account is not active, or the client's platform access billing is not active or trialing, or a calls/contacts/outbound operation targets a Client whose status is not active (CLIENT_ACCESS_INACTIVE).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Call audio is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/calls/{callId}": {
      "get": {
        "operationId": "getClientCall",
        "summary": "Get one call",
        "description": "A single call including its structured transcript turns, when available.",
        "tags": [
          "Calls"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The client id."
            },
            "required": true,
            "description": "The client id.",
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The opaque call id."
            },
            "required": true,
            "description": "The opaque call id.",
            "name": "callId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The call with its transcript.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallDetail"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, the account is not active, or the client's platform access billing is not active or trialing, or a calls/contacts/outbound operation targets a Client whose status is not active (CLIENT_ACCESS_INACTIVE).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/contacts": {
      "get": {
        "operationId": "listClientContacts",
        "summary": "List contacts",
        "description": "The client's caller contacts, most recently active first. Page with `limit` and the opaque `nextCursor`.",
        "tags": [
          "Contacts"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The client id."
            },
            "required": true,
            "description": "The client id.",
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "description": "Page size (1–100)."
            },
            "required": false,
            "description": "Page size (1–100).",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 300,
              "description": "Opaque cursor from a previous response's nextCursor."
            },
            "required": false,
            "description": "Opaque cursor from a previous response's nextCursor.",
            "name": "cursor",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "One page of contacts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactList"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, the account is not active, or the client's platform access billing is not active or trialing, or a calls/contacts/outbound operation targets a Client whose status is not active (CLIENT_ACCESS_INACTIVE).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/contacts/{contactId}": {
      "patch": {
        "operationId": "updateClientContact",
        "summary": "Update a contact",
        "description": "Partial update — send only the fields you want to change. Anything you omit keeps its current value. Supported fields: name, email, company, notes. An Idempotency-Key header is honored when provided.",
        "tags": [
          "Contacts"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The client id."
            },
            "required": true,
            "description": "The client id.",
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The opaque contact id."
            },
            "required": true,
            "description": "The opaque contact id.",
            "name": "contactId",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "company": "Whitfield Interiors",
                "notes": "Prefers a callback after 5pm."
              },
              "schema": {
                "$ref": "#/components/schemas/ContactUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated contact.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, the account is not active, or the client's platform access billing is not active or trialing, or a calls/contacts/outbound operation targets a Client whose status is not active (CLIENT_ACCESS_INACTIVE).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/outbound-calls": {
      "get": {
        "operationId": "listClientCampaigns",
        "summary": "List outbound campaigns",
        "description": "The client's outbound call campaigns. Page with `limit` and the opaque `nextCursor`.",
        "tags": [
          "Outbound Calls"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The client id."
            },
            "required": true,
            "description": "The client id.",
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "description": "Page size (1–100)."
            },
            "required": false,
            "description": "Page size (1–100).",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 500,
              "description": "Opaque cursor from a previous response's nextCursor."
            },
            "required": false,
            "description": "Opaque cursor from a previous response's nextCursor.",
            "name": "cursor",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "One page of campaigns.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignList"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, the account is not active, or the client's platform access billing is not active or trialing, or a calls/contacts/outbound operation targets a Client whose status is not active (CLIENT_ACCESS_INACTIVE).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createClientCampaign",
        "summary": "Create an outbound campaign",
        "description": "Creates (and optionally schedules) an outbound call campaign for up to 1,000 unique recipients. Requires an Idempotency-Key header and the literal `consentConfirmed: true` acknowledging recipient consent. Add `callingRules` to call people who do not answer again and to keep calls to set days and hours; without it each recipient is called once, at any time.",
        "tags": [
          "Outbound Calls"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The client id."
            },
            "required": true,
            "description": "The client id.",
            "name": "clientId",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "September win-back",
                "objective": "Invite past customers to book their annual furnace service before the cold season.",
                "consentConfirmed": true,
                "recipients": [
                  {
                    "phoneNumber": "+14155550142",
                    "name": "Dana Whitfield"
                  },
                  {
                    "phoneNumber": "+14155550168",
                    "name": "Sam Ortega"
                  }
                ]
              },
              "schema": {
                "$ref": "#/components/schemas/CampaignCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created campaign.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Campaign"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, the account is not active, or the client's platform access billing is not active or trialing, or a calls/contacts/outbound operation targets a Client whose status is not active (CLIENT_ACCESS_INACTIVE).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The stricter write-tier rate limit for campaign creation was exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/outbound-calls/{campaignId}": {
      "get": {
        "operationId": "getClientCampaign",
        "summary": "Get one campaign",
        "description": "Campaign details including per-recipient statuses and resulting call ids.",
        "tags": [
          "Outbound Calls"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The client id."
            },
            "required": true,
            "description": "The client id.",
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The opaque campaign id."
            },
            "required": true,
            "description": "The opaque campaign id.",
            "name": "campaignId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The campaign with its recipients.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignDetail"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, the account is not active, or the client's platform access billing is not active or trialing, or a calls/contacts/outbound operation targets a Client whose status is not active (CLIENT_ACCESS_INACTIVE).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/outbound-calls/{campaignId}/cancel": {
      "post": {
        "operationId": "cancelClientCampaign",
        "summary": "Cancel a campaign",
        "description": "Cancels remaining calls in a campaign. Naturally idempotent; an Idempotency-Key header is honored when provided.",
        "tags": [
          "Outbound Calls"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The client id."
            },
            "required": true,
            "description": "The client id.",
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The opaque campaign id."
            },
            "required": true,
            "description": "The opaque campaign id.",
            "name": "campaignId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Cancellation acknowledged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignCancelled"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, the account is not active, or the client's platform access billing is not active or trialing, or a calls/contacts/outbound operation targets a Client whose status is not active (CLIENT_ACCESS_INACTIVE).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/outbound-calls/{campaignId}/retry": {
      "post": {
        "operationId": "retryClientCampaign",
        "summary": "Retry failed recipients",
        "description": "Gets a stalled campaign calling again. When `needsAttention` is true it places the calls the campaign's retryable problems are holding back; when the campaign is paused it resumes it. A running campaign with `callingRules` already retries unanswered calls by itself, so this returns 409 when there is nothing to retry. Campaigns created before calling rules existed re-dispatch their failed recipients, as before. Requires an Idempotency-Key header.",
        "tags": [
          "Outbound Calls"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The client id."
            },
            "required": true,
            "description": "The client id.",
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The opaque campaign id."
            },
            "required": true,
            "description": "The opaque campaign id.",
            "name": "campaignId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Retry acknowledged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignRetried"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, the account is not active, or the client's platform access billing is not active or trialing, or a calls/contacts/outbound operation targets a Client whose status is not active (CLIENT_ACCESS_INACTIVE).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The stricter write-tier rate limit for campaign retries was exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/outbound-calls/{campaignId}/pause": {
      "post": {
        "operationId": "pauseClientCampaign",
        "summary": "Pause a campaign",
        "description": "Stops new calls from going out until the campaign is resumed; calls already in progress finish. Naturally idempotent (pausing a paused campaign succeeds); an Idempotency-Key header is honored when provided. Returns 409 for a finished campaign and for campaigns created before pausing was available.",
        "tags": [
          "Outbound Calls"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The client id."
            },
            "required": true,
            "description": "The client id.",
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The opaque campaign id."
            },
            "required": true,
            "description": "The opaque campaign id.",
            "name": "campaignId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Pause acknowledged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignPaused"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, the account is not active, or the client's platform access billing is not active or trialing, or a calls/contacts/outbound operation targets a Client whose status is not active (CLIENT_ACCESS_INACTIVE).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/outbound-calls/{campaignId}/resume": {
      "post": {
        "operationId": "resumeClientCampaign",
        "summary": "Resume a paused campaign",
        "description": "Lets a paused campaign place calls again, within its calling hours. Naturally idempotent (resuming a running campaign succeeds); an Idempotency-Key header is honored when provided. Returns 409 for a finished campaign.",
        "tags": [
          "Outbound Calls"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The client id."
            },
            "required": true,
            "description": "The client id.",
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The opaque campaign id."
            },
            "required": true,
            "description": "The opaque campaign id.",
            "name": "campaignId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Resume acknowledged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignResumed"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked, expired, or wrong-environment API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks a required scope, the account is not active, or the client's platform access billing is not active or trialing, or a calls/contacts/outbound operation targets a Client whose status is not active (CLIENT_ACCESS_INACTIVE).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/api-endpoints": {
      "get": {
        "operationId": "listApiEndpoints",
        "summary": "List custom API endpoints",
        "description": "Requires client_settings:read and active client access. Returns the complete bounded collection (maximum 10 endpoints); nextCursor is always null. Credentials and internal tool IDs are never returned.",
        "tags": [
          "Bring Your Own API"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "clientId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "name": "create_service_request",
                      "description": "Create a service request after the caller confirms the details.",
                      "method": "POST",
                      "url": "https://api.example.com/service-requests",
                      "auth": {
                        "type": "bearer",
                        "configured": true
                      },
                      "parameters": [
                        {
                          "name": "caller_name",
                          "type": "string",
                          "description": "The caller's name",
                          "required": true
                        }
                      ],
                      "requestTemplate": "{}",
                      "id": "b9e3199c-3bf0-4f15-b432-b460c047fe12",
                      "responseSchema": "",
                      "timeoutMs": 5000,
                      "enabled": false,
                      "verifiedAt": null,
                      "createdAt": "2026-09-12T12:00:00.000Z",
                      "updatedAt": "2026-09-12T12:00:00.000Z"
                    }
                  ],
                  "nextCursor": null,
                  "limit": 10
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,63}$"
                          },
                          "description": {
                            "type": "string",
                            "minLength": 10,
                            "maxLength": 1000
                          },
                          "method": {
                            "type": "string",
                            "enum": [
                              "GET",
                              "POST",
                              "PUT",
                              "PATCH",
                              "DELETE"
                            ]
                          },
                          "url": {
                            "type": "string",
                            "maxLength": 2000,
                            "format": "uri"
                          },
                          "parameters": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,79}$"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "string",
                                    "number",
                                    "boolean"
                                  ]
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 300
                                },
                                "required": {
                                  "type": "boolean",
                                  "default": true
                                }
                              },
                              "required": [
                                "name",
                                "type",
                                "description"
                              ],
                              "additionalProperties": false
                            },
                            "maxItems": 30,
                            "default": []
                          },
                          "requestTemplate": {
                            "type": "string",
                            "minLength": 2,
                            "maxLength": 20000,
                            "default": "{}",
                            "description": "JSON-encoded object stored as a string. Use JSON.stringify(template) in JavaScript; escape inner quotes in raw JSON. Omit or send \"{}\" to forward declared fields directly. Map declared parameters with {{field_name}} placeholders. Whole-value placeholders preserve numbers/booleans; embedded placeholders produce text. Missing optional whole-value placeholders omit that property or array item. GET sends query parameters; other methods send JSON. Keep credentials in auth. [Open the request template walkthrough](#description/request-template-walkthrough) for decoded JSON, sample inputs and the outgoing request.",
                            "example": "{\"customer\":{\"name\":\"{{caller_name}}\"},\"source\":\"voice_assistant\"}"
                          },
                          "responseSchema": {
                            "type": "string",
                            "maxLength": 20000,
                            "default": "",
                            "description": "JSON-encoded response schema stored as a string. Use JSON.stringify(schema) in JavaScript. Omit or send an empty string to skip response-shape validation. Supports type, properties, required and items; title/description are annotations. Types: object, array, string, number, integer, boolean, null. Extra properties are allowed. Unsupported constraints such as enum, format, additionalProperties and $ref are rejected. Checks verification and live responses; does not transform them. [Open the response schema walkthrough](#description/response-schema-walkthrough) for a schema and matching customer response.",
                            "example": "{\"type\":\"object\",\"properties\":{\"request_id\":{\"type\":\"string\"}},\"required\":[\"request_id\"]}"
                          },
                          "timeoutMs": {
                            "type": "integer",
                            "minimum": 1000,
                            "maximum": 8000,
                            "default": 5000
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "auth": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "none",
                                  "bearer",
                                  "api_key"
                                ]
                              },
                              "headerName": {
                                "type": "string"
                              },
                              "configured": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "type",
                              "configured"
                            ]
                          },
                          "enabled": {
                            "type": "boolean"
                          },
                          "verifiedAt": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "updatedAt": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "name",
                          "description",
                          "method",
                          "url",
                          "id",
                          "auth",
                          "enabled",
                          "verifiedAt",
                          "createdAt",
                          "updatedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": "null"
                    },
                    "limit": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "limit"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createApiEndpoint",
        "summary": "Create a custom API endpoint",
        "description": "Requires client_settings:write and Idempotency-Key. Created disabled and unverified. Use a public HTTPS URL without query strings, fragments, or embedded credentials. GET request fields become query parameters; other methods send JSON. An empty requestTemplate sends the declared fields directly; templates use {{field_name}} placeholders. Auth supports none, bearer, or api_key with headerName. Secrets are write-only and encrypted. Up to 10 endpoints per client. No automatic retries of customer requests.",
        "tags": [
          "Bring Your Own API"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "example": "byo-create-order-001"
            },
            "required": true,
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "examples": {
                "direct_fields": {
                  "summary": "Send fields directly (simplest)",
                  "description": "The outgoing JSON is the collected caller_name field. No response-shape validation.",
                  "value": {
                    "name": "create_service_request",
                    "description": "Create a service request after the caller confirms the details.",
                    "method": "POST",
                    "url": "https://api.example.com/service-requests",
                    "auth": {
                      "type": "bearer",
                      "secret": "YOUR_CUSTOMER_API_TOKEN"
                    },
                    "parameters": [
                      {
                        "name": "caller_name",
                        "type": "string",
                        "description": "The caller's name",
                        "required": true
                      }
                    ],
                    "requestTemplate": "{}"
                  }
                },
                "mapped_request": {
                  "summary": "Map a nested request and validate its response",
                  "description": "Preserves number/boolean values, omits missing optional notes, and requires a request_id in the response.",
                  "value": {
                    "name": "create_service_request",
                    "description": "Create a service request after confirming the caller's name, number of units, and urgency. Collect notes if offered. Only confirm receipt when the API returns a request_id; do not promise a booking.",
                    "method": "POST",
                    "url": "https://api.example.com/service-requests",
                    "auth": {
                      "type": "bearer",
                      "secret": "YOUR_CUSTOMER_API_TOKEN"
                    },
                    "parameters": [
                      {
                        "name": "caller_name",
                        "type": "string",
                        "description": "The caller's name",
                        "required": true
                      },
                      {
                        "name": "units",
                        "type": "number",
                        "description": "Number of units requiring service",
                        "required": true
                      },
                      {
                        "name": "urgent",
                        "type": "boolean",
                        "description": "Whether the caller says the request is urgent",
                        "required": true
                      },
                      {
                        "name": "notes",
                        "type": "string",
                        "description": "Optional additional details from the caller",
                        "required": false
                      }
                    ],
                    "requestTemplate": "{\"customer\":{\"name\":\"{{caller_name}}\"},\"request\":{\"units\":\"{{units}}\",\"urgent\":\"{{urgent}}\",\"notes\":\"{{notes}}\"},\"source\":\"voice_assistant\"}",
                    "responseSchema": "{\"type\":\"object\",\"properties\":{\"request_id\":{\"type\":\"string\"},\"status\":{\"type\":\"string\"}},\"required\":[\"request_id\",\"status\"]}"
                  }
                }
              },
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,63}$"
                  },
                  "description": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 1000
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "GET",
                      "POST",
                      "PUT",
                      "PATCH",
                      "DELETE"
                    ]
                  },
                  "url": {
                    "type": "string",
                    "maxLength": 2000,
                    "format": "uri"
                  },
                  "auth": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "none",
                          "bearer",
                          "api_key"
                        ]
                      },
                      "headerName": {
                        "type": "string",
                        "maxLength": 100
                      },
                      "secret": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 4000,
                        "writeOnly": true
                      }
                    },
                    "required": [
                      "type"
                    ],
                    "additionalProperties": false
                  },
                  "parameters": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,79}$"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "string",
                            "number",
                            "boolean"
                          ]
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 300
                        },
                        "required": {
                          "type": "boolean",
                          "default": true
                        }
                      },
                      "required": [
                        "name",
                        "type",
                        "description"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 30,
                    "default": []
                  },
                  "requestTemplate": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 20000,
                    "default": "{}",
                    "description": "JSON-encoded object stored as a string. Use JSON.stringify(template) in JavaScript; escape inner quotes in raw JSON. Omit or send \"{}\" to forward declared fields directly. Map declared parameters with {{field_name}} placeholders. Whole-value placeholders preserve numbers/booleans; embedded placeholders produce text. Missing optional whole-value placeholders omit that property or array item. GET sends query parameters; other methods send JSON. Keep credentials in auth. [Open the request template walkthrough](#description/request-template-walkthrough) for decoded JSON, sample inputs and the outgoing request.",
                    "example": "{\"customer\":{\"name\":\"{{caller_name}}\"},\"source\":\"voice_assistant\"}"
                  },
                  "responseSchema": {
                    "type": "string",
                    "maxLength": 20000,
                    "default": "",
                    "description": "JSON-encoded response schema stored as a string. Use JSON.stringify(schema) in JavaScript. Omit or send an empty string to skip response-shape validation. Supports type, properties, required and items; title/description are annotations. Types: object, array, string, number, integer, boolean, null. Extra properties are allowed. Unsupported constraints such as enum, format, additionalProperties and $ref are rejected. Checks verification and live responses; does not transform them. [Open the response schema walkthrough](#description/response-schema-walkthrough) for a schema and matching customer response.",
                    "example": "{\"type\":\"object\",\"properties\":{\"request_id\":{\"type\":\"string\"}},\"required\":[\"request_id\"]}"
                  },
                  "timeoutMs": {
                    "type": "integer",
                    "minimum": 1000,
                    "maximum": 8000,
                    "default": 5000
                  }
                },
                "required": [
                  "name",
                  "description",
                  "method",
                  "url",
                  "auth"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "name": "create_service_request",
                  "description": "Create a service request after the caller confirms the details.",
                  "method": "POST",
                  "url": "https://api.example.com/service-requests",
                  "auth": {
                    "type": "bearer",
                    "configured": true
                  },
                  "parameters": [
                    {
                      "name": "caller_name",
                      "type": "string",
                      "description": "The caller's name",
                      "required": true
                    }
                  ],
                  "requestTemplate": "{}",
                  "id": "b9e3199c-3bf0-4f15-b432-b460c047fe12",
                  "responseSchema": "",
                  "timeoutMs": 5000,
                  "enabled": false,
                  "verifiedAt": null,
                  "createdAt": "2026-09-12T12:00:00.000Z",
                  "updatedAt": "2026-09-12T12:00:00.000Z"
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,63}$"
                    },
                    "description": {
                      "type": "string",
                      "minLength": 10,
                      "maxLength": 1000
                    },
                    "method": {
                      "type": "string",
                      "enum": [
                        "GET",
                        "POST",
                        "PUT",
                        "PATCH",
                        "DELETE"
                      ]
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2000,
                      "format": "uri"
                    },
                    "parameters": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,79}$"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "string",
                              "number",
                              "boolean"
                            ]
                          },
                          "description": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 300
                          },
                          "required": {
                            "type": "boolean",
                            "default": true
                          }
                        },
                        "required": [
                          "name",
                          "type",
                          "description"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 30,
                      "default": []
                    },
                    "requestTemplate": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 20000,
                      "default": "{}",
                      "description": "JSON-encoded object stored as a string. Use JSON.stringify(template) in JavaScript; escape inner quotes in raw JSON. Omit or send \"{}\" to forward declared fields directly. Map declared parameters with {{field_name}} placeholders. Whole-value placeholders preserve numbers/booleans; embedded placeholders produce text. Missing optional whole-value placeholders omit that property or array item. GET sends query parameters; other methods send JSON. Keep credentials in auth. [Open the request template walkthrough](#description/request-template-walkthrough) for decoded JSON, sample inputs and the outgoing request.",
                      "example": "{\"customer\":{\"name\":\"{{caller_name}}\"},\"source\":\"voice_assistant\"}"
                    },
                    "responseSchema": {
                      "type": "string",
                      "maxLength": 20000,
                      "default": "",
                      "description": "JSON-encoded response schema stored as a string. Use JSON.stringify(schema) in JavaScript. Omit or send an empty string to skip response-shape validation. Supports type, properties, required and items; title/description are annotations. Types: object, array, string, number, integer, boolean, null. Extra properties are allowed. Unsupported constraints such as enum, format, additionalProperties and $ref are rejected. Checks verification and live responses; does not transform them. [Open the response schema walkthrough](#description/response-schema-walkthrough) for a schema and matching customer response.",
                      "example": "{\"type\":\"object\",\"properties\":{\"request_id\":{\"type\":\"string\"}},\"required\":[\"request_id\"]}"
                    },
                    "timeoutMs": {
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 8000,
                      "default": 5000
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "auth": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "none",
                            "bearer",
                            "api_key"
                          ]
                        },
                        "headerName": {
                          "type": "string"
                        },
                        "configured": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "type",
                        "configured"
                      ]
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "verifiedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "updatedAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "name",
                    "description",
                    "method",
                    "url",
                    "id",
                    "auth",
                    "enabled",
                    "verifiedAt",
                    "createdAt",
                    "updatedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/api-endpoints/{endpointId}": {
      "patch": {
        "operationId": "updateApiEndpoint",
        "summary": "Update or enable a custom API endpoint",
        "description": "Partial update — send only the fields you want to change. Anything you omit keeps its current value. Configuration changes disable the endpoint and invalidate verification. Omit auth.secret to keep the existing credential when auth type/header are unchanged. Save changes, verify, then send enabled:true separately. enabled:false immediately revokes proxy access and detaches the voice tool. Requires client_settings:write.",
        "tags": [
          "Bring Your Own API"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "endpointId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "example": "byo-create-order-001"
            },
            "required": false,
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "enabled": true
              },
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,63}$"
                  },
                  "description": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 1000
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "GET",
                      "POST",
                      "PUT",
                      "PATCH",
                      "DELETE"
                    ]
                  },
                  "url": {
                    "type": "string",
                    "maxLength": 2000,
                    "format": "uri"
                  },
                  "auth": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "none",
                          "bearer",
                          "api_key"
                        ]
                      },
                      "headerName": {
                        "type": "string",
                        "maxLength": 100
                      },
                      "secret": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 4000,
                        "writeOnly": true
                      }
                    },
                    "required": [
                      "type"
                    ],
                    "additionalProperties": false
                  },
                  "parameters": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,79}$"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "string",
                            "number",
                            "boolean"
                          ]
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 300
                        },
                        "required": {
                          "type": "boolean",
                          "default": true
                        }
                      },
                      "required": [
                        "name",
                        "type",
                        "description"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 30
                  },
                  "requestTemplate": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 20000,
                    "description": "JSON-encoded object stored as a string. Use JSON.stringify(template) in JavaScript; escape inner quotes in raw JSON. Omit or send \"{}\" to forward declared fields directly. Map declared parameters with {{field_name}} placeholders. Whole-value placeholders preserve numbers/booleans; embedded placeholders produce text. Missing optional whole-value placeholders omit that property or array item. GET sends query parameters; other methods send JSON. Keep credentials in auth. [Open the request template walkthrough](#description/request-template-walkthrough) for decoded JSON, sample inputs and the outgoing request.",
                    "example": "{\"customer\":{\"name\":\"{{caller_name}}\"},\"source\":\"voice_assistant\"}"
                  },
                  "responseSchema": {
                    "type": "string",
                    "maxLength": 20000,
                    "description": "JSON-encoded response schema stored as a string. Use JSON.stringify(schema) in JavaScript. Omit or send an empty string to skip response-shape validation. Supports type, properties, required and items; title/description are annotations. Types: object, array, string, number, integer, boolean, null. Extra properties are allowed. Unsupported constraints such as enum, format, additionalProperties and $ref are rejected. Checks verification and live responses; does not transform them. [Open the response schema walkthrough](#description/response-schema-walkthrough) for a schema and matching customer response.",
                    "example": "{\"type\":\"object\",\"properties\":{\"request_id\":{\"type\":\"string\"}},\"required\":[\"request_id\"]}"
                  },
                  "timeoutMs": {
                    "type": "integer",
                    "minimum": 1000,
                    "maximum": 8000
                  },
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "name": "create_service_request",
                  "description": "Create a service request after the caller confirms the details.",
                  "method": "POST",
                  "url": "https://api.example.com/service-requests",
                  "auth": {
                    "type": "bearer",
                    "configured": true
                  },
                  "parameters": [
                    {
                      "name": "caller_name",
                      "type": "string",
                      "description": "The caller's name",
                      "required": true
                    }
                  ],
                  "requestTemplate": "{}",
                  "id": "b9e3199c-3bf0-4f15-b432-b460c047fe12",
                  "responseSchema": "",
                  "timeoutMs": 5000,
                  "enabled": true,
                  "verifiedAt": "2026-09-12T12:01:00.000Z",
                  "createdAt": "2026-09-12T12:00:00.000Z",
                  "updatedAt": "2026-09-12T12:00:00.000Z"
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,63}$"
                    },
                    "description": {
                      "type": "string",
                      "minLength": 10,
                      "maxLength": 1000
                    },
                    "method": {
                      "type": "string",
                      "enum": [
                        "GET",
                        "POST",
                        "PUT",
                        "PATCH",
                        "DELETE"
                      ]
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2000,
                      "format": "uri"
                    },
                    "parameters": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,79}$"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "string",
                              "number",
                              "boolean"
                            ]
                          },
                          "description": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 300
                          },
                          "required": {
                            "type": "boolean",
                            "default": true
                          }
                        },
                        "required": [
                          "name",
                          "type",
                          "description"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 30,
                      "default": []
                    },
                    "requestTemplate": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 20000,
                      "default": "{}",
                      "description": "JSON-encoded object stored as a string. Use JSON.stringify(template) in JavaScript; escape inner quotes in raw JSON. Omit or send \"{}\" to forward declared fields directly. Map declared parameters with {{field_name}} placeholders. Whole-value placeholders preserve numbers/booleans; embedded placeholders produce text. Missing optional whole-value placeholders omit that property or array item. GET sends query parameters; other methods send JSON. Keep credentials in auth. [Open the request template walkthrough](#description/request-template-walkthrough) for decoded JSON, sample inputs and the outgoing request.",
                      "example": "{\"customer\":{\"name\":\"{{caller_name}}\"},\"source\":\"voice_assistant\"}"
                    },
                    "responseSchema": {
                      "type": "string",
                      "maxLength": 20000,
                      "default": "",
                      "description": "JSON-encoded response schema stored as a string. Use JSON.stringify(schema) in JavaScript. Omit or send an empty string to skip response-shape validation. Supports type, properties, required and items; title/description are annotations. Types: object, array, string, number, integer, boolean, null. Extra properties are allowed. Unsupported constraints such as enum, format, additionalProperties and $ref are rejected. Checks verification and live responses; does not transform them. [Open the response schema walkthrough](#description/response-schema-walkthrough) for a schema and matching customer response.",
                      "example": "{\"type\":\"object\",\"properties\":{\"request_id\":{\"type\":\"string\"}},\"required\":[\"request_id\"]}"
                    },
                    "timeoutMs": {
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 8000,
                      "default": 5000
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "auth": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "none",
                            "bearer",
                            "api_key"
                          ]
                        },
                        "headerName": {
                          "type": "string"
                        },
                        "configured": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "type",
                        "configured"
                      ]
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "verifiedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "updatedAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "name",
                    "description",
                    "method",
                    "url",
                    "id",
                    "auth",
                    "enabled",
                    "verifiedAt",
                    "createdAt",
                    "updatedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteApiEndpoint",
        "summary": "Delete a custom API endpoint",
        "description": "Disables and detaches the voice tool, deletes it, then removes the saved configuration and encrypted credential. Requires client_settings:write.",
        "tags": [
          "Bring Your Own API"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "endpointId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "example": "byo-create-order-001"
            },
            "required": false,
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "deleted": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "deleted"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/api-endpoints/{endpointId}/verify": {
      "post": {
        "operationId": "verifyApiEndpoint",
        "summary": "Verify a custom API endpoint",
        "description": "Makes ONE REAL HTTP request using sampleValues and the configured method/template. It can create or change records: use your customer's sandbox or a no-write request supported by that endpoint. No universal verification flag is injected. A 2xx response matching responseSchema verifies the saved config. Verification leaves the endpoint disabled; enable it separately. Requires client_settings:write and Idempotency-Key. Verification and live calls share a 30 requests/minute endpoint limit.",
        "tags": [
          "Bring Your Own API"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "endpointId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "example": "byo-create-order-001"
            },
            "required": true,
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "sampleValues": {
                  "caller_name": "Test customer"
                }
              },
              "schema": {
                "type": "object",
                "properties": {
                  "sampleValues": {
                    "type": "object",
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        }
                      ]
                    },
                    "default": {}
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "ok": true,
                  "status": 200,
                  "message": "Connection verified. You can now enable this endpoint.",
                  "endpoint": {
                    "name": "create_service_request",
                    "description": "Create a service request after the caller confirms the details.",
                    "method": "POST",
                    "url": "https://api.example.com/service-requests",
                    "auth": {
                      "type": "bearer",
                      "configured": true
                    },
                    "parameters": [
                      {
                        "name": "caller_name",
                        "type": "string",
                        "description": "The caller's name",
                        "required": true
                      }
                    ],
                    "requestTemplate": "{}",
                    "id": "b9e3199c-3bf0-4f15-b432-b460c047fe12",
                    "responseSchema": "",
                    "timeoutMs": 5000,
                    "enabled": false,
                    "verifiedAt": "2026-09-12T12:01:00.000Z",
                    "createdAt": "2026-09-12T12:00:00.000Z",
                    "updatedAt": "2026-09-12T12:00:00.000Z"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "endpoint": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,63}$"
                        },
                        "description": {
                          "type": "string",
                          "minLength": 10,
                          "maxLength": 1000
                        },
                        "method": {
                          "type": "string",
                          "enum": [
                            "GET",
                            "POST",
                            "PUT",
                            "PATCH",
                            "DELETE"
                          ]
                        },
                        "url": {
                          "type": "string",
                          "maxLength": 2000,
                          "format": "uri"
                        },
                        "parameters": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string",
                                "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,79}$"
                              },
                              "type": {
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean"
                                ]
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 300
                              },
                              "required": {
                                "type": "boolean",
                                "default": true
                              }
                            },
                            "required": [
                              "name",
                              "type",
                              "description"
                            ],
                            "additionalProperties": false
                          },
                          "maxItems": 30,
                          "default": []
                        },
                        "requestTemplate": {
                          "type": "string",
                          "minLength": 2,
                          "maxLength": 20000,
                          "default": "{}",
                          "description": "JSON-encoded object stored as a string. Use JSON.stringify(template) in JavaScript; escape inner quotes in raw JSON. Omit or send \"{}\" to forward declared fields directly. Map declared parameters with {{field_name}} placeholders. Whole-value placeholders preserve numbers/booleans; embedded placeholders produce text. Missing optional whole-value placeholders omit that property or array item. GET sends query parameters; other methods send JSON. Keep credentials in auth. [Open the request template walkthrough](#description/request-template-walkthrough) for decoded JSON, sample inputs and the outgoing request.",
                          "example": "{\"customer\":{\"name\":\"{{caller_name}}\"},\"source\":\"voice_assistant\"}"
                        },
                        "responseSchema": {
                          "type": "string",
                          "maxLength": 20000,
                          "default": "",
                          "description": "JSON-encoded response schema stored as a string. Use JSON.stringify(schema) in JavaScript. Omit or send an empty string to skip response-shape validation. Supports type, properties, required and items; title/description are annotations. Types: object, array, string, number, integer, boolean, null. Extra properties are allowed. Unsupported constraints such as enum, format, additionalProperties and $ref are rejected. Checks verification and live responses; does not transform them. [Open the response schema walkthrough](#description/response-schema-walkthrough) for a schema and matching customer response.",
                          "example": "{\"type\":\"object\",\"properties\":{\"request_id\":{\"type\":\"string\"}},\"required\":[\"request_id\"]}"
                        },
                        "timeoutMs": {
                          "type": "integer",
                          "minimum": 1000,
                          "maximum": 8000,
                          "default": 5000
                        },
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "auth": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "none",
                                "bearer",
                                "api_key"
                              ]
                            },
                            "headerName": {
                              "type": "string"
                            },
                            "configured": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "type",
                            "configured"
                          ]
                        },
                        "enabled": {
                          "type": "boolean"
                        },
                        "verifiedAt": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "updatedAt": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "name",
                        "description",
                        "method",
                        "url",
                        "id",
                        "auth",
                        "enabled",
                        "verifiedAt",
                        "createdAt",
                        "updatedAt"
                      ],
                      "additionalProperties": false
                    },
                    "message": {
                      "type": "string"
                    },
                    "status": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Customer HTTP status, or null when no response was received. Customer response bodies and credentials are never returned."
                    }
                  },
                  "required": [
                    "ok",
                    "endpoint",
                    "message",
                    "status"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Request could not be completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/knowledge-base/documents": {
      "get": {
        "operationId": "listKnowledgeDocuments",
        "summary": "List knowledge documents",
        "description": "Lists agent documents with stable opaque IDs and cursor pagination. Requires client_settings:read and active client access. Generated website knowledge is listed as read-only. File uploads support PDF, TXT, DOCX, HTML and EPUB up to 20 MiB.",
        "tags": [
          "Knowledge Base"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 2048
            },
            "required": false,
            "name": "cursor",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/KnowledgeDocument"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "limits": {
                      "type": "object",
                      "properties": {
                        "maxFileSizeBytes": {
                          "type": "number"
                        },
                        "supportedExtensions": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "maxFileSizeBytes",
                        "supportedExtensions"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "limits"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createKnowledgeDocument",
        "summary": "Attach an uploaded document",
        "description": "Completes a prepared upload and attaches it to the agent. usageMode defaults to auto. Each uploadId can be submitted once; retry the exact request with its original Idempotency-Key. After an ambiguous failure, list documents before issuing another upload. File bytes do not pass through this endpoint.",
        "tags": [
          "Knowledge Base"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "required": true,
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "uploadId": "af1cf872-b048-4019-a8e7-47858917f06f",
                "usageMode": "auto"
              },
              "schema": {
                "$ref": "#/components/schemas/KnowledgeDocumentCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeDocument"
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/knowledge-base/documents/{documentId}": {
      "get": {
        "operationId": "getKnowledgeDocument",
        "summary": "Get a knowledge document",
        "tags": [
          "Knowledge Base"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^doc_[a-f0-9]{64}$"
            },
            "required": true,
            "name": "documentId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeDocument"
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateKnowledgeDocument",
        "summary": "Change document usage settings",
        "description": "Partial update — send only the fields you want to change. Anything you omit keeps its current value. Choose auto retrieval or inclusion in the assistant prompt. The change applies to the live agent. Other fields are read-only. Generated website knowledge cannot be modified. Requires client_settings:write.",
        "tags": [
          "Knowledge Base"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^doc_[a-f0-9]{64}$"
            },
            "required": true,
            "name": "documentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "required": false,
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "usageMode": "prompt"
              },
              "schema": {
                "$ref": "#/components/schemas/KnowledgeDocumentUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeDocument"
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteKnowledgeDocument",
        "summary": "Delete a knowledge document",
        "description": "Detaches the document from the agent and removes its stored original. Generated website knowledge cannot be deleted. Send an Idempotency-Key to replay a successful deletion safely; otherwise a repeat returns 404. Requires client_settings:write.",
        "tags": [
          "Knowledge Base"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^doc_[a-f0-9]{64}$"
            },
            "required": true,
            "name": "documentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "required": false,
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "deleted": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "deleted"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/knowledge-base/documents/{documentId}/download": {
      "get": {
        "operationId": "downloadKnowledgeDocument",
        "summary": "Download a knowledge document",
        "description": "Returns a temporary URL for the stored original file. Treat the URL as a credential. Returns 404 when no original file is available (including generated knowledge).",
        "tags": [
          "Knowledge Base"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^doc_[a-f0-9]{64}$"
            },
            "required": true,
            "name": "documentId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "fileName": {
                      "type": "string"
                    },
                    "expiresInSeconds": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "url",
                    "fileName",
                    "expiresInSeconds"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/knowledge-base/uploads": {
      "post": {
        "operationId": "createKnowledgeUpload",
        "summary": "Prepare a document upload",
        "description": "Step 1: request a temporary upload form with the filename and exact byte size (maximum 20 MiB). Step 2: POST multipart/form-data to the returned url, copying every returned fields entry exactly and adding the file LAST. Send no API Authorization header to that URL. Step 3: POST the uploadId to /knowledge-base/documents within 5 minutes to attach it. The upload capability fields are opaque; do not modify or persist them. Requires client_settings:write and Idempotency-Key.",
        "tags": [
          "Knowledge Base"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "required": true,
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "fileName": "product-guide.pdf",
                "fileSizeBytes": 12345
              },
              "schema": {
                "$ref": "#/components/schemas/KnowledgeUploadCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "uploadId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "method": {
                      "type": "string",
                      "enum": [
                        "POST"
                      ]
                    },
                    "fields": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "expiresInSeconds": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "uploadId",
                    "url",
                    "method",
                    "fields",
                    "expiresInSeconds"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/knowledge-base/documents/{documentId}/replace": {
      "post": {
        "operationId": "replaceKnowledgeDocument",
        "summary": "Replace a document file",
        "description": "Prepare and upload a new file first, then submit its uploadId here. The replacement inherits usageMode unless provided. The new document is attached before removing the previous one; it receives a NEW document ID, returned in the response. A failed new upload leaves the previous document attached. If removal fails, 409 includes replacementDocumentId and previousDocumentId: inspect the list and delete the previous document. Generated website knowledge cannot be replaced. Requires client_settings:write and Idempotency-Key.",
        "tags": [
          "Knowledge Base"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "clientId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^doc_[a-f0-9]{64}$"
            },
            "required": true,
            "name": "documentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "required": true,
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "uploadId": "af1cf872-b048-4019-a8e7-47858917f06f"
              },
              "schema": {
                "$ref": "#/components/schemas/KnowledgeDocumentReplace"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeDocument"
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {}
}
