{"openapi":"3.1.0","info":{"title":"AgenteUno partner API (/v1/partner)","version":"1.0.0","description":"White-label contract of AgenteUno. An integrator creates sub-accounts for its clients, puts an agent and a knowledge base in each, and opens embeddable chat and voice sessions from its own web pages with signed grants. Human and AI-agent guide: https://agenteuno.ai/docs/partner.md\n\n## Authentication\nEvery route needs the header `x-partner-key` (an integrator key starts with `au_sbx_` in the sandbox and `au_live_` in production), except `GET /openapi.json` and `GET /conversations/{conversationId}` (authorized by the grant). A missing or wrong key answers 401. Keep the key on your server: never in a browser.\n\n## Sandbox\nA new integrator starts in a sandbox with hard caps imposed by code, for 30 days: at most 3 sub-accounts, 50 conversations per sub-account and month, 5 voice minutes per sub-account and day, 15 per month, 5 active API keys. Going over a cap answers 403 SANDBOX_LIMIT. Real telephony, outbound calls, phone-number requests, WhatsApp, Telegram and Instagram answer 403 SANDBOX_CHANNEL_DISABLED. After the expiry every call answers 403 SANDBOX_EXPIRED. Sandbox data is test data.\n\n## Idempotency\nPOST /orgs is idempotent by (you, externalId): a retry returns the same organization with created false. PUT /orgs/{id}/agent and PUT /orgs/{id}/knowledge are upserts.\n\n## Grants\nPOST /grants/chat and POST /grants/voice (from your backend) return a signed grant. The visitor's browser uses it to open the chat WebSocket (`/ws/chat`) or the voice WebSocket (`wsUrl?grant=<grant>`), and to read the result with GET /conversations/{id}?grant=<grant>. A grant opens within 600 s; a voice call lasts at most 900 s. Add `visitorIp` to pin a grant to the visitor's connection.\n\n## Events and signatures\nEvents are POSTed to your event URL (PUT /account/event-url) with `x-agenteuno-signature: t=<unix>,v1=<hex>` where v1 is the hex HMAC-SHA256, keyed with your signing secret, of `<t>.<raw body>`. Compute it over the RAW body, compare in constant time and reject a `t` that is more than 5 minutes off. A failed delivery is retried once after 30 s. Registering the URL first sends a signed `url_verification` challenge that you must echo. Event bodies: see `webhooks`.\n\n## Entitlement tokens\nWith `requireEntitlement: true` the chat socket demands `&entitlement=<jwt>`: an HS256 JWT you sign with your signing secret, issuer `<your partner id>-entitlement`, claims `scope: agent-entitlement`, `agentId`, `org` (the sub-account id), `iat`, `exp` (at most 1800 s after `iat`) and optionally `sub` (opaque id of your user, 16 to 128 characters of A-Z a-z 0-9 _ -, counted by per-person quotas).\n\n## Errors\nApplication errors are `{\"error\":{\"code\",\"message\"}}`. A request rejected by its schema answers 400 with the zod issues (`{\"success\":false,\"error\":{...}}`)."},"servers":[{"url":"https://api.agenteuno.ai/v1/partner"}],"security":[{"partnerKey":[]}],"tags":[{"name":"Start"},{"name":"Account"},{"name":"Sub-accounts"},{"name":"Agent and knowledge"},{"name":"Sessions and grants"},{"name":"Quotas and usage"},{"name":"Channels"},{"name":"Outbound calls"},{"name":"House partners"},{"name":"Data erasure"}],"paths":{"/openapi.json":{"get":{"operationId":"getOpenApi","summary":"This document","tags":["Start"],"security":[],"responses":{"200":{"description":"The OpenAPI 3.1 document."}}}},"/conversations/{conversationId}":{"get":{"operationId":"getConversationResult","summary":"Result of a conversation opened with a grant","description":"PUBLIC: no key. It is authorized by the signed grant that opened the conversation, passed as the `grant` query parameter, so the visitor's browser can call it on hanging up. The grant keeps working for 86400 s after its expiry for this read. A grant that did not open this conversation gets the same 404 as a missing one.","tags":["Sessions and grants"],"security":[],"parameters":[{"$ref":"#/components/parameters/ConversationId"},{"name":"grant","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Summary and analysis.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ConversationResult"}},"required":["data"]}}}},"403":{"description":"INVALID_GRANT: missing, invalid or expired grant.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/account":{"get":{"operationId":"getAccount","summary":"Who am I: tier, status, expiry, caps, event URL","tags":["Account"],"security":[{"partnerKey":[]}],"responses":{"200":{"description":"Account.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Account"}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/account/orgs":{"get":{"operationId":"listAccountOrgs","summary":"My sub-accounts","tags":["Account"],"security":[{"partnerKey":[]}],"responses":{"200":{"description":"Up to 1000 sub-accounts, oldest first.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Subaccount"}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/account/usage":{"get":{"operationId":"getAccountUsage","summary":"Monthly usage per sub-account","tags":["Account","Quotas and usage"],"security":[{"partnerKey":[]}],"parameters":[{"name":"period","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"},"description":"YYYY-MM (UTC). Default: the current month."}],"responses":{"200":{"description":"Usage report with the month's statement under `tariff`.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/UsageReport"}},"required":["data"]}}}},"400":{"description":"INVALID_PERIOD.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/account/keys":{"get":{"operationId":"listApiKeys","summary":"My API keys (prefix and dates, never the key)","tags":["Account"],"security":[{"partnerKey":[]}],"responses":{"200":{"description":"Keys.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ApiKeyView"}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"description":"REGISTRY_PARTNER.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createApiKey","summary":"Create an API key (returned once)","description":"At most 5 active keys at once (409 KEY_LIMIT).","tags":["Account"],"security":[{"partnerKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateKey"}}}},"responses":{"201":{"description":"The key, ONCE, in `key`.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"allOf":[{"$ref":"#/components/schemas/ApiKeyView"},{"type":"object","properties":{"key":{"type":"string"}},"required":["key"]}]}},"required":["data"]}}}},"400":{"$ref":"#/components/responses/Invalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"description":"KEY_LIMIT or REGISTRY_PARTNER.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/account/keys/{keyId}":{"delete":{"operationId":"revokeApiKey","summary":"Revoke a key","description":"The last active key cannot be revoked (409 LAST_KEY): create another one first.","tags":["Account"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/KeyId"}],"responses":{"200":{"description":"Revoked.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"revoked":{"type":"boolean"}}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"LAST_KEY or REGISTRY_PARTNER.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/account/signing-secret/rotate":{"post":{"operationId":"rotateSigningSecret","summary":"New signing secret (returned once)","description":"The signing secret verifies the events we send you and signs the entitlement tokens you give to your visitors. Rotating replaces the previous one at once.","tags":["Account"],"security":[{"partnerKey":[]}],"responses":{"200":{"description":"The secret, ONCE.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"signingSecret":{"type":"string"}}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"description":"REGISTRY_PARTNER.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"ENCRYPTION_UNAVAILABLE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/account/event-url":{"put":{"operationId":"setEventUrl","summary":"Register the events URL (signed challenge)","description":"We POST `{\"event\":\"url_verification\",\"challenge\":\"...\"}` signed with your signing secret to the URL. It is stored only if it answers 200 with `{\"challenge\":\"<the same>\"}`. Until then it receives nothing; the previous URL keeps working if the new one fails. Rotate the signing secret first (409 NO_SIGNING_SECRET).","tags":["Account"],"security":[{"partnerKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventUrl"}}}},"responses":{"200":{"description":"Verified and stored.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"eventUrl":{"type":"string"},"verifiedAt":{"type":"string","format":"date-time"}}}},"required":["data"]}}}},"400":{"description":"INVALID_EVENT_URL.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"description":"NO_SIGNING_SECRET or REGISTRY_PARTNER.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"EVENT_URL_REJECTED (private or unresolvable address) or CHALLENGE_FAILED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"clearEventUrl","summary":"Stop receiving events","tags":["Account"],"security":[{"partnerKey":[]}],"responses":{"200":{"description":"Cleared.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"eventUrl":{"type":"null"}}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"description":"REGISTRY_PARTNER.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/account/go-live":{"post":{"operationId":"goLive","summary":"Go from sandbox to production (payment method and explicit yes)","description":"Accept the tariff version of GET /account and get a Stripe Checkout URL to add a payment method and subscribe to the platform fee. When the checkout completes, the account moves to production and usage starts being billed monthly. Nothing is charged before that.","tags":["Account"],"security":[{"partnerKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoLive"}}}},"responses":{"201":{"description":"Checkout URL.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"checkoutUrl":{"type":"string"}}}},"required":["data"]}}}},"400":{"description":"CONSENT_REQUIRED or invalid body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"description":"TARIFF_CHANGED, ALREADY_PRODUCTION, INVALID_STATE or REGISTRY_PARTNER.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"TARIFF_NOT_IN_STRIPE or BILLING_UNAVAILABLE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orgs":{"post":{"operationId":"createOrg","summary":"Create a sub-account (idempotent by externalId)","description":"IDEMPOTENT by (you, externalId): a retry returns the same organization with 200 and `created: false` and changes nothing (capabilities are only applied on creation; use PUT /orgs/{id}/capabilities afterwards). A new one answers 201. In the sandbox: at most 3 sub-accounts (403 SANDBOX_LIMIT), created as test accounts with the conversation and voice caps already applied.","tags":["Sub-accounts"],"security":[{"partnerKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrg"}}}},"responses":{"200":{"description":"Already existed.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"created":{"const":false}},"required":["organizationId","created"]}},"required":["data"]}}}},"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"created":{"const":true},"capabilities":{"$ref":"#/components/schemas/OrgCapabilities"},"telephonyError":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"description":"The sub-account exists but telephony was not applied; retry with PUT /capabilities."}},"required":["organizationId","created"]}},"required":["data"]}}}},"400":{"$ref":"#/components/responses/Invalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"SANDBOX_LIMIT or TELEPHONY_NOT_RESOLD.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"DOMAIN_IN_USE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"CREATE_FAILED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orgs/{organizationId}/capabilities":{"get":{"operationId":"getCapabilities","summary":"Voice capabilities as applied now","tags":["Sub-accounts"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"responses":{"200":{"description":"Capabilities.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"capabilities":{"$ref":"#/components/schemas/OrgCapabilities"}}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"put":{"operationId":"putCapabilities","summary":"Change web voice (and, if resold, telephony)","description":"Applied to the next call: one in progress ends with the caps it started with. In the sandbox the voice minutes are clamped to the sandbox caps. `telephony` needs telephony resale (403 TELEPHONY_NOT_RESOLD) and cannot be switched off with an active number (409 TELEPHONY_NUMBERS_ACTIVE).","tags":["Sub-accounts"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Capabilities"}}}},"responses":{"200":{"description":"Applied.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"capabilities":{"$ref":"#/components/schemas/OrgCapabilities"},"cancelledPhoneNumberRequests":{"type":"integer"}}}},"required":["data"]}}}},"400":{"$ref":"#/components/responses/Invalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"TELEPHONY_NOT_RESOLD.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"TELEPHONY_NUMBERS_ACTIVE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orgs/{organizationId}/tool-secret/rotate":{"post":{"operationId":"rotateToolSecret","summary":"New x-agenteuno-secret for the agent webhook tools (returned once)","description":"Sent in `x-agenteuno-secret` to every tool endpoint of this sub-account. Rotating invalidates the previous one on the next tool call: store the new one before depending on it.","tags":["Agent and knowledge"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"responses":{"200":{"description":"The secret, ONCE. `Cache-Control: no-store`.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"header":{"type":"string"},"secret":{"type":"string"},"rotatedAt":{"type":"string","format":"date-time"}}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"description":"NOT_CONFIGURED: secret encryption is not configured.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orgs/{organizationId}/tool-signing-secret/rotate":{"post":{"operationId":"rotateToolSigningSecret","summary":"New tool-call signing secret (returned once)","description":"Tool calls carry `x-agenteuno-tool-signature: v1=<hex HMAC-SHA256>` over `<timestamp>\\n<METHOD>\\n<path?query>\\n<body>` and `x-agenteuno-tool-timestamp`. Reject what is older than 300 s. Accept both secrets while you change yours.","tags":["Agent and knowledge"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"responses":{"200":{"description":"The secret, ONCE. `Cache-Control: no-store`.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"signatureHeader":{"type":"string"},"timestampHeader":{"type":"string"},"secret":{"type":"string"},"rotatedAt":{"type":"string","format":"date-time"}}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"description":"NOT_CONFIGURED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orgs/{organizationId}/conversation-quota":{"put":{"operationId":"putConversationQuota","summary":"Set the monthly conversation quota","description":"Opt-in. Without it the sub-account follows its plan cut-off. In the sandbox the quota IS the conversation cap: it is clamped to 50 per month.","tags":["Quotas and usage"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationQuota"}}}},"responses":{"200":{"description":"Applied.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"quota":{"type":"object","properties":{"included":{"type":"integer"},"hard":{"type":"integer"},"warn":{"type":"integer"},"margin":{"type":"integer"},"timeZone":{"type":"string"},"perSubject":{"type":"object","properties":{},"additionalProperties":true}},"additionalProperties":true}}}},"required":["data"]}}}},"400":{"description":"INVALID_TIME_ZONE or schema error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Sandbox"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"description":"AI_CONCEALMENT_NOT_ALLOWED in a stop message.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteConversationQuota","summary":"Remove the quota","description":"Usage rows are kept. Not available in the sandbox (403 SANDBOX_LIMIT).","tags":["Quotas and usage"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"responses":{"200":{"description":"Removed.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"quota":{"type":"null"}}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Sandbox"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/conversation-usage":{"get":{"operationId":"getConversationUsage","summary":"Quota usage of all sub-accounts with a quota","tags":["Quotas and usage"],"security":[{"partnerKey":[]}],"parameters":[{"name":"period","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"},"description":"YYYY-MM. Default: the current one of each sub-account, in its time zone."}],"responses":{"200":{"description":"Rows.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/QuotaUsageRow"}}},"required":["data"]}}}},"400":{"description":"INVALID_PERIOD.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/orgs/{organizationId}/agent":{"get":{"operationId":"getAgent","summary":"The principal agent, as you wrote it","tags":["Agent and knowledge"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"responses":{"200":{"description":"Agent.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"agentId":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"string"},"model":{"type":"string"},"language":{"type":"string"},"voiceName":{"anyOf":[{"type":"string"},{"type":"null"}]},"greeting":{"anyOf":[{"type":"string"},{"type":"null"}]},"fallbackMessage":{"anyOf":[{"type":"string"},{"type":"null"}]},"temperature":{"type":"number"},"maxTokens":{"type":"integer"},"systemPrompt":{"type":"string"},"tools":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"parameters":{"type":"object","properties":{},"additionalProperties":true},"endpoint":{"type":"string"},"builtin":{"type":"boolean"}}}},"updatedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"NOT_FOUND or AGENT_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"operationId":"putAgent","summary":"Create or update the agent of a sub-account","description":"Upsert of the single principal agent (a second agent is never created) and of its web chat channel, so it is reachable by chat and widget voice.","tags":["Agent and knowledge"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertAgent"}}}},"responses":{"200":{"description":"Saved.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"agentId":{"type":"string","format":"uuid"}},"required":["agentId"]}},"required":["data"]}}}},"400":{"description":"UNKNOWN_BUILTIN_TOOL, BUILTIN_TOOL_NAME, DUPLICATE_TOOL_NAME, INVALID_TIME_ZONE or schema error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Sandbox"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"description":"AI_CONCEALMENT_NOT_ALLOWED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"CREATE_FAILED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orgs/{organizationId}/agent/tools":{"post":{"operationId":"addAgentTool","summary":"Add or replace ONE webhook tool, touching nothing else","tags":["Agent and knowledge"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tool"}}}},"responses":{"200":{"description":"Applied.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"agentId":{"type":"string","format":"uuid"},"tool":{"type":"string"},"action":{"type":"string","enum":["added","updated","unchanged"]},"tools":{"type":"array","items":{"type":"string"}}}}},"required":["data"]}}}},"400":{"description":"BUILTIN_TOOL_NAME or TOO_MANY_TOOLS (30 custom tools).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"NOT_FOUND or AGENT_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orgs/{organizationId}/agent/allowed-domains":{"post":{"operationId":"addAllowedDomains","summary":"Append domains that may open the widget","description":"Never removes or reorders. With an unrestricted widget (empty list) it changes nothing and says `unrestricted: true`: adding one host would close the widget everywhere else.","tags":["Agent and knowledge"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddAllowedDomains"}}}},"responses":{"200":{"description":"Applied.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"agentId":{"type":"string","format":"uuid"},"added":{"type":"array","items":{"type":"string"}},"unchanged":{"type":"array","items":{"type":"string"}},"unrestricted":{"type":"boolean"},"allowedDomains":{"type":"array","items":{"type":"string"}}}}},"required":["data"]}}}},"400":{"description":"TOO_MANY_DOMAINS (50).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"NOT_FOUND, AGENT_NOT_FOUND or CHANNEL_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orgs/{organizationId}/knowledge":{"put":{"operationId":"putKnowledge","summary":"Sync the knowledge base with your complete document list","description":"Creates, updates what changed, leaves what is equal and deletes what you no longer list. Idempotent. Embeddings continue in the background (202): poll GET. Needs the agent first (409 NO_AGENT).","tags":["Agent and knowledge"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeSync"}}}},"responses":{"202":{"description":"Accepted.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"knowledgeBaseId":{"type":"string","format":"uuid"},"created":{"type":"integer"},"updated":{"type":"integer"},"unchanged":{"type":"integer"},"removed":{"type":"integer"},"pending":{"type":"integer"}}}},"required":["data"]}}}},"400":{"$ref":"#/components/responses/Invalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"NO_AGENT.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"getKnowledge","summary":"State of the knowledge base, per document","tags":["Agent and knowledge"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"responses":{"200":{"description":"Status.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"knowledgeBaseId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"documents":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"title":{"type":"string"},"status":{"type":"string"},"chunkCount":{"type":"integer"}}}},"pending":{"type":"integer"},"failed":{"type":"integer"},"imported":{"type":"integer"}}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/orgs/{organizationId}/knowledge-gaps":{"get":{"operationId":"getKnowledgeGaps","summary":"Questions the knowledge base could not answer","tags":["Agent and knowledge"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"},{"name":"since","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Ascending pagination by date."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":500,"default":100}}],"responses":{"200":{"description":"Gaps.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"query":{"type":"string"},"conversationId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"}}}}},"required":["data"]}}}},"400":{"description":"BAD_REQUEST: since is not an ISO date.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/grants/voice":{"post":{"operationId":"createVoiceGrant","summary":"Signed permission to open a web voice call","description":"Server to server, from YOUR backend, never from the browser. Returns a signed `grant` valid 600 s to open the WebSocket `wsUrl?grant=<grant>`. The call lasts at most `maxSeconds` (cap 900 s). The visitor never has an account.","tags":["Sessions and grants"],"security":[{"partnerKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceGrantRequest"}}}},"responses":{"200":{"description":"Grant.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"grant":{"type":"string"},"grantId":{"type":"string","format":"uuid"},"wsUrl":{"type":"string"},"expiresIn":{"type":"integer"},"maxSeconds":{"type":"integer"}}}},"required":["data"]}}}},"400":{"$ref":"#/components/responses/Invalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"WEB_VOICE_NOT_ENABLED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"NOT_FOUND: agent not found for this partner.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"disclosure_required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"description":"PUBLIC_ACCESS_LIMITER_UNAVAILABLE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/grants/chat":{"post":{"operationId":"createChatGrant","summary":"Signed permission and widget token for a text chat","description":"Returns a `widgetToken` (1 h) and a `grant`, and the steps of the chat protocol: ONE WebSocket `/ws/chat`, there is no POST that returns the reply. With `requireEntitlement` add `&entitlement=<token>` to the socket URL.","tags":["Sessions and grants"],"security":[{"partnerKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatGrantRequest"}}}},"responses":{"200":{"description":"Grant.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"widgetToken":{"type":"string"},"expiresIn":{"type":"integer"},"grant":{"type":"string"},"grantId":{"type":"string","format":"uuid"},"agentId":{"type":"string","format":"uuid"},"endpoints":{"type":"object","properties":{"chatWs":{"type":"string"},"result":{"type":"string"}}},"protocol":{"type":"object","properties":{"steps":{"type":"array","items":{"type":"string"}},"conversationIdFrom":{"type":"string"}}}}}},"required":["data"]}}}},"400":{"$ref":"#/components/responses/Invalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"NOT_FOUND: agent not found for this partner.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"description":"PUBLIC_ACCESS_LIMITER_UNAVAILABLE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orgs/{organizationId}/session":{"post":{"operationId":"createOrgSession","summary":"Short-lived organization JWT for your panel","description":"A JWT (role viewer or admin, default 900 s) that lets YOUR backend, acting for its client, call the organization routes of the main API (conversations list, dashboard socket, conversation status). It is not the embeddable chat or voice: for those use the grants.","tags":["Sessions and grants"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionRequest"}}}},"responses":{"200":{"description":"JWT.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"jwt":{"type":"string"},"expiresIn":{"type":"integer"}}}},"required":["data"]}}}},"400":{"$ref":"#/components/responses/Invalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"description":"CREATE_FAILED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orgs/{organizationId}/channels":{"get":{"operationId":"getChannels","summary":"Aggregated state of the channels, no secrets","tags":["Channels"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"responses":{"200":{"description":"State.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"phone":{"type":"object","properties":{"status":{"type":"string","enum":["none","requested","active"]},"requestId":{"type":"string","format":"uuid"},"numberE164":{"type":"string"}}},"whatsapp":{"type":"object","properties":{"status":{"type":"string","enum":["none","connected","error"]},"displayPhone":{"type":"string"},"verifiedName":{"type":"string"}}},"instagram":{"type":"object","properties":{"status":{"type":"string","enum":["none","connected","expiring","expired"]},"username":{"type":"string"},"expiresAt":{"type":"string","format":"date-time"}}},"missedCall":{"$ref":"#/components/schemas/MissedCall"},"voiceReplies":{"$ref":"#/components/schemas/VoiceReplies"}}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/orgs/{organizationId}/phone-number-request":{"post":{"operationId":"requestPhoneNumber","summary":"File a request for a phone number (never buys)","description":"Idempotent: an active number or a pending request is returned as is (200, `created: false`). Otherwise a request is filed (201); an administrator approves it. Spanish local number at Telnyx; you only say where and why.\n\nClosed in the sandbox: answers 403 SANDBOX_CHANNEL_DISABLED.","tags":["Channels"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PhoneNumberRequest"}}}},"responses":{"200":{"description":"Existing.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"status":{"type":"string"},"created":{"const":false}},"additionalProperties":true}},"required":["data"]}}}},"201":{"description":"Filed.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"status":{"const":"requested"},"requestId":{"type":"string","format":"uuid"},"created":{"const":true}}}},"required":["data"]}}}},"400":{"$ref":"#/components/responses/Invalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"SANDBOX_CHANNEL_DISABLED or a refusal code of the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"A refusal code of the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}},"x-sandbox-blocked":true}},"/orgs/{organizationId}/whatsapp/embedded-signup/config":{"get":{"operationId":"getWhatsAppEmbeddedSignupConfig","summary":"What FB.login needs to connect the client WhatsApp","tags":["Channels"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"responses":{"200":{"description":"Client config for Embedded Signup.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{},"additionalProperties":true}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"description":"META_NOT_CONFIGURED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orgs/{organizationId}/whatsapp/embedded-signup/exchange":{"post":{"operationId":"exchangeWhatsAppEmbeddedSignup","summary":"Connect the client WhatsApp Business account","description":"Closed in the sandbox: answers 403 SANDBOX_CHANNEL_DISABLED.","tags":["Channels"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddedSignupExchange"}}}},"responses":{"200":{"description":"Connected.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{},"additionalProperties":true}},"required":["data"]}}}},"400":{"description":"EXCHANGE_FAILED, SUBSCRIBE_FAILED, REGISTER_FAILED or schema error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"SANDBOX_CHANNEL_DISABLED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"NO_AGENT.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"description":"META_NOT_CONFIGURED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-sandbox-blocked":true}},"/orgs/{organizationId}/missed-call":{"put":{"operationId":"putMissedCall","summary":"Missed-call follow-up setting","tags":["Channels"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MissedCall"}}}},"responses":{"200":{"description":"Saved.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"missedCall":{"$ref":"#/components/schemas/MissedCall"}}}},"required":["data"]}}}},"400":{"$ref":"#/components/responses/Invalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/orgs/{organizationId}/voice-replies":{"put":{"operationId":"putVoiceReplies","summary":"Reply with voice notes or always text","tags":["Channels"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceReplies"}}}},"responses":{"200":{"description":"Saved.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"voiceReplies":{"$ref":"#/components/schemas/VoiceReplies"}}}},"required":["data"]}}}},"400":{"$ref":"#/components/responses/Invalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/orgs/{organizationId}/instagram/oauth/start":{"get":{"operationId":"startInstagramOAuth","summary":"URL to connect the client Instagram","description":"Returns the authorization URL. `returnTo` must be an https URL on one of your registered domains.\n\nClosed in the sandbox: answers 403 SANDBOX_CHANNEL_DISABLED.","tags":["Channels"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"},{"name":"returnTo","in":"query","required":true,"schema":{"type":"string","format":"uri"}},{"name":"agentId","in":"query","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"URL.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"url":{"type":"string"}}}},"required":["data"]}}}},"400":{"description":"RETURN_TO_NOT_ALLOWED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"SANDBOX_CHANNEL_DISABLED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"AGENT_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"META_NOT_CONFIGURED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-sandbox-blocked":true}},"/orgs/{organizationId}/telegram":{"get":{"operationId":"getTelegram","summary":"State of the Telegram bot","tags":["Channels"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"responses":{"200":{"description":"State.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"telegram":{"type":"object","properties":{"status":{"type":"string","enum":["none","connected","disabled","pending_webhook"]},"botUsername":{"type":"string"},"instructions":{"type":"boolean"},"greeting":{"type":"boolean"}}}}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"put":{"operationId":"putTelegram","summary":"Connect or configure the Telegram bot","description":"Closed in the sandbox: answers 403 SANDBOX_CHANNEL_DISABLED.","tags":["Channels"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TelegramConnect"}}}},"responses":{"200":{"description":"State.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"telegram":{"type":"object","properties":{},"additionalProperties":true}}}},"required":["data"]}}}},"400":{"description":"BOT_TOKEN_REQUIRED or VALIDATION_ERROR.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"SANDBOX_CHANNEL_DISABLED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"NO_AGENT or BOT_IN_USE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"BOT_TOKEN_REJECTED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"description":"WEBHOOK_FAILED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-sandbox-blocked":true},"delete":{"operationId":"deleteTelegram","summary":"Disconnect the Telegram bot","description":"Closed in the sandbox: answers 403 SANDBOX_CHANNEL_DISABLED.","tags":["Channels"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"responses":{"200":{"description":"Disconnected.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"telegram":{"type":"object","properties":{},"additionalProperties":true}}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"SANDBOX_CHANNEL_DISABLED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}},"x-sandbox-blocked":true}},"/orgs/{organizationId}/telegram/messages":{"post":{"operationId":"sendTelegramMessage","summary":"Send a message to a user who already wrote to the bot","description":"Closed in the sandbox: answers 403 SANDBOX_CHANNEL_DISABLED.","tags":["Channels"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TelegramSend"}}}},"responses":{"200":{"description":"Delivered.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"delivered":{"type":"boolean"},"conversationId":{"type":"string","format":"uuid"}}}},"required":["data"]}}}},"400":{"description":"VALIDATION_ERROR.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"SANDBOX_CHANNEL_DISABLED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"NOT_FOUND or RECIPIENT_UNKNOWN.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"TELEGRAM_NOT_CONNECTED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"TELEGRAM_SEND_RATE_LIMITED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"SEND_FAILED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-sandbox-blocked":true}},"/orgs/{organizationId}/whatsapp":{"get":{"operationId":"getWhatsApp","summary":"State of the WhatsApp channel (never a token)","tags":["Channels"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"responses":{"200":{"description":"State.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"whatsapp":{"type":"object","properties":{"status":{"type":"string","enum":["none","disabled","connected","error"]},"enabled":{"type":"boolean"},"instructions":{"type":"boolean"}},"additionalProperties":true}}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"put":{"operationId":"putWhatsApp","summary":"Prepare or configure the WhatsApp channel before its number","description":"Only instructions, fallback messages, allowed senders and enabled. `enabled: true` needs a connected number (409 WHATSAPP_NOT_BOUND) that this organization connected itself (403 WHATSAPP_BINDING_NOT_OWNED, WHATSAPP_SANDBOX_CHANNEL).\n\nClosed in the sandbox: answers 403 SANDBOX_CHANNEL_DISABLED.","tags":["Channels"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsAppUpdate"}}}},"responses":{"200":{"description":"State.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"whatsapp":{"type":"object","properties":{},"additionalProperties":true}}}},"required":["data"]}}}},"400":{"description":"VALIDATION_ERROR.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"SANDBOX_CHANNEL_DISABLED, WHATSAPP_BINDING_NOT_OWNED or WHATSAPP_SANDBOX_CHANNEL.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"WHATSAPP_NOT_BOUND or NO_AGENT.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}},"x-sandbox-blocked":true}},"/orgs/{organizationId}/outbound-calls":{"post":{"operationId":"createOutboundCall","summary":"Place (or simulate) an outbound AI call","description":"`dryRun` is mandatory. `true` writes nothing and calls nobody: it answers what would happen (legal calling window, caller id, agent, opt-outs). `false` runs the same compliance gate as the main API and needs the person's consent with its proof in `consent` for a commercial call.\n\nClosed in the sandbox: answers 403 SANDBOX_CHANNEL_DISABLED.","tags":["Outbound calls"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutboundCallRequest"}}}},"responses":{"200":{"description":"Dry-run report.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"dryRun":{"const":true}},"required":["dryRun"],"additionalProperties":true}},"required":["data"]}}}},"201":{"description":"Call dialing.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"dryRun":{"const":false},"conversationId":{"type":"string","format":"uuid"},"callControlId":{"type":"string"},"status":{"const":"dialing"},"agentId":{"type":"string","format":"uuid"},"from":{"type":"string"},"to":{"type":"string"},"externalRef":{"anyOf":[{"type":"string"},{"type":"null"}]}}}},"required":["data"]}}}},"400":{"description":"AGENT_INACTIVE, NO_VOICE_CHANNEL, NO_PHONE_NUMBER or a caller-id code.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"description":"A payment/budget code with retryAt.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"SANDBOX_CHANNEL_DISABLED, PLAN_LIMIT or a compliance rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"NOT_FOUND or agent not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"CALL_MODE_UNAVAILABLE: the brief asked for a call mode this call cannot honour (`callMode`, `reason`; `message` in the Accept-Language of the request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"INVALID_CONSENT.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"425":{"description":"Outside the legal calling window; retryAt.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"description":"CALL_FAILED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-sandbox-blocked":true}},"/orgs/{organizationId}/conversations/{conversationId}/bot-active":{"put":{"operationId":"setBotActive","summary":"Pause or resume the AI in one chat (human takeover)","tags":["Agent and knowledge"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"},{"$ref":"#/components/parameters/ConversationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BotActive"}}}},"responses":{"200":{"description":"State.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"conversationId":{"type":"string","format":"uuid"},"botActive":{"type":"boolean"},"humanTakeoverAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"changed":{"type":"boolean"}}}},"required":["data"]}}}},"400":{"description":"VALIDATION_ERROR.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/orgs/{organizationId}/conversations":{"get":{"operationId":"listCommunications","summary":"Everything the agent of the sub-account handled: calls, WhatsApp, web chat, Telegram","description":"`medium` says how the person reached us even when `channelType` says otherwise (a WhatsApp call over SIP is `voice` with medium `whatsapp`). Whitelist projection for a panel; newest first; keyset `cursor`.","tags":["Sub-accounts"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"},{"name":"medium","in":"query","required":false,"schema":{"type":"string","enum":["phone","whatsapp","web","telegram","instagram","facebook","sms","email"]}},{"name":"kind","in":"query","required":false,"schema":{"type":"string","enum":["call","message"]}},{"name":"channelType","in":"query","required":false,"schema":{"type":"string","enum":["voice","web_chat","whatsapp","telegram","instagram","facebook","sms","email"]}},{"name":"dateFrom","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"dateTo","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"`pagination.nextCursor` of the previous page."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":30}}],"responses":{"200":{"description":"A page.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Communication"}},"pagination":{"type":"object","properties":{"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"hasMore":{"type":"boolean"}}}}}}}},"400":{"description":"INVALID_FILTER or INVALID_CURSOR.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/orgs/{organizationId}/conversations/{conversationId}":{"get":{"operationId":"getCommunication","summary":"One conversation with its transcript (spoken turns only)","tags":["Sub-accounts"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"},{"$ref":"#/components/parameters/ConversationId"}],"responses":{"200":{"description":"Conversation.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CommunicationDetail"}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/orgs/{organizationId}/conversations/{conversationId}/recording":{"get":{"operationId":"getCommunicationRecording","summary":"Signed links (5 minutes) to the audio and waveform peaks of a call","tags":["Sub-accounts"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"},{"$ref":"#/components/parameters/ConversationId"}],"responses":{"200":{"description":"Links, or status none.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"status":{"type":"string","enum":["ready","none"]},"url":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"peaksUrl":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"durationMs":{"anyOf":[{"type":"integer"},{"type":"null"}]},"expiresIn":{"anyOf":[{"type":"integer"},{"type":"null"}]}}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"410":{"description":"RECORDING_DECLINED: the person asked not to be recorded; there is no audio on purpose.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/orgs/{organizationId}/webhook-endpoints":{"get":{"operationId":"listWebhookEndpoints","summary":"Webhook endpoints of the sub-account (scheme, host and path only)","tags":["Sub-accounts"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"responses":{"200":{"description":"Endpoints.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"url":{"anyOf":[{"type":"string"},{"type":"null"}]},"events":{"type":"array","items":{"type":"string"}},"active":{"type":"boolean"}}}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/orgs/{organizationId}/events":{"get":{"operationId":"listOrgEvents","summary":"Published events of the sub-account after a sequence number, ascending","tags":["Sub-accounts"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"},{"name":"after_seq","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":1000,"default":100}}],"responses":{"200":{"description":"A page of events.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"eventId":{"type":"string"},"orgSeq":{"type":"integer"},"type":{"type":"string"},"subjectId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"payload":{"type":"object","properties":{},"additionalProperties":true},"createdAt":{"type":"string","format":"date-time"}},"required":["eventId","orgSeq","type","subjectId","payload","createdAt"]}},"nextAfterSeq":{"type":"integer"},"hasMore":{"type":"boolean"},"orgEventsEnabled":{"type":"boolean"}},"required":["data","nextAfterSeq","hasMore","orgEventsEnabled"]}}}},"400":{"$ref":"#/components/responses/Invalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/orgs/{organizationId}/events/digest":{"get":{"operationId":"digestOrgEvents","summary":"Count and sha256 of the event ids in a sequence range (reconciliation)","tags":["Sub-accounts"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"},{"name":"from_seq","in":"query","required":true,"schema":{"type":"integer","minimum":1}},{"name":"to_seq","in":"query","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"sha256 over \"<eventId>\\n\" of every event in the range, ascending.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"fromSeq":{"type":"integer"},"toSeq":{"type":"integer"},"count":{"type":"integer"},"sha256":{"type":"string"},"algorithm":{"type":"string"}},"required":["fromSeq","toSeq","count","sha256","algorithm"]}},"required":["data"]}}}},"400":{"$ref":"#/components/responses/Invalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/orgs/{organizationId}/live-tickets":{"post":{"operationId":"createLiveTicket","summary":"One-time ticket (60 s) for a browser to open the live event stream of the sub-account","tags":["Sub-accounts"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"responses":{"201":{"description":"Ticket for GET /v1/live/orgs/{organizationId}/events?ticket=.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"ticket":{"type":"string"},"expiresIn":{"type":"integer"},"streamPath":{"type":"string"}},"required":["ticket","expiresIn","streamPath"]}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/orgs/{organizationId}/adopt-agent":{"post":{"operationId":"adoptAgent","summary":"Move an agent of the parent organization into a sub-account","description":"House partners only: self-service integrators do not use this route.","tags":["House partners"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentIdBody"}}}},"responses":{"200":{"description":"Moved (or already there).","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"agentId":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"moved":{"type":"boolean"}},"additionalProperties":true}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Cannot be moved safely; nothing changed. `reasons` lists why.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-internal":true}},"/orgs/{organizationId}/release-agent":{"post":{"operationId":"releaseAgent","summary":"Move an agent back to the parent organization","description":"House partners only: self-service integrators do not use this route.","tags":["House partners"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentIdBody"}}}},"responses":{"200":{"description":"Moved back.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{},"additionalProperties":true}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Cannot be moved back safely.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-internal":true}},"/orgs/{organizationId}/adopt-agent/check":{"get":{"operationId":"checkAdoptAgent","summary":"Dry check of an adoption","description":"House partners only: self-service integrators do not use this route.","tags":["House partners"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"},{"name":"agentId","in":"query","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Report with `adoptable`.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"adoptable":{"type":"boolean"}},"additionalProperties":true}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}},"x-internal":true}},"/orgs/{organizationId}/knowledge/import":{"post":{"operationId":"importParentAgentKnowledge","summary":"Copy the knowledge of a legacy parent agent","description":"House partners only: self-service integrators do not use this route.","tags":["House partners"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeImport"}}}},"responses":{"200":{"description":"Result.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{},"additionalProperties":true}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"NO_AGENT.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-internal":true}},"/agents/{agentId}/human-transfer":{"get":{"operationId":"getHumanTransferPolicy","summary":"Human transfer policy of an agent (phones masked)","tags":["Agent and knowledge"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"}],"responses":{"200":{"description":"Policy.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/HumanTransferPolicyView"}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"put":{"operationId":"putHumanTransferPolicy","summary":"Save the human transfer policy of an agent","description":"Body { policy }. Missing numeric fields take their defaults. A masked phone sent back for an existing target id keeps the stored number.","tags":["Agent and knowledge"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"policy":{"$ref":"#/components/schemas/HumanTransferPolicy"}},"required":["policy"]}}}},"responses":{"200":{"description":"Saved.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/HumanTransferPolicyView"}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"description":"VALIDATION_ERROR with one entry per invalid field.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HumanTransferValidationError"}}}}}}},"/agents/{agentId}/human-transfer/preview":{"post":{"operationId":"previewHumanTransferPolicy","summary":"Would the agent transfer to a person at this instant?","description":"Pure: no call, no message, no write. Without policy, the saved (or legacy) one is used. The calendar is read only when skipWhenCalendarBusy decides.","tags":["Agent and knowledge"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"at":{"type":"string","format":"date-time","description":"ISO 8601 with offset or Z."},"policy":{"$ref":"#/components/schemas/HumanTransferPolicy"}},"required":["at"]}}}},"responses":{"200":{"description":"Decision.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"wouldTransfer":{"type":"boolean"},"reason":{"type":"string","enum":["ok","disabled","outside_schedule","excluded_date","calendar_busy","no_target","destination_refused","outbound_blocked"]},"localTime":{"type":"string","description":"YYYY-MM-DDTHH:MM in the policy zone."},"weekday":{"type":"string","enum":["mon","tue","wed","thu","fri","sat","sun"]}},"required":["wouldTransfer","reason","localTime","weekday"]}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"description":"VALIDATION_ERROR with one entry per invalid field.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HumanTransferValidationError"}}}}}}},"/parent-agents/{agentId}":{"get":{"operationId":"getParentAgent","summary":"Describe a legacy agent of the parent organization","description":"House partners only: self-service integrators do not use this route.","tags":["House partners"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"}],"responses":{"200":{"description":"Description.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{},"additionalProperties":true}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}},"x-internal":true}},"/parent-agents/{agentId}/status":{"put":{"operationId":"setParentAgentStatus","summary":"Pause or reactivate a legacy parent agent (never deleted)","description":"House partners only: self-service integrators do not use this route.","tags":["House partners"],"security":[{"partnerKey":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParentAgentStatus"}}}},"responses":{"200":{"description":"Applied.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"agentId":{"type":"string","format":"uuid"}},"additionalProperties":true}},"required":["data"]}}}},"400":{"$ref":"#/components/responses/Invalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}},"x-internal":true}},"/crisis-policy":{"put":{"operationId":"applyCrisisPolicy","summary":"Apply the crisis protocol to every agent of the partner","description":"Only partners with a safety hook (403 NO_SAFETY_HOOK otherwise).\n\nHouse partners only: self-service integrators do not use this route.","tags":["House partners"],"security":[{"partnerKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrisisPolicyApply"}}}},"responses":{"200":{"description":"Applied.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{},"additionalProperties":true}},"required":["data"]}}}},"400":{"$ref":"#/components/responses/Invalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"NO_SAFETY_HOOK.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-internal":true}},"/transfersmanager/subjects/{subject}":{"delete":{"operationId":"eraseTransfersManagerSubject","summary":"Erase a demo lead by its opaque subject","description":"Authenticated with `x-service-key` of TransfersManager, not `x-partner-key`.\n\nHouse partners only: self-service integrators do not use this route.","tags":["Data erasure"],"security":[{"serviceKey":[]}],"parameters":[{"name":"subject","in":"path","required":true,"schema":{"type":"string","pattern":"^tmlead_[a-f0-9]{32}$"}}],"responses":{"204":{"description":"Erased."},"400":{"description":"INVALID_SUBJECT.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_SERVICE_KEY.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"ERASURE_INCOMPLETE, ERASURE_FAILED or NOT_CONFIGURED: retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-internal":true}},"/transfersmanager/conversations/{conversationId}":{"delete":{"operationId":"eraseTransfersManagerConversation","summary":"Erase one demo conversation","description":"House partners only: self-service integrators do not use this route.","tags":["Data erasure"],"security":[{"serviceKey":[]}],"parameters":[{"$ref":"#/components/parameters/ConversationId"}],"responses":{"204":{"description":"Erased."},"400":{"description":"INVALID_CONVERSATION_ID.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_SERVICE_KEY.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"ERASURE_INCOMPLETE or ERASURE_FAILED: retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-internal":true}},"/transfersmanager/assistant-conversations/{conversationId}":{"delete":{"operationId":"eraseTransfersManagerAssistantConversation","summary":"Erase one conversation of the fleet manager assistant (retention)","description":"Only conversations of the TransfersManager organization tagged `tm_manager`; any other id answers 204 and nothing is touched.\n\nHouse partners only: self-service integrators do not use this route.","tags":["Data erasure"],"security":[{"serviceKey":[]}],"parameters":[{"$ref":"#/components/parameters/ConversationId"}],"responses":{"204":{"description":"Erased."},"400":{"description":"INVALID_CONVERSATION_ID.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_SERVICE_KEY.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"ERASURE_INCOMPLETE or ERASURE_FAILED: retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-internal":true}},"/transfersmanager/callers/{e164}":{"delete":{"operationId":"eraseTransfersManagerCaller","summary":"Erase a caller by phone number","description":"House partners only: self-service integrators do not use this route.","tags":["Data erasure"],"security":[{"serviceKey":[]}],"parameters":[{"name":"e164","in":"path","required":true,"schema":{"type":"string","pattern":"^\\+[1-9]\\d{6,14}$"}}],"responses":{"204":{"description":"Erased."},"400":{"description":"INVALID_NUMBER.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_SERVICE_KEY.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"ERASURE_INCOMPLETE or ERASURE_FAILED: retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-internal":true}}},"webhooks":{"quota.threshold":{"post":{"summary":"A sub-account crossed a conversation quota threshold","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuotaEvent"}}}},"responses":{"200":{"description":"Any 2xx acknowledges. Otherwise one retry after 30 s."}}}},"url_verification":{"post":{"summary":"Challenge when you register the events URL","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UrlVerificationEvent"}}}},"responses":{"200":{"description":"Echo the challenge.","content":{"application/json":{"schema":{"type":"object","properties":{"challenge":{"type":"string"}},"required":["challenge"]}}}}}}}},"components":{"securitySchemes":{"partnerKey":{"type":"apiKey","in":"header","name":"x-partner-key","description":"Integrator key (au_sbx_... or au_live_...) or house partner service key."},"serviceKey":{"type":"apiKey","in":"header","name":"x-service-key","description":"House partner service key (data erasure routes only)."}},"parameters":{"OrganizationId":{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Sub-account id returned by POST /orgs."},"ConversationId":{"name":"conversationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},"AgentId":{"name":"agentId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},"KeyId":{"name":"keyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}},"responses":{"Unauthorized":{"description":"Missing or invalid x-partner-key (code ERROR with the message).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"NOT_FOUND: the organization is not one of yours, or does not exist (same answer).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Invalid":{"description":"The body does not match the schema.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}},"Sandbox":{"description":"SANDBOX_LIMIT: a sandbox cap would be exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"RateLimited":{"description":"Too many requests (a rate limit code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable code (see the error list in the guide)."},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":true}},"required":["error"]},"ValidationError":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","properties":{"issues":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"path":{"type":"array","items":{"type":["string","integer"]}},"message":{"type":"string"}}}}}}},"description":"Body of a request rejected by the schema (zod issues). A few routes answer `{error:{code:\"VALIDATION_ERROR\"}}` instead."},"Brand":{"type":"object","properties":{"logo":{"type":"string","maxLength":2000},"primaryColor":{"type":"string","maxLength":32},"companyName":{"type":"string","maxLength":200}}},"WebVoiceCapability":{"type":"object","properties":{"enabled":{"type":"boolean"},"dailyMinutes":{"anyOf":[{"type":"integer","minimum":1,"maximum":10000},{"type":"null"}]},"monthlyMinutes":{"anyOf":[{"type":"integer","minimum":1,"maximum":300000},{"type":"null"}]},"recording":{"type":"string","enum":["always","never","until"],"description":"Without recording only the text transcript is kept, not the audio. 'until' needs recordingUntil."},"recordingUntil":{"type":"string","format":"date-time","description":"ISO 8601 with offset. Required with recording 'until' and only accepted with it."},"disclosureMode":{"type":"string","enum":["spoken","visual"],"description":"'spoken': the agent says it is an AI and that the call is recorded. 'visual': your page shows the notice before connecting and POST /grants/voice requires disclosureShown: true. In neither mode may the agent deny being an AI."}},"minProperties":1,"description":"Every field is optional; what is missing is left untouched. At least one field."},"Capabilities":{"type":"object","properties":{"webVoice":{"$ref":"#/components/schemas/WebVoiceCapability"},"telephony":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"],"additionalProperties":false,"description":"Only partners with telephony resale; others get 403 TELEPHONY_NOT_RESOLD, also with enabled false."}},"minProperties":1,"description":"webVoice, telephony or both."},"OrgCapabilities":{"type":"object","properties":{"webVoice":{"type":"object","properties":{"enabled":{"type":"boolean"},"dailyMinutes":{"anyOf":[{"type":"integer"},{"type":"null"}]},"monthlyMinutes":{"anyOf":[{"type":"integer"},{"type":"null"}]},"source":{"type":"string","enum":["partner","default"]},"recording":{"type":"string","enum":["always","never","until"]},"recordingUntil":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"disclosureMode":{"type":"string","enum":["spoken","visual"]}}},"telephony":{"type":"object","properties":{"enabled":{"type":"boolean"},"source":{"type":"string","enum":["partner","plan"]}}}}},"CreateOrg":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200,"description":"Your own id for this client. POST /orgs is idempotent by (you, externalId)."},"name":{"type":"string","minLength":1,"maxLength":200},"slug":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z0-9][a-z0-9-]*$","description":"Prefixed with your partner id on our side, so two partners can use the same slug."},"brand":{"$ref":"#/components/schemas/Brand"},"customDomain":{"type":"string","maxLength":253,"pattern":"^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?(\\.[a-z]{2,})+$","description":"A domain already used by another organization answers 409 DOMAIN_IN_USE."},"capabilities":{"$ref":"#/components/schemas/Capabilities"},"test":{"type":"boolean","description":"House partners only: the sub-account is a test account (out of metrics and automated emails). An integrator gets 403 TEST_ORG_NOT_ALLOWED."}},"required":["externalId","name","slug"],"description":"`isDemo` is not accepted."},"Tool":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z][a-z0-9_]*$","description":"snake_case. A builtin tool name is refused (400 BUILTIN_TOOL_NAME): declare builtins in builtinTools."},"description":{"type":"string","minLength":1,"maxLength":1000},"parameters":{"type":"object","properties":{},"additionalProperties":true,"description":"JSON Schema of the arguments."},"endpoint":{"type":"string","format":"uri","description":"Your webhook. Calls carry x-agenteuno-secret and the x-agenteuno-tool-signature / x-agenteuno-tool-timestamp pair (see tool-secret and tool-signing-secret)."},"preLlmEndpoint":{"type":"string","format":"uri"}},"required":["name","description","parameters","endpoint"]},"PerSubjectQuota":{"type":"object","properties":{"included":{"type":"integer","minimum":1,"maximum":10000},"margin":{"type":"integer","minimum":0,"maximum":100,"default":0},"scope":{"type":"string","pattern":"^[A-Za-z0-9:_-]{1,100}$","description":"Groups several of your sub-accounts in one per-person counter."}},"required":["included"]},"ConversationQuota":{"type":"object","properties":{"included":{"type":"integer","minimum":1,"maximum":10000,"description":"Conversations included per month. Required unless perSubject is sent."},"margin":{"type":"integer","minimum":0,"maximum":100,"default":0,"description":"Courtesy above `included` before stopping."},"timeZone":{"type":"string","minLength":1,"maxLength":64,"description":"IANA zone where the month starts. Default Europe/Madrid."},"messages":{"type":"object","propertyNames":{"enum":["es","en","pt","pl","ru"]},"additionalProperties":{"type":"string","minLength":1,"maxLength":600}},"perSubject":{"$ref":"#/components/schemas/PerSubjectQuota"}},"description":"Send either `included` or `perSubject`, not both. In the sandbox `included` is clamped to the sandbox cap, `margin` is forced to 0 and `perSubject` is refused (403 SANDBOX_LIMIT)."},"UpsertAgent":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"systemPrompt":{"type":"string","minLength":1,"maxLength":50000},"greeting":{"type":"string","maxLength":2000},"voiceName":{"type":"string","maxLength":64},"personaName":{"type":"string","maxLength":60,"description":"A person name: letters, spaces, apostrophe, dot and hyphen, up to four words. Empty string removes it."},"language":{"type":"string","maxLength":10,"default":"es"},"tools":{"type":"array","items":{"$ref":"#/components/schemas/Tool"},"maxItems":30},"builtinTools":{"type":"array","items":{"type":"string","maxLength":64},"maxItems":30,"description":"Names of builtin tools. An unknown name answers 400 UNKNOWN_BUILTIN_TOOL with the list of known ones."},"model":{"type":"string","maxLength":120,"description":"Only ids we have tested live; otherwise 400."},"allowedDomains":{"type":"array","items":{"type":"string","minLength":1,"maxLength":253},"maxItems":50,"description":"Domains that may open the widget. An empty list means unrestricted. Not sent: left as it was."},"requireEntitlement":{"type":"boolean","description":"The chat then demands an entitlement token signed by you, and the widget voice is switched off."},"retrieval":{"type":"object","properties":{"minSimilarity":{"type":"number","minimum":0.3,"maximum":0.9},"topK":{"type":"integer","minimum":1,"maximum":8},"citeBy":{"type":"string","enum":["number","title"]}}},"greetings":{"type":"object","propertyNames":{"pattern":"^[a-z]{2}$"},"additionalProperties":{"type":"string","minLength":1,"maxLength":1000}},"replyPolicy":{"type":"object","properties":{"languages":{"type":"array","items":{"type":"string","enum":["es","en","pt","pl","ru"]},"minItems":1,"maxItems":5},"noEmailRequest":{"type":"boolean"},"fallbackMessages":{"type":"object","propertyNames":{"enum":["es","en","pt","pl","ru"]},"additionalProperties":{"type":"string","minLength":1,"maxLength":1000}}},"required":["languages"]},"crisisPolicy":{"type":"object","properties":{"enabled":{"const":true},"notices":{"type":"object","propertyNames":{"pattern":"^[a-z]{2}$"},"additionalProperties":{"type":"string","minLength":1,"maxLength":400}}},"required":["enabled","notices"],"description":"Can only be switched on."},"conversationQuota":{"$ref":"#/components/schemas/ConversationQuota"},"fallbackMessage":{"type":"string","maxLength":1000},"temperature":{"type":"number","minimum":0,"maximum":1},"maxTokens":{"type":"integer","minimum":100,"maximum":4000},"widget":{"type":"object","properties":{"botName":{"type":"string","minLength":1,"maxLength":60},"color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"headerColor":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"homeGreeting":{"type":"string","maxLength":500,"description":"Empty string removes it."},"hidePoweredBy":{"type":"boolean"}}}},"required":["name","systemPrompt"],"description":"Upsert of the single principal agent of the sub-account. An agent cannot hide or deny being an AI: 422 AI_CONCEALMENT_NOT_ALLOWED."},"KnowledgeSync":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200,"default":"Knowledge base"},"documents":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200,"description":"Your stable id for the document. The sync is by key."},"title":{"type":"string","minLength":1,"maxLength":300},"content":{"type":"string","minLength":1,"maxLength":500000},"sourceUrl":{"type":"string","format":"uri","maxLength":1000}},"required":["key","title","content"]},"maxItems":1000}},"required":["documents"],"description":"The COMPLETE list of your documents: what is not listed is deleted. Idempotent."},"VoiceGrantRequest":{"type":"object","properties":{"agentId":{"type":"string","format":"uuid"},"maxSeconds":{"type":"integer","exclusiveMinimum":0,"description":"Clamped to 900 s; 120 s when not sent."},"visitorLabel":{"type":"string","maxLength":120},"disclosureShown":{"type":"boolean","description":"Required (true) when the sub-account has disclosureMode 'visual'; otherwise 422 disclosure_required."},"visitorIp":{"type":"string","maxLength":64,"description":"IP of the visitor as your backend saw it. The grant then only opens from that IP."},"visitorId":{"type":"string","minLength":1,"maxLength":128,"description":"Opaque stable visitor id (enables per-visitor limits)."},"visitorUserRef":{"type":"string","minLength":1,"maxLength":128,"description":"A user your backend verified, to resume a dropped call. Never a value taken raw from the browser."}},"required":["agentId"]},"ChatGrantRequest":{"type":"object","properties":{"agentId":{"type":"string","format":"uuid"},"visitorLabel":{"type":"string","maxLength":120}},"required":["agentId"]},"SessionRequest":{"type":"object","properties":{"role":{"type":"string","enum":["viewer","admin"]},"ttlSeconds":{"type":"integer","minimum":60,"maximum":86400,"default":900}},"required":["role"]},"OutboundCallRequest":{"type":"object","properties":{"to":{"type":"string","pattern":"^\\+[1-9]\\d{6,14}$","description":"E.164."},"agentId":{"type":"string","format":"uuid"},"brief":{"type":"object","properties":{"objective":{"type":"string","maxLength":500},"context":{"type":"string","maxLength":8000},"goal":{"type":"string","enum":["qualify_lead","book_appointment","follow_up","customer_success"]},"callMode":{"type":"string","enum":["ai_managed","supervised","transfer_after_greeting"],"description":"Only `ai_managed` (or no value) places an AI call. `supervised` needs a designated backup person, which a brief does not carry: book it as an assisted call with `callMode: \"supervised\"` and `backupUserId`. `transfer_after_greeting` is not available yet. Both answer 409 CALL_MODE_UNAVAILABLE with `reason`, before anything is written or dialled."},"script":{"type":"string","maxLength":8000},"greeting":{"type":"string","maxLength":1000},"talkingPoints":{"type":"array","items":{"type":"string","maxLength":300},"maxItems":20},"objectionHandlers":{"type":"string","maxLength":8000},"language":{"type":"string","maxLength":10},"voiceOverride":{"type":"string","enum":["Aoede","Puck","Charon","Kore","Fenrir"]},"voiceStyleInstruction":{"type":"string","maxLength":300},"personaMode":{"type":"string","enum":["agent","custom"]},"followCallerLanguage":{"type":"boolean"}},"additionalProperties":false},"externalRef":{"type":"string","minLength":1,"maxLength":120},"purpose":{"type":"string","enum":["service","marketing","commercial"]},"consent":{"type":"object","properties":{"shownText":{"type":"string","minLength":10,"maxLength":2000},"grantedAt":{"type":"string","format":"date-time"},"collectedVia":{"type":"string","enum":["web_form","phone_call","whatsapp","sms","email","chat","in_person","paper"],"description":"'import' and 'api' are not accepted from a partner."},"textVersion":{"type":"string","maxLength":120},"evidenceRef":{"type":"string","minLength":1,"maxLength":300},"collectedIp":{"type":"string","maxLength":100}},"required":["shownText","grantedAt","collectedVia","evidenceRef"],"additionalProperties":false},"dryRun":{"type":"boolean","description":"MANDATORY, no default. true answers what would happen without touching anything."}},"required":["to","brief","dryRun"],"additionalProperties":false},"PhoneNumberRequest":{"type":"object","properties":{"locality":{"type":"string","minLength":1,"maxLength":100},"friendlyName":{"type":"string","minLength":1,"maxLength":100},"reason":{"type":"string","minLength":10,"maxLength":500}},"required":["reason"],"additionalProperties":false},"EmbeddedSignupExchange":{"type":"object","properties":{"code":{"type":"string","minLength":10},"wabaId":{"type":"string","pattern":"^\\d+$"},"phoneNumberId":{"type":"string","pattern":"^\\d+$"},"coexistence":{"type":"boolean"},"enabled":{"type":"boolean"}},"required":["code","wabaId","phoneNumberId"],"additionalProperties":false},"MissedCall":{"type":"object","properties":{"mode":{"type":"string","enum":["off","message","callback"]},"delaySeconds":{"type":"integer","minimum":30,"maximum":1800,"default":1800},"earlyHangupSeconds":{"type":"integer","minimum":0,"maximum":60}},"required":["mode"],"additionalProperties":false},"VoiceReplies":{"type":"object","properties":{"mode":{"type":"string","enum":["text","mirror"]}},"required":["mode"],"additionalProperties":false},"AddAllowedDomains":{"type":"object","properties":{"domains":{"type":"array","items":{"type":"string","pattern":"^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z]{2,63}$"},"minItems":1,"maxItems":50,"description":"Bare hostnames. Appended, never removed."}},"required":["domains"],"additionalProperties":false},"TelegramConnect":{"type":"object","properties":{"botToken":{"type":"string","pattern":"^\\d{5,16}:[A-Za-z0-9_-]{30,80}$","description":"From BotFather. Required the first time."},"instructions":{"anyOf":[{"type":"string","maxLength":6000},{"type":"null"}]},"greeting":{"anyOf":[{"type":"string","minLength":1,"maxLength":1000},{"type":"null"}]},"greetings":{"anyOf":[{"type":"object","propertyNames":{"pattern":"^[a-z]{2}$"},"additionalProperties":{"type":"string","minLength":1,"maxLength":1000}},{"type":"null"}]},"fallbackMessages":{"anyOf":[{"type":"object","propertyNames":{"pattern":"^[a-z]{2}$"},"additionalProperties":{"type":"string","minLength":1,"maxLength":1000}},{"type":"null"}]}},"additionalProperties":false},"TelegramSend":{"type":"object","properties":{"telegramUserId":{"type":"string","pattern":"^\\d{1,20}$"},"text":{"type":"string","minLength":1,"maxLength":3500},"historyText":{"type":"string","minLength":1,"maxLength":3500}},"required":["telegramUserId","text"],"additionalProperties":false},"WhatsAppUpdate":{"type":"object","properties":{"enabled":{"type":"boolean"},"instructions":{"anyOf":[{"type":"string","maxLength":6000},{"type":"null"}]},"fallbackMessages":{"anyOf":[{"type":"object","propertyNames":{"pattern":"^[a-z]{2}$"},"additionalProperties":{"type":"string","minLength":1,"maxLength":1000}},{"type":"null"}]},"allowedSenders":{"anyOf":[{"type":"array","items":{"type":"string","pattern":"^\\+?\\d{8,15}$"},"maxItems":20},{"type":"null"}]}},"additionalProperties":false},"Communication":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["call","message"]},"medium":{"type":"string","enum":["phone","whatsapp","web","telegram","instagram","facebook","sms","email"]},"channelType":{"type":"string"},"status":{"type":"string"},"displayName":{"type":"string"},"contactPhone":{"anyOf":[{"type":"string"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"startedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"endedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"durationSeconds":{"anyOf":[{"type":"integer"},{"type":"null"}]},"messageCount":{"type":"integer"},"language":{"anyOf":[{"type":"string"},{"type":"null"}]},"hasRecording":{"type":"boolean","description":"False when `recordingDeclined`."},"recordingDeclined":{"type":"boolean","description":"The person asked not to be recorded: no audio and no transcript are kept (`turns` is empty, the recording endpoint answers 410 RECORDING_DECLINED). The summary and the lead fields are still there."}}},"CommunicationDetail":{"allOf":[{"$ref":"#/components/schemas/Communication"},{"type":"object","properties":{"turns":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["caller","agent"]},"content":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"offsetMs":{"anyOf":[{"type":"integer"},{"type":"null"}]},"approximate":{"type":"boolean"}}}}}}]},"BotActive":{"type":"object","properties":{"active":{"type":"boolean"}},"required":["active"],"additionalProperties":false},"AgentIdBody":{"type":"object","properties":{"agentId":{"type":"string","format":"uuid"}},"required":["agentId"]},"KnowledgeImport":{"type":"object","properties":{"fromAgentId":{"type":"string","format":"uuid"},"dryRun":{"type":"boolean"}},"required":["fromAgentId"]},"ParentAgentStatus":{"type":"object","properties":{"status":{"type":"string","enum":["paused","active"]}},"required":["status"]},"CrisisPolicyApply":{"type":"object","properties":{"crisisPolicy":{"type":"object","properties":{"enabled":{"const":true},"notices":{"type":"object","propertyNames":{"pattern":"^[a-z]{2}$"},"additionalProperties":{"type":"string","minLength":1,"maxLength":400}}},"required":["enabled","notices"]}},"required":["crisisPolicy"],"additionalProperties":false},"CreateKey":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80}},"additionalProperties":false},"EventUrl":{"type":"object","properties":{"url":{"type":"string","minLength":1,"maxLength":2048,"description":"https, port 443, no credentials, public address. Verified with a signed challenge."}},"required":["url"],"additionalProperties":false},"Account":{"type":"object","properties":{"partner":{"type":"string"},"kind":{"type":"string","enum":["integrator","registry","house"]},"tier":{"type":"string","enum":["sandbox","production"]},"status":{"type":"string"},"sandboxExpiresAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"limits":{"anyOf":[{"type":"object","properties":{"subaccounts":{"type":"integer"},"conversationsPerSubaccountMonth":{"type":"integer"},"voiceMinutesPerSubaccountDay":{"type":"integer"},"voiceMinutesPerSubaccountMonth":{"type":"integer"},"durationDays":{"type":"integer"},"activeApiKeys":{"type":"integer"}}},{"type":"null"}]},"parentOrganizationId":{"type":"string","format":"uuid"},"eventUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"signingSecretSet":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"tariff":{"anyOf":[{"type":"object","properties":{"version":{"type":"string","description":"Send it back as acceptedTariffVersion when going to production."},"currency":{"type":"string"}},"additionalProperties":true,"description":"The integrator tariff in force: platform fee, sub-account tiers, voice minute and conversation tiers, add-ons. Net of VAT."},{"type":"null"}]}}},"GoLive":{"type":"object","properties":{"billingCycle":{"type":"string","enum":["month","year"],"description":"Platform fee: 178.80 EUR month to month, or 1,788 EUR a year (149 a month). Usage is always billed monthly."},"acceptedTariffVersion":{"type":"string","description":"The `tariff.version` of GET /account you accept."},"acceptTariff":{"type":"boolean","enum":[true],"description":"Your explicit yes to the tariff. Nothing is charged without it."},"locale":{"type":"string","enum":["es","en","pt-br"]}},"required":["billingCycle","acceptedTariffVersion","acceptTariff"],"additionalProperties":false},"ApiKeyView":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"prefix":{"type":"string","description":"Start of the key, enough to recognise it. The key itself is never shown again."},"createdAt":{"type":"string","format":"date-time"},"lastUsedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"revokedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"current":{"type":"boolean","description":"Only in the listing: this is the key that made the request."}}},"Subaccount":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"externalId":{"type":"string"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}},"UsageReport":{"type":"object","properties":{"partner":{"type":"string"},"period":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"},"subaccounts":{"type":"array","items":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"externalId":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"},"conversations":{"type":"integer"},"webChatConversations":{"type":"integer"},"voiceConversations":{"type":"integer"},"voiceSeconds":{"type":"integer"},"voiceMinutes":{"type":"number"},"whatsappConversations":{"type":"integer"},"quota":{"anyOf":[{"type":"object","properties":{"included":{"type":"integer"},"hard":{"type":"integer"},"used":{"type":"integer"},"refused":{"type":"integer"}}},{"type":"null"}]}}}},"totals":{"type":"object","properties":{"subaccounts":{"type":"integer"},"activeSubaccounts":{"type":"integer"},"conversations":{"type":"integer"},"voiceMinutes":{"type":"number"},"whatsappConversations":{"type":"integer"}}},"tariff":{"anyOf":[{"type":"object","properties":{"applies":{"type":"boolean","description":"True in production. In the sandbox the statement is only an estimate and nothing is charged."},"statement":{"type":"object","properties":{"total":{"type":"number"}},"additionalProperties":true,"description":"The month with the integrator tariff: platform fee, active sub-accounts, voice minutes and chat or WhatsApp conversations, net of VAT. Sandbox test sub-accounts are not billed in production."}}},{"type":"null"}]},"plan":{"anyOf":[{"type":"object","properties":{},"additionalProperties":true},{"type":"null"}]},"amounts":{"type":"object","properties":{"total":{"anyOf":[{"type":"number"},{"type":"null"}]},"billable":{"type":"boolean"}},"additionalProperties":true,"description":"billable stays false until a rate is agreed."}}},"QuotaUsageRow":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"externalId":{"type":"string"},"period":{"type":"string"},"timeZone":{"type":"string"},"resetsAt":{"type":"string","format":"date-time"},"included":{"type":"integer"},"margin":{"type":"integer"},"hard":{"type":"integer"},"warn":{"type":"integer"},"used":{"type":"integer"},"refused":{"type":"integer"},"daily":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"count":{"type":"integer"}}}},"perSubject":{"type":"object","properties":{},"additionalProperties":true}}},"ConversationResult":{"type":"object","properties":{"conversationId":{"type":"string","format":"uuid"},"status":{"type":"string"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"sentiment":{"anyOf":[{"type":"string"},{"type":"null"}]},"interestScore":{"anyOf":[{"type":"number"},{"type":"null"}]},"qualityScore":{"anyOf":[{"type":"number"},{"type":"null"}]},"capturedData":{"anyOf":[{"type":"object","properties":{},"additionalProperties":true},{"type":"null"}]},"painPoints":{"type":"array","items":{"type":"string"}},"objections":{"type":"array","items":{"type":"string"}},"recommendedAction":{"anyOf":[{"type":"string"},{"type":"null"}]},"durationSeconds":{"anyOf":[{"type":"integer"},{"type":"null"}]},"startedAt":{"type":"string","format":"date-time"},"analysisReady":{"type":"boolean","description":"false while the analysis pipeline is still running (a few seconds)."}}},"QuotaEvent":{"type":"object","properties":{"event":{"type":"string","const":"quota.threshold"},"organizationId":{"type":"string","format":"uuid"},"externalId":{"type":"string"},"period":{"type":"string"},"kind":{"type":"string","enum":["warn","included","stopped","refused","subject_stopped"]},"used":{"type":"integer"},"included":{"type":"integer"},"hard":{"type":"integer"},"perSubject":{"type":"object","properties":{"included":{"type":"integer"},"hard":{"type":"integer"}},"description":"Only with a per-person quota; then `used` is the person's."}},"required":["event","organizationId","externalId","period","kind","used","included","hard"]},"UrlVerificationEvent":{"type":"object","properties":{"event":{"type":"string","const":"url_verification"},"challenge":{"type":"string"}},"required":["event","challenge"]},"HumanTransferPolicy":{"type":"object","properties":{"enabled":{"type":"boolean","description":"true needs at least one target."},"mode":{"type":"string","enum":["attended","direct"],"description":"'direct': blind transfer to the first target (today's behavior). 'attended': hold, consult call with a briefing and the employee accepts or declines."},"targets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"description":"Unique within the policy."},"name":{"type":"string","minLength":1,"maxLength":60},"phone":{"type":"string","pattern":"^\\+[1-9]\\d{7,14}$","description":"E.164. GET returns it masked; sending the masked value back for an existing id keeps the stored number."},"priority":{"type":"integer","minimum":0,"maximum":99,"description":"Lower rings first. Only the first target is dialed in this version."}},"required":["id","name","phone","priority"]},"maxItems":5,"default":[]},"timezone":{"type":"string","default":"Europe/Madrid","description":"IANA zone. The schedule is wall clock time of this zone."},"weekly":{"type":"object","properties":{"mon":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"to":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["from","to"]},"maxItems":6,"default":[]},"tue":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"to":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["from","to"]},"maxItems":6,"default":[]},"wed":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"to":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["from","to"]},"maxItems":6,"default":[]},"thu":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"to":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["from","to"]},"maxItems":6,"default":[]},"fri":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"to":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["from","to"]},"maxItems":6,"default":[]},"sat":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"to":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["from","to"]},"maxItems":6,"default":[]},"sun":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"to":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["from","to"]},"maxItems":6,"default":[]}},"description":"Slots per day, inclusive to the minute, from < to, no overlaps, never across midnight (write 22:00-23:59)."},"excludedRanges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","format":"date","description":"YYYY-MM-DD, local, inclusive."},"to":{"type":"string","format":"date","description":"YYYY-MM-DD, local, inclusive, not before from."},"label":{"type":"string","minLength":1,"maxLength":80}},"required":["from","to","label"]},"maxItems":60,"default":[]},"skipWhenCalendarBusy":{"type":"boolean","default":false,"description":"Ignored when no calendar is connected or it cannot be read."},"ringSeconds":{"type":"integer","minimum":10,"maximum":45,"default":25},"attempts":{"type":"integer","minimum":1,"maximum":3,"default":2},"retryGapSeconds":{"type":"integer","minimum":5,"maximum":60,"default":20},"maxWaitSeconds":{"type":"integer","minimum":30,"maximum":180,"default":90},"checkInEverySeconds":{"type":"integer","minimum":15,"maximum":60,"default":30},"onUnavailable":{"type":"string","const":"take_message","default":"take_message"},"notifyStaff":{"type":"object","properties":{"whatsapp":{"type":"boolean"},"email":{"type":"boolean"}},"required":["whatsapp","email"]}},"required":["enabled","mode","weekly"]},"HumanTransferPolicyView":{"type":"object","properties":{"policy":{"$ref":"#/components/schemas/HumanTransferPolicy"},"source":{"type":"string","enum":["stored","legacy"],"description":"'legacy': nothing saved yet; derived from the agent's transfer phone and the business hours (always mode direct)."},"calendar":{"type":"object","properties":{"connected":{"type":"boolean"},"provider":{"anyOf":[{"type":"string","enum":["google"]},{"type":"null"}]}},"required":["connected","provider"],"description":"connectUrl is not returned in this version: connect the calendar from the dashboard."}},"required":["policy","source","calendar"]},"HumanTransferValidationError":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","const":"VALIDATION_ERROR"},"message":{"type":"string"},"fields":{"type":"object","properties":{},"additionalProperties":{"type":"array","items":{"type":"string"}},"description":"Dotted path (targets.0.phone, weekly.mon.1.to) to its messages."}},"required":["code","message","fields"]}},"required":["error"]}}}}