{"openapi":"3.1.0","info":{"title":"SuperCognit API","version":"1.5.0","description":"Run SuperCognit from your own code: create agents and MCP servers, work the inbox, pull leads and analytics, and receive events by webhook.\n\n## Authentication\nSend a workspace API key in the `X-Api-Key` header.\n\n- **Scopes**: a key that declares scopes needs the `write` scope for any non-GET request (`POST /v1/verify-user` excepted — it changes nothing).\n- **Product-scoped keys** may only act on their own product and cannot manage workspace-level resources (members, tools, knowledge bases, webhooks, wallet).\n\n## Rate limits\n120 requests per minute per key. Over the limit the API answers `429` with `{ \"error\": \"rate_limited\" }`.\n\n## Errors\nErrors are JSON with a machine-readable `error` code and sometimes a human `detail`:\n\n| Status | `error` | Meaning |\n| --- | --- | --- |\n| 401 | `invalid_api_key` | Missing or unknown key |\n| 403 | `insufficient_scope` | Write request with a read-only key |\n| 403 | `wrong_product_scope` | Product-scoped key used on another product |\n| 403 | `workspace_key_required` | Workspace-level endpoint called with a product-scoped key |\n| 404 | `not_found` | No such resource in your workspace |\n| 429 | `rate_limited` | Too many requests; retry after a short wait |"},"servers":[{"url":"/"}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","in":"header","name":"X-Api-Key"}}},"security":[{"ApiKey":[]}],"tags":[{"name":"Account","description":"The calling key, the workspace's prepaid usage wallet and its monthly credit usage."},{"name":"Members & invites","description":"People in the workspace and pending invitations. Workspace keys only."},{"name":"Partners","description":"Material for SuperCognit partners: the outreach email templates a partner sends a prospect after building them a demo agent, in every dashboard language."},{"name":"Transfers","description":"Move or duplicate agents, MCP servers, tools and knowledge bases between workspaces. Same-owner targets transfer at once; anyone else gets a request to accept or decline."},{"name":"Agents & MCP servers","description":"A **product** is a chat agent (`kind: chat_agent`) or an MCP server (`kind: mcp_server`). Both live under `/v1/products`; `DELETE /v1/agents/{id}` removes either kind.\n\n**Website imports** prototype an agent from a URL: `POST /v1/imports` queues a crawl, then poll `GET /v1/imports/{id}` until `status` is `succeeded` (the draft agent's `productId` and `knowledgeBaseId` are set) or `failed`."},{"name":"Agent videos","description":"Videos the agent may show inline via the platform `show_video` tool. YouTube and Vimeo links only; max 25 per agent. The URL is validated and canonicalized, and the agent's model can only pick a registered video by id — it never sees or emits a URL of its own."},{"name":"Guardrails","description":"A product's creator guardrail rules — the same object the dashboard's Guardrails tab edits, for chat agents and MCP servers alike. Platform safety (moderation, prompt-injection screening, card/SSN redaction) always applies on top and is not configurable. The **country rule** (`countryMode` + `countries`) gates the agent's web surfaces only: the chat page, the embedded widget and the embed loader. WhatsApp, Telegram and this API are never affected. Visitors are located by the edge network; a blocked visitor is refused before any usage is metered, and one whose country cannot be determined is always served."},{"name":"Feedback","description":"What visitors said about replies. Under every AI reply on the chat page and the widget a visitor can press 👍 or 👎; the product's **feedback config** decides whether a short form then opens and whether it asks for a category and/or a comment (off, optional or required, per polarity). The vote is saved either way; required fields are enforced when the form is submitted. Feedback is written only by the chat surfaces — this API reads it and edits the config."},{"name":"Tools","description":"The workspace tool library. Tools belong to the workspace; MCP servers publish a subset and chat agents attach them."},{"name":"API connections","description":"External APIs that http tools call through: base URL, optional login step and write-only secrets."},{"name":"Knowledge bases","description":"Document and website collections agents search for answers. Read-only in v1."},{"name":"Conversations","description":"Conversations across your agents: transcripts, attachments, the human-agent workflow (status, assignee, team, tags, notes) and team replies."},{"name":"Inbox setup","description":"What the inbox works with: conversation tags, saved replies and teams (the queues a hand-over lands in)."},{"name":"Contacts","description":"People who signed in to your agents, one per email across the workspace. Archiving hides a contact from the list; sign-in, conversations and the Inbox are untouched. Workspace keys only."},{"name":"Leads","description":"Contact details your agents captured, with or without a CRM connected."},{"name":"Analytics","description":"Traffic, conversations, leads and tool usage, read from rollups refreshed every 5 minutes. Requires a plan with analytics."},{"name":"Webhooks","description":"Register an endpoint with `POST /v1/webhooks` and you will receive JSON POSTs for the subscribed events. An empty `events` array subscribes to **all** events, including ones added later.\n\nEvery request body is the same envelope: `{ \"id\": \"evt_…\", \"event\": \"lead.captured\", \"version\": 1, \"createdAt\": \"…\", \"workspaceId\": \"…\", \"data\": { … } }`.\n\n**Deduplicate on `id`.** Delivery is at-least-once: the same `id` is re-sent on every retry, so a receiver that does not dedupe will act on the same event more than once. `version` changes only on a breaking change to `data` — new fields can appear at any time and receivers must ignore what they do not recognise.\n\n### Events\n\n| Event | Fires when |\n| --- | --- |\n| `conversation.created` | A visitor started a new conversation with an agent. |\n| `message.created` | A message was added to a conversation (either side). |\n| `message.completed` | An agent finished generating its reply. |\n| `lead.captured` | An agent captured a qualified lead, with the CRM result if one is connected. |\n| `lead.delivered` | A captured lead reached the connected CRM. Fires separately from `lead.captured` because delivery can be minutes later, after a retry — and workspaces with no CRM never see this one. |\n| `lead.failed` | We gave up delivering a lead to the CRM. The lead itself is NOT lost — it is still readable in the dashboard and over the API, and can be re-sent. |\n| `payment.requested` | An agent created a payment link. The money has NOT moved yet. |\n| `payment.completed` | A payment was confirmed collected. This is the only event that means money moved. |\n| `payment.refunded` | A completed payment was refunded or disputed. |\n| `payment.expired` | A payment link aged out without being paid. |\n| `subscription.created` | Someone subscribed to one of your agents or MCP servers. |\n| `subscription.canceled` | A subscription was canceled or expired. |\n| `channel.connected` | A Telegram bot or WhatsApp number was connected to an agent. |\n| `channel.disconnected` | A channel stopped working or was disconnected — the agent is off that surface. |\n| `integration.connected` | A CRM was connected to the workspace. |\n| `integration.disconnected` | A CRM connection was removed or went bad — new leads are no longer reaching it. |\n| `knowledge.source.ready` | A document or URL finished ingesting and is now answerable. |\n| `knowledge.source.failed` | A knowledge source could not be ingested. |\n| `product.published` | An agent or MCP server went live. |\n| `product.unpublished` | An agent or MCP server was taken offline. |\n| `browser_task.completed` | An async browser task finished. Check `status` — `uncertain` means the on-site action MAY have completed. |\n| `conversation.handoff_requested` | A person on the team is needed: the visitor pressed \"Talk to a person\", the AI handed over, or people-first mode queued a new conversation. The AI stays quiet until someone replies or the agent's auto-return window passes. |\n| `conversation.assigned` | A conversation was assigned to a workspace member (or unassigned: `assigneeUserId` null). `team` / `teamId` name the team (queue) it is in, or null. |\n| `conversation.resolved` | A conversation was marked resolved. A new visitor message reopens it (no event). |\n| `conversation.team_replied` | A person on the team (or an API key) wrote to the visitor from the inbox. Not sent for AI replies — those are `message.completed`. |\n\n**Delivery + retries**: deliveries are attempted up to 5 times with exponential backoff (1, 2, 4, 8 minutes). Any 2xx response marks success; anything else (including redirects — they are never followed) counts as a failure. After 20 consecutive failures the endpoint is automatically disabled (re-enable it via `PATCH /v1/webhooks/{id}`).\n\n**Signature verification**: every request carries `X-Supercognit-Event` (event name), `X-Supercognit-Delivery` (delivery id) and `X-Supercognit-Signature` (`sha256=<hex>`), the HMAC-SHA256 of the RAW request body keyed with the endpoint secret returned once at creation. Verify against the exact bytes received — do not re-serialize the JSON. Node example:\n\n```js\nimport { createHmac, timingSafeEqual } from 'node:crypto';\nconst expected = 'sha256=' + createHmac('sha256', WEBHOOK_SECRET).update(rawBody).digest('hex');\nconst valid = timingSafeEqual(Buffer.from(expected), Buffer.from(req.headers['x-supercognit-signature']));\n```\n\n**Webhooks need a plan with API access** — the same entitlement as API keys. On plans without it, `POST /v1/webhooks` says so rather than failing obscurely.\n\n### Event payloads\n\nThe `data` object carried by each event. Fields can be ADDED at any time without a `version` bump, so ignore anything you do not recognise.\n\n#### `conversation.created`\n\nA visitor started a new conversation with an agent.\n\n```json\n{\n  \"sessionId\": \"…\",\n  \"productId\": \"…\",\n  \"productSlug\": \"acme-support\",\n  \"endUserId\": null,\n  \"guest\": true,\n  \"createdAt\": \"…\"\n}\n```\n\n#### `message.created`\n\nA message was added to a conversation (either side).\n\n```json\n{\n  \"sessionId\": \"…\",\n  \"messageId\": \"…\",\n  \"role\": \"user\",\n  \"content\": \"Do you deliver to Porto?\",\n  \"createdAt\": \"…\"\n}\n```\n\n#### `message.completed`\n\nAn agent finished generating its reply.\n\n```json\n{\n  \"sessionId\": \"…\",\n  \"messageId\": \"…\",\n  \"role\": \"assistant\",\n  \"content\": \"…\",\n  \"model\": \"claude-sonnet-4-6\",\n  \"promptTokens\": 1204,\n  \"completionTokens\": 88,\n  \"createdAt\": \"…\"\n}\n```\n\n#### `lead.captured`\n\nAn agent captured a qualified lead, with the CRM result if one is connected.\n\n```json\n{\n  \"leadId\": \"…\",\n  \"productId\": \"…\",\n  \"sessionId\": \"…\",\n  \"agent\": \"Showroom assistant\",\n  \"contact\": {\n    \"name\": \"Ana Silva\",\n    \"email\": \"ana@example.com\",\n    \"phone\": null\n  },\n  \"fields\": {\n    \"budget\": \"20k\"\n  },\n  \"consent\": true,\n  \"sourceUrl\": \"https://acme.com/pricing\",\n  \"status\": \"pending\",\n  \"crm\": {\n    \"provider\": \"pipedrive\",\n    \"leadId\": \"…\",\n    \"url\": \"…\"\n  }\n}\n```\n\n#### `lead.delivered`\n\nA captured lead reached the connected CRM. Fires separately from `lead.captured` because delivery can be minutes later, after a retry — and workspaces with no CRM never see this one.\n\n```json\n{\n  \"leadId\": \"…\",\n  \"productId\": \"…\",\n  \"sessionId\": \"…\",\n  \"agent\": \"Showroom assistant\",\n  \"contact\": {\n    \"name\": \"Ana Silva\",\n    \"email\": \"ana@example.com\",\n    \"phone\": null\n  },\n  \"crm\": {\n    \"provider\": \"hubspot\",\n    \"leadId\": \"…\",\n    \"url\": \"…\",\n    \"matchedExistingContact\": false\n  }\n}\n```\n\n#### `lead.failed`\n\nWe gave up delivering a lead to the CRM. The lead itself is NOT lost — it is still readable in the dashboard and over the API, and can be re-sent.\n\n```json\n{\n  \"leadId\": \"…\",\n  \"productId\": \"…\",\n  \"sessionId\": \"…\",\n  \"agent\": \"Showroom assistant\",\n  \"contact\": {\n    \"name\": \"Ana Silva\",\n    \"email\": \"ana@example.com\",\n    \"phone\": null\n  },\n  \"fields\": {\n    \"budget\": \"20k\"\n  },\n  \"provider\": \"hubspot\",\n  \"attempts\": 6,\n  \"error\": \"401 Unauthorized\"\n}\n```\n\n#### `payment.requested`\n\nAn agent created a payment link. The money has NOT moved yet.\n\n```json\n{\n  \"paymentId\": \"…\",\n  \"productId\": \"…\",\n  \"sessionId\": \"…\",\n  \"amountCents\": 4900,\n  \"currency\": \"eur\",\n  \"description\": \"Deposit\"\n}\n```\n\n#### `payment.completed`\n\nA payment was confirmed collected. This is the only event that means money moved.\n\n```json\n{\n  \"paymentId\": \"…\",\n  \"productId\": \"…\",\n  \"amountCents\": 4900,\n  \"currency\": \"eur\"\n}\n```\n\n#### `payment.refunded`\n\nA completed payment was refunded or disputed.\n\n```json\n{\n  \"paymentId\": \"…\",\n  \"productId\": \"…\"\n}\n```\n\n#### `payment.expired`\n\nA payment link aged out without being paid.\n\n```json\n{\n  \"paymentId\": \"…\",\n  \"productId\": \"…\",\n  \"reason\": \"unpaid\"\n}\n```\n\n#### `subscription.created`\n\nSomeone subscribed to one of your agents or MCP servers.\n\n```json\n{\n  \"productId\": \"…\",\n  \"endUserId\": \"…\",\n  \"status\": \"active\",\n  \"mode\": \"live\"\n}\n```\n\n#### `subscription.canceled`\n\nA subscription was canceled or expired.\n\n```json\n{\n  \"productId\": \"…\",\n  \"endUserId\": \"…\",\n  \"status\": \"canceled\",\n  \"mode\": \"live\"\n}\n```\n\n#### `channel.connected`\n\nA Telegram bot or WhatsApp number was connected to an agent.\n\n```json\n{\n  \"channelId\": \"…\",\n  \"productId\": \"…\",\n  \"type\": \"whatsapp\",\n  \"handle\": \"+351912000000\"\n}\n```\n\n#### `channel.disconnected`\n\nA channel stopped working or was disconnected — the agent is off that surface.\n\n```json\n{\n  \"channelId\": \"…\",\n  \"productId\": \"…\",\n  \"type\": \"whatsapp\",\n  \"reason\": \"disconnected\"\n}\n```\n\n#### `integration.connected`\n\nA CRM was connected to the workspace.\n\n```json\n{\n  \"integrationId\": \"…\",\n  \"provider\": \"hubspot\",\n  \"accountName\": \"acme.com\"\n}\n```\n\n#### `integration.disconnected`\n\nA CRM connection was removed or went bad — new leads are no longer reaching it.\n\n```json\n{\n  \"provider\": \"hubspot\",\n  \"reason\": \"error\",\n  \"error\": \"…\"\n}\n```\n\n#### `knowledge.source.ready`\n\nA document or URL finished ingesting and is now answerable.\n\n```json\n{\n  \"sourceId\": \"…\",\n  \"knowledgeBaseId\": \"…\",\n  \"title\": \"Price list 2026\",\n  \"type\": \"document\",\n  \"status\": \"ready\"\n}\n```\n\n#### `knowledge.source.failed`\n\nA knowledge source could not be ingested.\n\n```json\n{\n  \"sourceId\": \"…\",\n  \"knowledgeBaseId\": \"…\",\n  \"title\": \"…\",\n  \"type\": \"url\",\n  \"status\": \"error\"\n}\n```\n\n#### `product.published`\n\nAn agent or MCP server went live.\n\n```json\n{\n  \"productId\": \"…\",\n  \"status\": \"published\"\n}\n```\n\n#### `product.unpublished`\n\nAn agent or MCP server was taken offline.\n\n```json\n{\n  \"productId\": \"…\",\n  \"status\": \"unpublished\"\n}\n```\n\n#### `browser_task.completed`\n\nAn async browser task finished. Check `status` — `uncertain` means the on-site action MAY have completed.\n\n```json\n{\n  \"taskId\": \"…\",\n  \"productId\": \"…\",\n  \"status\": \"uncertain\",\n  \"durationMs\": 84120\n}\n```\n\n#### `conversation.handoff_requested`\n\nA person on the team is needed: the visitor pressed \"Talk to a person\", the AI handed over, or people-first mode queued a new conversation. The AI stays quiet until someone replies or the agent's auto-return window passes.\n\n```json\n{\n  \"sessionId\": \"…\",\n  \"productId\": \"…\",\n  \"source\": \"visitor\",\n  \"offline\": false,\n  \"assigneeUserId\": null,\n  \"teamId\": \"…\",\n  \"team\": \"Sales\"\n}\n```\n\n#### `conversation.assigned`\n\nA conversation was assigned to a workspace member (or unassigned: `assigneeUserId` null). `team` / `teamId` name the team (queue) it is in, or null.\n\n```json\n{\n  \"sessionId\": \"…\",\n  \"productId\": \"…\",\n  \"assigneeUserId\": \"…\",\n  \"actor\": \"member\",\n  \"teamId\": \"…\",\n  \"team\": \"Sales\"\n}\n```\n\n#### `conversation.resolved`\n\nA conversation was marked resolved. A new visitor message reopens it (no event).\n\n```json\n{\n  \"sessionId\": \"…\",\n  \"productId\": \"…\",\n  \"actor\": \"member\"\n}\n```\n\n#### `conversation.team_replied`\n\nA person on the team (or an API key) wrote to the visitor from the inbox. Not sent for AI replies — those are `message.completed`.\n\n```json\n{\n  \"sessionId\": \"…\",\n  \"productId\": \"…\",\n  \"messageId\": \"…\",\n  \"deliveredVia\": \"whatsapp\",\n  \"content\": \"Hi, Ana here…\"\n}\n```"},{"name":"Verification & audit","description":"Check who an end user is from your own backend, and audit the identity codes and confirm-first actions your agents ran."}],"x-tagGroups":[{"name":"Workspace","tags":["Account","Members & invites","Transfers","Partners"]},{"name":"Build","tags":["Agents & MCP servers","Agent videos","Guardrails","Tools","API connections","Knowledge bases"]},{"name":"Operate","tags":["Conversations","Inbox setup","Contacts","Leads"]},{"name":"Measure","tags":["Analytics","Feedback"]},{"name":"Integrate","tags":["Webhooks","Verification & audit"]}],"paths":{"/v1/me":{"get":{"summary":"Get the calling API client","description":"The client and workspace the `X-Api-Key` belongs to. Handy as a connectivity check.","responses":{"200":{"description":"The authenticated client + workspace ids","content":{"application/json":{"schema":{"type":"object","properties":{"clientId":{"type":"string"},"workspaceId":{"type":"string"}}}}}}},"tags":["Account"]}},"/v1/wallet":{"get":{"summary":"Get the usage wallet","description":"The workspace's prepaid usage-credit balance and its 10 most recent ledger entries. Builder-pays product usage draws the balance down (aggregated every few minutes); at $0 those products pause until a top-up. All amounts are micro-USD (1e-6 USD). Workspace keys only — product-scoped keys are rejected.","responses":{"200":{"description":"Balance + recent ledger entries (newest first)","content":{"application/json":{"schema":{"type":"object","properties":{"balanceMicros":{"type":"integer","description":"Current balance in micro-USD (may be negative after a refund)"},"lowBalance":{"type":"boolean","description":"True below the $2 warning threshold"},"recent":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["topup","usage","adjustment","refund"]},"amountMicros":{"type":"integer","description":"Signed micro-USD: positive credits, negative debits"},"balanceAfterMicros":{"type":"integer","description":"Balance after this entry, in micro-USD"},"createdAt":{"type":"string","format":"date-time"}}}}}}}}},"403":{"description":"Product-scoped key (`workspace_key_required`), or a partner's client workspace whose key was not minted by the partner's staff (`billing_managed_by_partner`)"}},"tags":["Account"]}},"/v1/invites":{"get":{"summary":"List invites","description":"Pending and revoked invites to the workspace (accepted ones are not listed). Each carries its shareable link: whoever opens it joins with that role, signed in or after creating an account. Workspace keys only.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["admin","member","agent"]},"state":{"type":"string","enum":["pending","expired","revoked"],"description":"expired: still open but the link is older than a week; a resend renews it"},"createdAt":{"type":"string","format":"date-time","description":"When the invite was first sent"},"lastSentAt":{"type":"string","format":"date-time","description":"When the email last went out (creation or a resend)"},"revokedAt":{"type":"string","format":"date-time","nullable":true},"url":{"type":"string","format":"uri","description":"The shareable invite link"}}}}}}},"403":{"description":"Product-scoped key, or the key's owner is not a workspace owner or admin"}},"tags":["Members & invites"]},"post":{"summary":"Create an invite","description":"An existing SuperCognit user is added immediately (no invite row); anyone else gets an email with the invite link, which the response also returns so you can share it directly. Counts against the plan's seats: 409 when they are all in use. Workspace keys only.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["admin","member","agent"],"default":"member"}}}}}},"responses":{"201":{"description":"Invited or added","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"invited":{"type":"boolean","description":"true = invite sent; false = existing user added as a member"},"inviteId":{"type":"string","format":"uuid","nullable":true},"url":{"type":"string","format":"uri","nullable":true,"description":"The shareable invite link (null when added directly)"}}}}}},"400":{"description":"Missing email or unknown role"},"403":{"description":"Product-scoped key"},"409":{"description":"Rejected (seats in use, role not invitable) — `detail` says why"}},"tags":["Members & invites"]}},"/v1/invites/{id}/resend":{"post":{"summary":"Resend an invite","description":"Sends the pending invite's email again with the same link. 429 when it was sent less than a minute ago (`retryInMs`). Workspace keys only.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Sent","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"lastSentAt":{"type":"string","format":"date-time"}}}}}},"403":{"description":"Product-scoped key"},"404":{"description":"No pending invite with that id"},"429":{"description":"Cooldown","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"cooldown"},"retryInMs":{"type":"integer"}}}}}}},"tags":["Members & invites"]}},"/v1/invites/{id}":{"delete":{"summary":"Revoke an invite","description":"Withdraws a pending invite: its link stops working. The row stays listed as revoked with the date; POST /v1/invites with the same email issues a fresh one. Workspace keys only.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Revoked"},"403":{"description":"Product-scoped key"},"404":{"description":"No pending invite with that id"}},"tags":["Members & invites"]}},"/v1/usage/credits":{"get":{"summary":"Get monthly credit usage","description":"Replies and actions counted from the usage ledger for one UTC month, against the workspace's monthly credit allowance. One credit per agent reply, one per action the agent takes (system read or write, email, connector, browser task, web search) and one per API or MCP call, whatever the length or model. Knowledge-base lookups, creators' preview tests and the background summariser never count. Overage is expressed in blocks of 1,000 credits. Workspace keys only.","parameters":[{"name":"month","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"description":"UTC month, YYYY-MM (default: current month)"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"workspaceId":{"type":"string","format":"uuid"},"month":{"type":"string","example":"2026-09"},"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"},"replies":{"type":"integer"},"actions":{"type":"integer"},"credits":{"type":"integer","description":"replies + actions"},"allowance":{"type":"integer","nullable":true,"description":"Monthly allowance on the workspace; null when none is set"},"remaining":{"type":"integer","nullable":true},"overage":{"type":"integer","nullable":true,"description":"Credits above the allowance"},"overageBlocks":{"type":"integer","nullable":true,"description":"ceil(overage / 1000)"}}}}}},"400":{"description":"Malformed month"},"403":{"description":"Workspace-scoped key required (`workspace_key_required`), or a partner's client workspace whose key was not minted by the partner's staff (`billing_managed_by_partner`)"}},"tags":["Account"]}},"/v1/outreach-templates":{"get":{"summary":"Get partner outreach email templates","description":"The cold email a partner sends a prospect after building them a demo agent: the working demo first, then a short proposal, then a 30-minute call. One generic email plus one per sector, each with a card name, a one-line blurb, the subject and a plain-text body (`\\n` line breaks). Replace every `[placeholder]` (e.g. `[First name]`, `[Company]`, `[Chat link]`, `[Proposal link]`) before sending. Static copy — any key.","parameters":[{"name":"language","in":"query","required":false,"schema":{"type":"string","enum":["en","pt","es","pl","hr"],"default":"en"},"description":"Email language"},{"name":"sector","in":"query","required":false,"schema":{"type":"string","enum":["generic","hospitality","dealership","telecom"]},"description":"Return only this sector's email (default: all four)"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"language":{"type":"string","example":"en"},"intro":{"type":"string","description":"How to use the templates"},"emails":{"type":"array","items":{"type":"object","properties":{"sector":{"type":"string","enum":["generic","hospitality","dealership","telecom"]},"name":{"type":"string"},"blurb":{"type":"string"},"subject":{"type":"string"},"body":{"type":"string","description":"Plain text with [placeholders]"}}}}}}}}},"400":{"description":"Unknown language (`invalid_language`) or sector (`invalid_sector`)"}},"tags":["Partners"]}},"/v1/verify-user":{"post":{"summary":"Verify an end-user session token","description":"Verify a short-lived end-user token (the chat access token, or the Supercognit-User-Token header forwarded with http-tool calls) and return the user, their subscription status, and the product. Use this from an external workflow (n8n, Make, …) to confirm who is in the session.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["token"],"properties":{"token":{"type":"string","description":"End-user JWT to verify"},"product_id":{"type":"string","description":"Optional: assert the token belongs to this product"}}}}}},"responses":{"200":{"description":"Token is valid; returns user, subscription and product"},"401":{"description":"Invalid or expired token"},"403":{"description":"Token belongs to another workspace/product"}},"tags":["Verification & audit"]}},"/v1/products":{"get":{"summary":"List products","description":"Chat agents and MCP servers in the workspace (a product-scoped key sees only its own). In a partner's client workspace, a key not minted by the partner's staff gets no price fields.","parameters":[{"name":"kind","in":"query","required":false,"schema":{"type":"string","enum":["chat_agent","mcp_server"]},"description":"Filter by product kind"}],"responses":{"200":{"description":"Products of your workspace, newest activity first","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["chat_agent","mcp_server"]},"slug":{"type":"string"},"status":{"type":"string","enum":["draft","published","unpublished"]},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"logo":{"type":"string","nullable":true},"domain":{"type":"string","nullable":true},"planPrice":{"type":"integer","description":"Monthly price in USD cents"},"updatedAt":{"type":"string","format":"date-time"}}}}}}},"400":{"description":"Invalid kind"}},"tags":["Agents & MCP servers"]},"post":{"summary":"Create a product","description":"Creates a chat agent or an MCP server; `kind` decides which.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["title"],"properties":{"kind":{"type":"string","enum":["chat_agent","mcp_server"],"default":"chat_agent"},"title":{"type":"string"},"intro":{"type":"string","description":"chat_agent only: greeting shown in the chat"},"systemPrompt":{"type":"string","description":"chat_agent only"},"leadCapture":{"type":"string","enum":["off","when_qualified","early","form_first"],"description":"chat_agent only: when the agent offers to take a visitor's details (default when_qualified)"},"type":{"type":"string","enum":["manual","person"],"description":"chat_agent only: who answers. `manual` (default) = the AI; `person` = the team replies from the Inbox and no model is ever called (no AI cost: spend caps, message quotas and the builder-pays publish gate do not apply). Switching keeps every AI setting stored."},"description":{"type":"string","description":"mcp_server only"},"instructions":{"type":"string","description":"mcp_server only: server instructions"}}}}}},"responses":{"200":{"description":"Created (starts as a draft)","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"kind":{"type":"string"}}}}}},"400":{"description":"Missing title / invalid kind"},"402":{"description":"Plan limit reached"},"403":{"description":"workspace_key_required — a product-scoped key cannot create products"}},"tags":["Agents & MCP servers"]}},"/v1/products/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"Get a product","description":"Full editable state. Shape depends on `kind`: chat agents include type (manual = AI, person = the team answers), systemPrompt/intro/starterQuestions/translations; MCP servers include instructions and their published tools. In a partner's client workspace, a key not minted by the partner's staff gets no pricing fields (planPrice, pricingMode, dailySpendCapCents, unlimitedGuests).","responses":{"200":{"description":"OK"},"404":{"description":"Not found / not yours"}},"tags":["Agents & MCP servers"]},"patch":{"summary":"Update a product","description":"Fields are per kind and all optional; only supplied fields change.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"description":{"type":"string"},"planPrice":{"type":"integer","description":"USD cents"},"communityAvailable":{"type":"boolean"},"logo":{"type":"string","nullable":true},"cover":{"type":"string","nullable":true},"defaultLanguage":{"type":"string"},"translations":{"type":"object","description":"Per-language content map"},"summary":{"type":"string","description":"chat_agent only"},"intro":{"type":"string","description":"chat_agent only"},"starterQuestions":{"type":"array","items":{"type":"string"},"description":"chat_agent only"},"systemPrompt":{"type":"string","description":"chat_agent only"},"webSearch":{"type":"boolean","description":"chat_agent only"},"maxSearches":{"type":"integer","description":"chat_agent only (1-10)"},"memoryEnabled":{"type":"boolean","description":"chat_agent only"},"thinking":{"type":"string","enum":["auto","low","off"],"description":"chat_agent only: low = Minimal reasoning effort for this agent (faster, cheaper); auto = platform setting. off is accepted as low."},"pricingMode":{"type":"string","enum":["subscription","builder_pays"],"description":"Who pays for usage: the visitors (subscription) or the workspace (builder_pays)"},"dailySpendCapCents":{"type":"integer","nullable":true,"description":"builder_pays only: daily spend cap in USD cents (null = none, max 100000)"},"unlimitedGuests":{"type":"boolean","description":"chat_agent, builder_pays only: lift the daily message cap for visitors who are not signed in (chat, widget, WhatsApp, Telegram). Honoured only while the workspace has billing; the daily spend cap, the wallet and the bot check still apply."},"whatsappHandoff":{"type":"object","nullable":true,"description":"chat_agent only. WhatsApp cost control: answer normally inside `windowMinutes` of the person's first message, up to `maxReplies` answers per conversation, and while the number is under `monthlyCap` delivered messages this month; after that send up to `maxNudges` nudges with a link that continues the same conversation on the hosted chat, then stay silent. null = off.","properties":{"enabled":{"type":"boolean"},"windowMinutes":{"type":"integer","nullable":true,"description":"1-43200 (30 days); null disables the window rule"},"windowHours":{"type":"integer","nullable":true,"deprecated":true,"description":"Input only, 1-720: the window in hours, used when `windowMinutes` is not sent"},"monthlyCap":{"type":"integer","nullable":true,"description":"Delivered messages per number per month; null disables the rule"},"maxReplies":{"type":"integer","nullable":true,"description":"1-1000 answers per conversation (a conversation starts over after a week of silence); null disables the rule"},"maxNudges":{"type":"integer","description":"0-20"},"message":{"type":"string","nullable":true,"description":"Custom nudge text; must contain {{link}}"}}},"verification":{"type":"object","nullable":true,"description":"chat_agent only. Customer verification: the agent gets a request_verification tool. The platform looks the customer up with `lookupToolId` (server-side; the model never sees the response) and sends a one-time code to the phone (by `phoneCodeBy`: WhatsApp authentication template or SMS) or email ON FILE — never to one the person types. A WhatsApp sender, or a visitor who already verified their mobile in the conversation, whose number is on file is verified without a code; when the phone on file is a different number, the check is refused and no code is sent. A verified customer fills {{caller.customer_ref}} in http tools (and {{caller.phone}} or {{caller.email}} too: the phone or email on file the code went to). With `phoneEnabled` the agent also gets a verify_phone tool: the person gives their mobile and the platform sends a code by `phoneCodeBy` to that number; a verified number fills {{caller.phone}} on the web chat and widget. With `emailEnabled` the agent also gets a verify_email tool: the person gives their email address, the platform sends a code there, and a verified address fills {{caller.email}}. null = off.","properties":{"enabled":{"type":"boolean"},"lookupToolId":{"type":"string","format":"uuid","description":"An http tool that returns the customer record"},"lookupArg":{"type":"string","description":"The lookup tool's input that receives the customer reference"},"phonePaths":{"type":"array","items":{"type":"string"},"description":"Dot paths to phones in the lookup response (max 5)"},"emailPaths":{"type":"array","items":{"type":"string"},"description":"Dot paths to emails in the lookup response (max 5)"},"refLabel":{"type":"string","description":"What the business calls the reference, e.g. customer number"},"whatsappTemplate":{"type":"object","nullable":true,"properties":{"name":{"type":"string"},"language":{"type":"string","description":"e.g. es_AR"}}},"phoneCodeBy":{"type":"string","enum":["whatsapp","sms"],"description":"How every phone code travels. whatsapp (default) needs whatsappTemplate; sms needs no template, and each SMS is billed to the workspace balance at Twilio's price plus a fixed fee."},"codeByWhatsapp":{"type":"boolean","description":"Customer codes may go to the phone on file, by phoneCodeBy (by WhatsApp it needs whatsappTemplate). Default true; tried first."},"codeByEmail":{"type":"boolean","description":"Customer codes may go by email to the email on file. Default true; the fallback when the phone is off or fails."},"phoneEnabled":{"type":"boolean","description":"Phone verification by a code sent by phoneCodeBy; by WhatsApp it needs whatsappTemplate"},"phoneDailyLimit":{"type":"integer","description":"Most phone-verification codes the agent sends per UTC day, 0-10000; 0 (the default) = no limit"},"phonePerNumberLimit":{"type":"integer","description":"Most phone-verification codes one number receives per UTC day, 0-100 (default 3); 0 = no limit"},"emailEnabled":{"type":"boolean","description":"Email verification: a code by email to the address the person gives; fills {{caller.email}}"},"emailDailyLimit":{"type":"integer","description":"Most email-verification codes the agent sends per UTC day, 0-10000; 0 (the default) = no limit"},"emailPerAddressLimit":{"type":"integer","description":"Most email-verification codes one address receives per UTC day, 0-100 (default 3); 0 = no limit"}}},"channelAccess":{"type":"object","nullable":true,"description":"chat_agent only. Staff-only agents: with mode `allowlist` the agent answers ONLY the listed people: WhatsApp numbers (authenticated by Meta) and, on the full web chat, signed-in emails the platform proved (sign-in link or Google; password sign-ups do not count) that are listed or at a listed domain. The widget and Telegram are refused. With no emails or domains listed, the web chat is closed too. A number not on the list gets `deniedMessage` (or a localized default) at most once a day, and never opens a conversation. The object is replaced whole: send every list you want to keep. null = everyone.","properties":{"mode":{"type":"string","enum":["everyone","allowlist"]},"allowedPhones":{"type":"array","items":{"type":"string"},"description":"Phone numbers in any format; stored as E.164 digits. Max 500."},"allowedEmails":{"type":"array","items":{"type":"string"},"description":"Email addresses allowed on the web chat; stored lower-case. Max 500."},"allowedDomains":{"type":"array","items":{"type":"string"},"description":"Email domains (e.g. company.pt, exact match) allowed on the web chat. Max 50."},"deniedMessage":{"type":"string","nullable":true,"description":"Reply to people not on the list (max 500 chars)"}}},"humanSupport":{"type":"object","nullable":true,"description":"chat_agent only. Human support: when a person on the team takes over from the AI. While a person holds a conversation the AI stays quiet; after `autoReturnMinutes` of team silence (with the visitor waiting) the AI takes back over. null = off.","properties":{"enabled":{"type":"boolean"},"onVisitorRequest":{"type":"boolean","description":"The AI hands over when the visitor asks for a person"},"onAiUnsure":{"type":"boolean","description":"The AI hands over when it cannot resolve the issue"},"button":{"type":"string","enum":["always","after_reply","never"],"description":"\"Talk to a person\" button on the web chat and widget"},"hours":{"type":"object","nullable":true,"description":"Business hours; null = always reachable","properties":{"timezone":{"type":"string","description":"IANA zone, e.g. Europe/Lisbon"},"days":{"type":"object","description":"mon..sun -> {open: \"HH:MM\", close: \"HH:MM\"} or null (closed)"}}},"offline":{"type":"string","enum":["ai_continues","leave_message"],"description":"Outside hours: the AI keeps helping, or the request queues for the team"},"humanFirst":{"type":"boolean","description":"Inside hours, new conversations wait for a person"},"autoReturnMinutes":{"type":"integer","description":"2-120; default 10"},"autoAssign":{"type":"boolean","description":"Round-robin a new request to the least-busy available teammate (default true)"},"waitingMessage":{"type":"string","nullable":true,"description":"Custom text; null = localized default"},"offlineMessage":{"type":"string","nullable":true,"description":"Custom text; null = localized default with the hours"},"teamIds":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Teams (see /v1/teams) this agent hands over to, in order (first = default, max 10). With teams the AI picks the team, each team's hours/backup/cap apply, and a waiting visitor keeps their place in line (no auto-return while waiting). Empty = workspace-wide round-robin."}}},"welcomeMenu":{"type":"object","nullable":true,"description":"chat_agent only. One menu per app: { whatsapp, telegram }, each { enabled, prompt, options }. After the first reply of a conversation, and when the person types \"menu\", the options go out as a tap-able list. A tap is ordinary text to the AI; the person can always type instead. Send only the app you change; the other keeps its menu. A single { enabled, prompt, options } (the older form) sets every app. null = off.","properties":{"whatsapp":{"type":"object","properties":{"enabled":{"type":"boolean"},"prompt":{"type":"string","nullable":true,"description":"Text above the list (max 300); null = localized default"},"options":{"type":"array","items":{"type":"string"},"description":"Up to 10 labels, max 24 characters each"}}},"telegram":{"type":"object","properties":{"enabled":{"type":"boolean"},"prompt":{"type":"string","nullable":true,"description":"Text above the list (max 300); null = localized default"},"options":{"type":"array","items":{"type":"string"},"description":"Up to 10 labels, max 24 characters each"}}}}},"accessMode":{"type":"string","enum":["open","login_required","anonymous"],"description":"chat_agent only"},"locationRequest":{"type":"boolean","description":"chat_agent only: the agent may ask the person to pin their exact location (a map with address search and device location on the chat page and widget; the app's share-location on WhatsApp/Telegram). The result is on the conversation's workflow as visitorLocation."},"leadCapture":{"type":"string","enum":["off","when_qualified","early","form_first"],"description":"chat_agent only: when the agent offers to take a visitor's details. Turning it on attaches a lead tool (provider none) if the agent has none."},"type":{"type":"string","enum":["manual","person"],"description":"chat_agent only: who answers. `manual` (default) = the AI; `person` = the team replies from the Inbox and no model is ever called (no AI cost: spend caps, message quotas and the builder-pays publish gate do not apply). Switching keeps every AI setting stored."},"instructions":{"type":"string","description":"mcp_server only"}}}}}},"responses":{"200":{"description":"OK"},"400":{"description":"Invalid patch"},"403":{"description":"`billing_managed_by_partner`: a partner's client workspace whose key was not minted by the partner's staff sent a pricing field (listed in `fields`); nothing was changed"},"404":{"description":"Not found / not yours"}},"tags":["Agents & MCP servers"]}},"/v1/products/{id}/publish":{"post":{"summary":"Publish a product","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"},"404":{"description":"Not found / not yours"}},"tags":["Agents & MCP servers"]}},"/v1/products/{id}/unpublish":{"post":{"summary":"Unpublish a product","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"},"404":{"description":"Not found / not yours"}},"tags":["Agents & MCP servers"]}},"/v1/imports":{"post":{"summary":"Import an agent from a website","description":"Queues a crawl of the site. A worker extracts the business identity and builds a DRAFT chat agent plus a knowledge base from its pages. One import runs at a time per workspace, and the plan's limits apply. Workspace keys only.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","description":"Public http(s) URL of the site to import"}}}}}},"responses":{"202":{"description":"Queued — poll GET /v1/imports/{id}","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["queued"]}}}}}},"400":{"description":"`url_required`, an invalid URL, a plan limit, or an import already running (message in `error`)"},"403":{"description":"Product-scoped key"}},"tags":["Agents & MCP servers"]}},"/v1/imports/{id}":{"get":{"summary":"Get an import's progress","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["queued","running","succeeded","failed"]},"step":{"type":"string","nullable":true,"description":"Human-readable progress line"},"pagesDone":{"type":"integer"},"pagesTotal":{"type":"integer"},"productId":{"type":"string","format":"uuid","nullable":true,"description":"The draft agent, once built"},"knowledgeBaseId":{"type":"string","format":"uuid","nullable":true},"result":{"type":"object","nullable":true,"description":"Extraction summary (title, languages …) once succeeded"},"error":{"type":"string","nullable":true}}}}}},"403":{"description":"Product-scoped key"},"404":{"description":"Not found / not yours"}},"tags":["Agents & MCP servers"]}},"/v1/products/{id}/guardrails":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Product id (agent or MCP server)"}],"get":{"summary":"Get guardrail rules","description":"Creator rules only — platform safety is not configurable and not listed. Absent fields mean the default (nothing blocked, emails kept, country rule off).","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"blockedKeywords":{"type":"array","items":{"type":"string"},"description":"The agent refuses messages containing any of these"},"blockedTopics":{"type":"array","items":{"type":"string"},"description":"Subjects the agent declines"},"refusalMessage":{"type":"string","description":"Shown when a rule blocks a message (localized platform default when empty)"},"redactEmails":{"type":"boolean","description":"Opt-in: replace emails in messages with [redacted-email]. Card/SSN redaction is always on."},"countryMode":{"type":"string","enum":["off","block","allow"],"description":"Country rule for the web surfaces. off (default) serves everyone; block refuses the listed countries; allow refuses everyone NOT listed. An empty list serves everyone."},"countries":{"type":"array","items":{"type":"string"},"description":"Upper-case ISO 3166-1 alpha-2 codes; \"T1\" = Tor exit nodes. Unknown codes are dropped on write."}}}}}},"404":{"description":"Not found / not yours"}},"tags":["Guardrails"]},"patch":{"summary":"Update guardrail rules","description":"Merge: only the supplied fields change; pass an empty array to clear a list. Country codes are upper-cased and unknown ones dropped; an unknown `countryMode` is refused. The country rule applies to the chat page, widget and embed loader only — never to messaging channels or this API.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"blockedKeywords":{"type":"array","items":{"type":"string"},"description":"The agent refuses messages containing any of these"},"blockedTopics":{"type":"array","items":{"type":"string"},"description":"Subjects the agent declines"},"refusalMessage":{"type":"string","description":"Shown when a rule blocks a message (localized platform default when empty)"},"redactEmails":{"type":"boolean","description":"Opt-in: replace emails in messages with [redacted-email]. Card/SSN redaction is always on."},"countryMode":{"type":"string","enum":["off","block","allow"],"description":"Country rule for the web surfaces. off (default) serves everyone; block refuses the listed countries; allow refuses everyone NOT listed. An empty list serves everyone."},"countries":{"type":"array","items":{"type":"string"},"description":"Upper-case ISO 3166-1 alpha-2 codes; \"T1\" = Tor exit nodes. Unknown codes are dropped on write."}}}}}},"responses":{"200":{"description":"The rules after the update","content":{"application/json":{"schema":{"type":"object","properties":{"blockedKeywords":{"type":"array","items":{"type":"string"},"description":"The agent refuses messages containing any of these"},"blockedTopics":{"type":"array","items":{"type":"string"},"description":"Subjects the agent declines"},"refusalMessage":{"type":"string","description":"Shown when a rule blocks a message (localized platform default when empty)"},"redactEmails":{"type":"boolean","description":"Opt-in: replace emails in messages with [redacted-email]. Card/SSN redaction is always on."},"countryMode":{"type":"string","enum":["off","block","allow"],"description":"Country rule for the web surfaces. off (default) serves everyone; block refuses the listed countries; allow refuses everyone NOT listed. An empty list serves everyone."},"countries":{"type":"array","items":{"type":"string"},"description":"Upper-case ISO 3166-1 alpha-2 codes; \"T1\" = Tor exit nodes. Unknown codes are dropped on write."}}}}}},"400":{"description":"Invalid field — `message` says which"},"403":{"description":"Key is scoped to another product / read-only key"},"404":{"description":"Not found / not yours"}},"tags":["Guardrails"]}},"/v1/products/{id}/versions":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Product id (agent or MCP server)"}],"get":{"summary":"List versions","description":"The version history the dashboard's History tab shows, newest first (the first one is live). Every change to the prompt or instructions, settings, widget, welcome menu, texts and languages, logo, cover, feedback form, guardrails, tools, knowledge or videos leaves a version; quick saves by the same person through the same path merge. Price, status, access, team, domain and channels are not versioned. `limit` is how many versions the plan keeps (null = unlimited; named checkpoints never count).","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"limit":{"type":"integer","nullable":true},"maxNamed":{"type":"integer"},"versions":{"type":"array","items":{"type":"object","properties":{"version":{"type":"integer"},"label":{"type":"string","nullable":true,"description":"Name of a checkpoint; named versions are never trimmed"},"source":{"type":"string","enum":["dashboard","mcp","api","import","restore","system"]},"restoredFrom":{"type":"integer","nullable":true,"description":"For a restore: the version it brought back"},"createdBy":{"type":"string","nullable":true},"createdByName":{"type":"string","nullable":true},"mergedSaves":{"type":"integer","description":"Quick saves by the same person merged into this version"},"summary":{"type":"array","description":"What changed, as items with an `area` (prompt, setting, widget, translation, tool_added, …) and its details","items":{"type":"object","properties":{"area":{"type":"string"}},"additionalProperties":true}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}}}}}}},"403":{"description":"Key is scoped to another product"},"404":{"description":"Not found / not yours"}},"tags":["Agents & MCP servers"]}},"/v1/products/{id}/versions/{version}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Product id (agent or MCP server)"},{"name":"version","in":"path","required":true,"schema":{"type":"integer","minimum":1},"description":"Version number (from `GET /v1/products/{id}/versions`)"}],"patch":{"summary":"Name a version","description":"Set `label` to name the version as a checkpoint (kept for good; at most 20 per product; cut to 60 characters), or `null` / an empty string to remove the name. The key's owner must be a workspace owner or admin.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["label"],"properties":{"label":{"type":"string","nullable":true}}}}}},"responses":{"200":{"description":"Saved"},"400":{"description":"No `label` in the body"},"403":{"description":"Key owner is not an owner/admin, key is scoped to another product, or read-only key"},"404":{"description":"Product or version not found"},"409":{"description":"Already at the maximum of named versions"}},"tags":["Agents & MCP servers"]}},"/v1/products/{id}/versions/{version}/compare":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Product id (agent or MCP server)"},{"name":"version","in":"path","required":true,"schema":{"type":"integer","minimum":1},"description":"Version number (from `GET /v1/products/{id}/versions`)"}],"get":{"summary":"Compare a version","description":"`against=previous` (default): what this version changed over the one before it (`baseline: true` for the first version). `against=live`: what restoring it would change on the live product. `blocks` are diff blocks of kind `text` (word-diff `segments` with op same|add|del), `value` (`from` → `to`), `image` (logo/cover) or `list` (added/removed tools, knowledge, videos, languages, suggested questions).","parameters":[{"name":"against","in":"query","schema":{"type":"string","enum":["previous","live"],"default":"previous"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"baseline":{"type":"boolean"},"blocks":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["text","value","image","list"]}},"additionalProperties":true}}}}}}},"403":{"description":"Key is scoped to another product"},"404":{"description":"Product or version not found"},"409":{"description":"Part of the version's stored content is missing"}},"tags":["Agents & MCP servers"]}},"/v1/products/{id}/versions/{version}/restore":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Product id (agent or MCP server)"},{"name":"version","in":"path","required":true,"schema":{"type":"integer","minimum":1},"description":"Version number (from `GET /v1/products/{id}/versions`)"}],"post":{"summary":"Restore a version","description":"Puts the product back to how it was in this version, for everyone using it, right away, and records that as a new version (so it can be restored back). Tools and knowledge bases deleted since are skipped and named in the response. Price, status, access, team, domain and channels are not touched. The key's owner must be a workspace owner or admin.","responses":{"200":{"description":"Restored","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"integer","description":"The live version after the restore"},"changed":{"type":"boolean","description":"false when the product already matched that version"},"skippedTools":{"type":"array","items":{"type":"string"}},"skippedKnowledge":{"type":"array","items":{"type":"string"}}}}}}},"403":{"description":"Key owner is not an owner/admin, key is scoped to another product, or read-only key"},"404":{"description":"Product or version not found"},"409":{"description":"Part of the version's stored content is missing: nothing was changed"}},"tags":["Agents & MCP servers"]}},"/v1/products/{id}/feedback-config":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Product id (agent or MCP server)"}],"get":{"summary":"Get the feedback config","description":"What 👍 (`up`) and 👎 (`down`) open, defaults applied. Defaults: down = form on, category optional, comment required, the five built-in categories; up = no form, category off, comment optional.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"down":{"type":"object","properties":{"popup":{"type":"boolean","description":"Open a short form after the vote (the vote is saved either way)"},"category":{"type":"string","enum":["off","optional","required"],"description":"Ask for a category (off when there are no categories)"},"comment":{"type":"string","enum":["off","optional","required"],"description":"Ask for a comment (max 2000 characters)"},"categories":{"type":"array","maxItems":10,"description":"Replaces the whole list. Built-in keys (incorrect, not_helpful, ignored_context, unclear, other) are translated into every chat language by the platform, so their labels may be empty; a custom key needs at least one label.","items":{"type":"object","required":["key"],"properties":{"key":{"type":"string","pattern":"^[a-z0-9][a-z0-9_-]*$","maxLength":40},"labels":{"type":"object","additionalProperties":{"type":"string","maxLength":60},"description":"Language code → label"}}}}}},"up":{"type":"object","properties":{"popup":{"type":"boolean","description":"Open a short form after the vote (the vote is saved either way)"},"category":{"type":"string","enum":["off","optional","required"],"description":"Ask for a category (off when there are no categories)"},"comment":{"type":"string","enum":["off","optional","required"],"description":"Ask for a comment (max 2000 characters)"},"categories":{"type":"array","maxItems":10,"description":"Replaces the whole list. Built-in keys (incorrect, not_helpful, ignored_context, unclear, other) are translated into every chat language by the platform, so their labels may be empty; a custom key needs at least one label.","items":{"type":"object","required":["key"],"properties":{"key":{"type":"string","pattern":"^[a-z0-9][a-z0-9_-]*$","maxLength":40},"labels":{"type":"object","additionalProperties":{"type":"string","maxLength":60},"description":"Language code → label"}}}}}}}}}}},"404":{"description":"Not found / not yours"}},"tags":["Feedback"]},"patch":{"summary":"Update the feedback config","description":"Merge per polarity: send `down` and/or `up` with any of `popup`, `category`, `comment`, `categories` (the list is replaced whole). Invalid entries are dropped, not refused: a custom category with no label, a key that is not a slug, labels over 60 characters are cut. Send `{ \"reset\": true }` to go back to the platform defaults.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"down":{"type":"object","properties":{"popup":{"type":"boolean","description":"Open a short form after the vote (the vote is saved either way)"},"category":{"type":"string","enum":["off","optional","required"],"description":"Ask for a category (off when there are no categories)"},"comment":{"type":"string","enum":["off","optional","required"],"description":"Ask for a comment (max 2000 characters)"},"categories":{"type":"array","maxItems":10,"description":"Replaces the whole list. Built-in keys (incorrect, not_helpful, ignored_context, unclear, other) are translated into every chat language by the platform, so their labels may be empty; a custom key needs at least one label.","items":{"type":"object","required":["key"],"properties":{"key":{"type":"string","pattern":"^[a-z0-9][a-z0-9_-]*$","maxLength":40},"labels":{"type":"object","additionalProperties":{"type":"string","maxLength":60},"description":"Language code → label"}}}}}},"up":{"type":"object","properties":{"popup":{"type":"boolean","description":"Open a short form after the vote (the vote is saved either way)"},"category":{"type":"string","enum":["off","optional","required"],"description":"Ask for a category (off when there are no categories)"},"comment":{"type":"string","enum":["off","optional","required"],"description":"Ask for a comment (max 2000 characters)"},"categories":{"type":"array","maxItems":10,"description":"Replaces the whole list. Built-in keys (incorrect, not_helpful, ignored_context, unclear, other) are translated into every chat language by the platform, so their labels may be empty; a custom key needs at least one label.","items":{"type":"object","required":["key"],"properties":{"key":{"type":"string","pattern":"^[a-z0-9][a-z0-9_-]*$","maxLength":40},"labels":{"type":"object","additionalProperties":{"type":"string","maxLength":60},"description":"Language code → label"}}}}}},"reset":{"type":"boolean"}}}}}},"responses":{"200":{"description":"The config after the update","content":{"application/json":{"schema":{"type":"object","properties":{"down":{"type":"object","properties":{"popup":{"type":"boolean","description":"Open a short form after the vote (the vote is saved either way)"},"category":{"type":"string","enum":["off","optional","required"],"description":"Ask for a category (off when there are no categories)"},"comment":{"type":"string","enum":["off","optional","required"],"description":"Ask for a comment (max 2000 characters)"},"categories":{"type":"array","maxItems":10,"description":"Replaces the whole list. Built-in keys (incorrect, not_helpful, ignored_context, unclear, other) are translated into every chat language by the platform, so their labels may be empty; a custom key needs at least one label.","items":{"type":"object","required":["key"],"properties":{"key":{"type":"string","pattern":"^[a-z0-9][a-z0-9_-]*$","maxLength":40},"labels":{"type":"object","additionalProperties":{"type":"string","maxLength":60},"description":"Language code → label"}}}}}},"up":{"type":"object","properties":{"popup":{"type":"boolean","description":"Open a short form after the vote (the vote is saved either way)"},"category":{"type":"string","enum":["off","optional","required"],"description":"Ask for a category (off when there are no categories)"},"comment":{"type":"string","enum":["off","optional","required"],"description":"Ask for a comment (max 2000 characters)"},"categories":{"type":"array","maxItems":10,"description":"Replaces the whole list. Built-in keys (incorrect, not_helpful, ignored_context, unclear, other) are translated into every chat language by the platform, so their labels may be empty; a custom key needs at least one label.","items":{"type":"object","required":["key"],"properties":{"key":{"type":"string","pattern":"^[a-z0-9][a-z0-9_-]*$","maxLength":40},"labels":{"type":"object","additionalProperties":{"type":"string","maxLength":60},"description":"Language code → label"}}}}}}}}}}},"400":{"description":"Nothing to change, or `down`/`up` is not an object"},"403":{"description":"Key is scoped to another product / read-only key"},"404":{"description":"Not found / not yours"}},"tags":["Feedback"]}},"/v1/products/{id}/feedback":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Product id (agent or MCP server)"}],"get":{"summary":"List feedback","description":"Visitor feedback on this product's replies, newest first. Paginate with `before` = the previous page's `nextCursor`.","parameters":[{"name":"rating","in":"query","schema":{"type":"string","enum":["up","down"]}},{"name":"status","in":"query","schema":{"type":"string","enum":["new","reviewed","fixed"]},"description":"Review status"},{"name":"category","in":"query","schema":{"type":"string"},"description":"Category key"},{"name":"from","in":"query","schema":{"type":"string","format":"date-time"},"description":"Created at or after"},{"name":"to","in":"query","schema":{"type":"string","format":"date-time"},"description":"Created at or before"},{"name":"withComment","in":"query","schema":{"type":"boolean"},"description":"Only feedback that carries a comment"},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"before","in":"query","schema":{"type":"string","format":"date-time"},"description":"Cursor"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid"},"productSlug":{"type":"string"},"sessionId":{"type":"string","format":"uuid","description":"The conversation — read it with GET /v1/sessions/{id}/messages"},"messageId":{"type":"string","format":"uuid"},"rating":{"type":"string","enum":["up","down"]},"status":{"type":"string","enum":["new","reviewed","fixed"],"description":"Where the vote is in the team's review queue (dashboard Feedback page)"},"categoryKey":{"type":"string","nullable":true},"comment":{"type":"string","nullable":true},"language":{"type":"string","nullable":true,"description":"The chat language the visitor voted in"},"messageExcerpt":{"type":"string","nullable":true,"description":"The rated reply's first 280 characters"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}},"nextCursor":{"type":"string","nullable":true}}}}}},"403":{"description":"Key is scoped to another product"},"404":{"description":"Not found / not yours"}},"tags":["Feedback"]}},"/v1/products/{id}/feedback/status":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Product id (agent or MCP server)"}],"post":{"summary":"Set the review status","description":"Move votes through the team's review queue, as on the dashboard's Feedback page: `new` (nobody looked yet; thumbs-down in this state make the sidebar badge), `reviewed` or `fixed`. Setting `new` clears who reviewed it. Votes that are not on this product are left alone.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["ids","status"],"properties":{"ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":200,"description":"Feedback ids (`id` from List feedback)"},"status":{"type":"string","enum":["new","reviewed","fixed"]}}}}}},"responses":{"200":{"description":"How many votes changed","content":{"application/json":{"schema":{"type":"object","properties":{"updated":{"type":"integer"}}}}}},"400":{"description":"invalid_status, ids_required or too_many_ids"},"403":{"description":"Key is scoped to another product"},"404":{"description":"Not found / not yours"}},"tags":["Feedback"]}},"/v1/products/{id}/feedback/summary":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Product id (agent or MCP server)"}],"get":{"summary":"Feedback summary","description":"Counts by rating and by category. `categoryKey: null` = votes without a category (the form was off, optional or cancelled).","parameters":[{"name":"from","in":"query","schema":{"type":"string","format":"date-time"},"description":"Created at or after"},{"name":"to","in":"query","schema":{"type":"string","format":"date-time"},"description":"Created at or before"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer"},"up":{"type":"integer"},"down":{"type":"integer"},"byCategory":{"type":"array","items":{"type":"object","properties":{"rating":{"type":"string","enum":["up","down"]},"categoryKey":{"type":"string","nullable":true},"count":{"type":"integer"}}}}}}}}},"403":{"description":"Key is scoped to another product"},"404":{"description":"Not found / not yours"}},"tags":["Feedback"]}},"/v1/agents/{id}":{"delete":{"summary":"Delete a product","description":"Soft-deletes an UNPUBLISHED product (agent or MCP server) and frees its custom domain. Double confirmation: the body must repeat the product's slug in `confirm`. A published product returns 409 — set it to draft first. Workspace keys only. Equivalent to the request_product_delete / confirm_product_delete platform tools.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["confirm"],"properties":{"confirm":{"type":"string","description":"The product's slug, exactly"}}}}}},"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"deleted":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["chat_agent","mcp_server"]},"slug":{"type":"string"}}}}}}}},"400":{"description":"`confirm` missing or not the slug"},"403":{"description":"Product-scoped key"},"404":{"description":"Not found in this workspace"},"409":{"description":"Published — unpublish first"}},"tags":["Agents & MCP servers"]}},"/v1/agents/{id}/media":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Chat agent product id"}],"get":{"summary":"List an agent's videos","description":"Videos registered on a chat agent, in display order. The agent shows them inline through its `show_video` tool. YouTube and Vimeo only; max 25 per agent.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"provider":{"type":"string","enum":["youtube","vimeo"]},"providerId":{"type":"string","description":"The provider's own video id (YouTube 11 chars, Vimeo numeric)"},"url":{"type":"string","description":"Canonical watch URL, rebuilt from the parsed id — never the link as submitted"},"title":{"type":"string","description":"Max 80 chars; resolved from the provider when not supplied"},"description":{"type":"string","nullable":true,"description":"Max 200 chars. The model reads it to pick the right video, so say what the video is for."},"posterUrl":{"type":"string","nullable":true,"description":"Thumbnail (YouTube CDN, or Vimeo's oEmbed thumbnail when reachable)"},"sortOrder":{"type":"integer","description":"0-based display position; the agent lists videos in this order"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}}}}}}},"403":{"description":"Key is scoped to another product"},"404":{"description":"Not found / not yours / not a chat agent"}},"tags":["Agent videos"]},"post":{"summary":"Add a video","description":"Pass a YouTube or Vimeo link (watch, share, youtu.be, shorts, vimeo.com/ID …). It is validated and canonicalized; title and poster are resolved from the provider when not supplied. Refused for any other host, a video already in the library, or a full library (25).","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","description":"YouTube or Vimeo link"},"title":{"type":"string","description":"Optional, max 80 chars (defaults to the provider's title)"},"description":{"type":"string","description":"Optional, max 200 chars — what the video is for, so the model picks the right one"}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"provider":{"type":"string","enum":["youtube","vimeo"]},"providerId":{"type":"string","description":"The provider's own video id (YouTube 11 chars, Vimeo numeric)"},"url":{"type":"string","description":"Canonical watch URL, rebuilt from the parsed id — never the link as submitted"},"title":{"type":"string","description":"Max 80 chars; resolved from the provider when not supplied"},"description":{"type":"string","nullable":true,"description":"Max 200 chars. The model reads it to pick the right video, so say what the video is for."},"posterUrl":{"type":"string","nullable":true,"description":"Thumbnail (YouTube CDN, or Vimeo's oEmbed thumbnail when reachable)"},"sortOrder":{"type":"integer","description":"0-based display position; the agent lists videos in this order"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}}}},"400":{"description":"Not a YouTube/Vimeo link, already in the library, or the library is full — `message` says which"},"403":{"description":"Key is scoped to another product / read-only key"},"404":{"description":"Not found / not yours / not a chat agent"}},"tags":["Agent videos"]}},"/v1/agents/{id}/media/{mediaId}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Chat agent product id"},{"name":"mediaId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"patch":{"summary":"Update a video","description":"The link itself is immutable — delete and re-add to change the video. Only supplied fields change; an empty description clears it.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","description":"Max 80 chars, not empty"},"description":{"type":"string","description":"Max 200 chars"},"sortOrder":{"type":"integer","description":"New 0-based position"}}}}}},"responses":{"200":{"description":"The updated video","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"provider":{"type":"string","enum":["youtube","vimeo"]},"providerId":{"type":"string","description":"The provider's own video id (YouTube 11 chars, Vimeo numeric)"},"url":{"type":"string","description":"Canonical watch URL, rebuilt from the parsed id — never the link as submitted"},"title":{"type":"string","description":"Max 80 chars; resolved from the provider when not supplied"},"description":{"type":"string","nullable":true,"description":"Max 200 chars. The model reads it to pick the right video, so say what the video is for."},"posterUrl":{"type":"string","nullable":true,"description":"Thumbnail (YouTube CDN, or Vimeo's oEmbed thumbnail when reachable)"},"sortOrder":{"type":"integer","description":"0-based display position; the agent lists videos in this order"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}}}},"400":{"description":"Invalid patch (e.g. empty title)"},"403":{"description":"Key is scoped to another product / read-only key"},"404":{"description":"Agent or video not found"}},"tags":["Agent videos"]},"delete":{"summary":"Remove a video","description":"Only the library entry goes — nothing changes on YouTube/Vimeo. Frees a slot toward the cap.","responses":{"204":{"description":"Removed"},"403":{"description":"Key is scoped to another product / read-only key"},"404":{"description":"Agent or video not found"}},"tags":["Agent videos"]}},"/v1/tools":{"get":{"summary":"List tools","description":"Tools belong to the workspace; MCP servers publish a subset and chat agents attach them. Requires a workspace-level key.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"toolId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"actionType":{"type":"string","enum":["llm","http","static"]},"enabled":{"type":"boolean"},"inputCount":{"type":"integer"},"usedBy":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string","format":"uuid"},"slug":{"type":"string"},"kind":{"type":"string"},"title":{"type":"string","nullable":true}}}},"needsVerified":{"type":"array","items":{"type":"string","enum":["phone","email","customer_ref"]},"description":"Checks a visitor must pass before this http tool runs: the {{caller.x}} placeholders it uses."}}}}}}},"403":{"description":"Product-scoped keys cannot manage workspace tools"}},"tags":["Tools"]},"post":{"summary":"Create a tool","description":"Adds a tool to the workspace library. Attach it to agents or publish it on an MCP server afterwards.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"Model-facing identifier: letters, digits, _ and - (max 64)"},"description":{"type":"string"},"inputSchema":{"type":"object","description":"JSON schema of the tool inputs"},"actionType":{"type":"string","enum":["llm","http","static"],"default":"llm"},"actionConfig":{"type":"object","description":"Per-type config: llm → { instruction }, static → { content }, http → { method, url (https), headers, bodyTemplate, connectionId? } with {{arg}} placeholders. http URLs must be public https and are SSRF-validated. With connectionId (see /v1/api-connections), url is a path appended to the connection's base URL and the connection adds its sign-in. {{caller.phone}}, {{caller.email}}, {{caller.customer_ref}} and {{caller.channel}} are filled by the platform from the verified person (WhatsApp sender, signed widget identity, one-time code); the tool refuses to run when that identity is not verified. confirmation: { summary } makes it confirm-first: the platform holds the call and shows the person Confirm / Cancel buttons with that text; only their tap runs it (see /v1/confirmations). actionConfig.cards (http tools) declares how a result is drawn as rich cards, so the model only sends item ids to show_cards: { list?: \"results\", id: [\"variant_id\",\"id\"], heading, preheading?, subheading?, description?, highlight?, image?, link?, badge?, cta1?: \"button label\", cta2?: { label?, tool?, args? }, endTurn?: true }. Each field is a result field name or a template such as \"{author} · {publisher}\" (\"a || b\" = the first that has a value). A save that omits cards keeps the existing mapping; cards: null removes it. actionConfig.ui (http tools) sets how the tool shows in the end-user chat's live tool-call card: { label?: \"short text in the agent's language, max 60 chars\", icon?: one of search, book, file, database, globe, cart, user, mail, phone, calendar, map, cards, sparkle, wrench }. Put {input_name} or {a|b} (first non-empty) in the label to show the real values the model sent for that call, e.g. \"Checking stock for «{query|author}»\"; the 60-char limit counts the template as written, values are shortened to fit. Without it the card shows a built-in localized label and an icon for the kind of tool. A save that omits ui keeps it; ui: null removes it."}}}}}},"responses":{"200":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"actionType":{"type":"string"}}}}}},"400":{"description":"Validation failed (message explains why)"},"403":{"description":"Product-scoped keys cannot manage workspace tools"}},"tags":["Tools"]}},"/v1/tools/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"Get a tool","description":"Full editable state, including `actionConfig`.","responses":{"200":{"description":"OK"},"403":{"description":"Product-scoped key"},"404":{"description":"Not found / not yours"}},"tags":["Tools"]},"patch":{"summary":"Update a tool","description":"actionType is immutable; other fields optional. http actionConfig is re-validated.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"inputSchema":{"type":"object"},"actionConfig":{"type":"object"},"enabled":{"type":"boolean"}}}}}},"responses":{"200":{"description":"OK"},"400":{"description":"Invalid patch"},"403":{"description":"Product-scoped key"},"404":{"description":"Not found"}},"tags":["Tools"]}},"/v1/verifications":{"get":{"summary":"List verification codes sent","description":"One row per code sent, newest first. Contacts are masked; codes are never stored (only a hash) and never returned.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid"},"sessionId":{"type":"string","format":"uuid"},"customerRef":{"type":"string","description":"The customer reference, or the mobile number (digits) when kind is phone"},"kind":{"type":"string","enum":["customer","phone"],"description":"customer = code to the contact on file; phone = code by WhatsApp to the number the person gave"},"channel":{"type":"string","enum":["email","whatsapp"]},"contactMasked":{"type":"string"},"attempts":{"type":"integer"},"status":{"type":"string","enum":["pending","verified","failed","expired"]},"createdAt":{"type":"string","format":"date-time"},"verifiedAt":{"type":"string","format":"date-time","nullable":true}}}}}}},"403":{"description":"Product-scoped key"}},"tags":["Verification & audit"]}},"/v1/confirmations":{"get":{"summary":"List action confirmations","description":"Calls of confirm-first tools, newest first: what was held, the summary the person saw, the outcome and where they decided. Actions run only on the person's tap, never on the model's say-so.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid"},"sessionId":{"type":"string","format":"uuid"},"toolName":{"type":"string"},"summary":{"type":"string"},"status":{"type":"string","enum":["pending","confirmed","done","failed","cancelled","expired"]},"decidedVia":{"type":"string","nullable":true,"enum":["web","widget","whatsapp","telegram",null]},"createdAt":{"type":"string","format":"date-time"},"decidedAt":{"type":"string","format":"date-time","nullable":true}}}}}}},"403":{"description":"Product-scoped key"}},"tags":["Verification & audit"]}},"/v1/api-connections":{"get":{"summary":"List API connections","description":"Connections hold an external API's base URL, optional login step and encrypted secrets; http tools reference one by connectionId. Secret values and tokens are never returned — only secret names.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"baseUrl":{"type":"string"},"authType":{"type":"string","enum":["none","static","login"]},"config":{"type":"object","required":["baseUrl"],"properties":{"baseUrl":{"type":"string","description":"Public https base, e.g. https://api.example.com:7117. Tool paths are appended to it."},"auth":{"type":"object","description":"none | static (only inject templates) | login (sign in first, keep the token)","properties":{"type":{"type":"string","enum":["none","static","login"]},"login":{"type":"object","properties":{"method":{"type":"string","enum":["GET","POST","PUT","PATCH"]},"path":{"type":"string","description":"Relative to baseUrl, starts with /"},"query":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"},"body":{"type":"string","description":"Body template ({{secret.NAME}})"},"bodyType":{"type":"string","enum":["json","form","raw"]},"tokenPath":{"type":"string","description":"Dot path to the token in the JSON login response, e.g. token or result.sid"},"ttlSeconds":{"type":"integer","minimum":60,"maximum":604800},"reloginOnStatus":{"type":"array","items":{"type":"integer"},"description":"Default [401, 403]"},"reloginOnBodyMatch":{"type":"string","description":"Response text that also means the session expired"}}}}},"inject":{"type":"object","description":"Added to every tool call through this connection. A login connection must send {{token}} here.","properties":{"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"},"query":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"}}}}},"secretNames":{"type":"array","items":{"type":"string"},"description":"Names only — values are write-only"},"signedIn":{"type":"boolean","description":"A login connection currently holds an unexpired token"},"tokenExpiresAt":{"type":"string","format":"date-time","nullable":true},"lastCheckedAt":{"type":"string","format":"date-time","nullable":true},"lastCheckOk":{"type":"boolean","nullable":true},"lastError":{"type":"string","nullable":true},"usedBy":{"type":"array","items":{"type":"object","properties":{"toolId":{"type":"string","format":"uuid"},"name":{"type":"string"}}}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}}}}},"403":{"description":"Product-scoped keys cannot manage connections"}},"tags":["API connections"]},"post":{"summary":"Create an API connection","description":"Secrets are write-only: send them here, they are never returned.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","config"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"config":{"type":"object","required":["baseUrl"],"properties":{"baseUrl":{"type":"string","description":"Public https base, e.g. https://api.example.com:7117. Tool paths are appended to it."},"auth":{"type":"object","description":"none | static (only inject templates) | login (sign in first, keep the token)","properties":{"type":{"type":"string","enum":["none","static","login"]},"login":{"type":"object","properties":{"method":{"type":"string","enum":["GET","POST","PUT","PATCH"]},"path":{"type":"string","description":"Relative to baseUrl, starts with /"},"query":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"},"body":{"type":"string","description":"Body template ({{secret.NAME}})"},"bodyType":{"type":"string","enum":["json","form","raw"]},"tokenPath":{"type":"string","description":"Dot path to the token in the JSON login response, e.g. token or result.sid"},"ttlSeconds":{"type":"integer","minimum":60,"maximum":604800},"reloginOnStatus":{"type":"array","items":{"type":"integer"},"description":"Default [401, 403]"},"reloginOnBodyMatch":{"type":"string","description":"Response text that also means the session expired"}}}}},"inject":{"type":"object","description":"Added to every tool call through this connection. A login connection must send {{token}} here.","properties":{"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"},"query":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"}}}}},"secrets":{"type":"object","additionalProperties":{"type":"string"},"description":"NAME → value. Write-only, stored encrypted (AES-256-GCM). Referenced in templates as {{secret.NAME}}."}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"baseUrl":{"type":"string"},"authType":{"type":"string","enum":["none","static","login"]},"config":{"type":"object","required":["baseUrl"],"properties":{"baseUrl":{"type":"string","description":"Public https base, e.g. https://api.example.com:7117. Tool paths are appended to it."},"auth":{"type":"object","description":"none | static (only inject templates) | login (sign in first, keep the token)","properties":{"type":{"type":"string","enum":["none","static","login"]},"login":{"type":"object","properties":{"method":{"type":"string","enum":["GET","POST","PUT","PATCH"]},"path":{"type":"string","description":"Relative to baseUrl, starts with /"},"query":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"},"body":{"type":"string","description":"Body template ({{secret.NAME}})"},"bodyType":{"type":"string","enum":["json","form","raw"]},"tokenPath":{"type":"string","description":"Dot path to the token in the JSON login response, e.g. token or result.sid"},"ttlSeconds":{"type":"integer","minimum":60,"maximum":604800},"reloginOnStatus":{"type":"array","items":{"type":"integer"},"description":"Default [401, 403]"},"reloginOnBodyMatch":{"type":"string","description":"Response text that also means the session expired"}}}}},"inject":{"type":"object","description":"Added to every tool call through this connection. A login connection must send {{token}} here.","properties":{"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"},"query":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"}}}}},"secretNames":{"type":"array","items":{"type":"string"},"description":"Names only — values are write-only"},"signedIn":{"type":"boolean","description":"A login connection currently holds an unexpired token"},"tokenExpiresAt":{"type":"string","format":"date-time","nullable":true},"lastCheckedAt":{"type":"string","format":"date-time","nullable":true},"lastCheckOk":{"type":"boolean","nullable":true},"lastError":{"type":"string","nullable":true},"usedBy":{"type":"array","items":{"type":"object","properties":{"toolId":{"type":"string","format":"uuid"},"name":{"type":"string"}}}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}}}},"400":{"description":"Validation failed (message explains why)"},"403":{"description":"Product-scoped key"}},"tags":["API connections"]}},"/v1/api-connections/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"Get an API connection","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"baseUrl":{"type":"string"},"authType":{"type":"string","enum":["none","static","login"]},"config":{"type":"object","required":["baseUrl"],"properties":{"baseUrl":{"type":"string","description":"Public https base, e.g. https://api.example.com:7117. Tool paths are appended to it."},"auth":{"type":"object","description":"none | static (only inject templates) | login (sign in first, keep the token)","properties":{"type":{"type":"string","enum":["none","static","login"]},"login":{"type":"object","properties":{"method":{"type":"string","enum":["GET","POST","PUT","PATCH"]},"path":{"type":"string","description":"Relative to baseUrl, starts with /"},"query":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"},"body":{"type":"string","description":"Body template ({{secret.NAME}})"},"bodyType":{"type":"string","enum":["json","form","raw"]},"tokenPath":{"type":"string","description":"Dot path to the token in the JSON login response, e.g. token or result.sid"},"ttlSeconds":{"type":"integer","minimum":60,"maximum":604800},"reloginOnStatus":{"type":"array","items":{"type":"integer"},"description":"Default [401, 403]"},"reloginOnBodyMatch":{"type":"string","description":"Response text that also means the session expired"}}}}},"inject":{"type":"object","description":"Added to every tool call through this connection. A login connection must send {{token}} here.","properties":{"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"},"query":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"}}}}},"secretNames":{"type":"array","items":{"type":"string"},"description":"Names only — values are write-only"},"signedIn":{"type":"boolean","description":"A login connection currently holds an unexpired token"},"tokenExpiresAt":{"type":"string","format":"date-time","nullable":true},"lastCheckedAt":{"type":"string","format":"date-time","nullable":true},"lastCheckOk":{"type":"boolean","nullable":true},"lastError":{"type":"string","nullable":true},"usedBy":{"type":"array","items":{"type":"object","properties":{"toolId":{"type":"string","format":"uuid"},"name":{"type":"string"}}}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}}}},"404":{"description":"Not found"}},"tags":["API connections"]},"patch":{"summary":"Update an API connection","description":"Fields are optional. secrets merge: a string sets or overwrites that secret, null removes it, omitted secrets stay. Any config or secret change signs the connection out.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"config":{"type":"object","required":["baseUrl"],"properties":{"baseUrl":{"type":"string","description":"Public https base, e.g. https://api.example.com:7117. Tool paths are appended to it."},"auth":{"type":"object","description":"none | static (only inject templates) | login (sign in first, keep the token)","properties":{"type":{"type":"string","enum":["none","static","login"]},"login":{"type":"object","properties":{"method":{"type":"string","enum":["GET","POST","PUT","PATCH"]},"path":{"type":"string","description":"Relative to baseUrl, starts with /"},"query":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"},"body":{"type":"string","description":"Body template ({{secret.NAME}})"},"bodyType":{"type":"string","enum":["json","form","raw"]},"tokenPath":{"type":"string","description":"Dot path to the token in the JSON login response, e.g. token or result.sid"},"ttlSeconds":{"type":"integer","minimum":60,"maximum":604800},"reloginOnStatus":{"type":"array","items":{"type":"integer"},"description":"Default [401, 403]"},"reloginOnBodyMatch":{"type":"string","description":"Response text that also means the session expired"}}}}},"inject":{"type":"object","description":"Added to every tool call through this connection. A login connection must send {{token}} here.","properties":{"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"},"query":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"}}}}},"secrets":{"type":"object","additionalProperties":{"type":"string","nullable":true}}}}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"baseUrl":{"type":"string"},"authType":{"type":"string","enum":["none","static","login"]},"config":{"type":"object","required":["baseUrl"],"properties":{"baseUrl":{"type":"string","description":"Public https base, e.g. https://api.example.com:7117. Tool paths are appended to it."},"auth":{"type":"object","description":"none | static (only inject templates) | login (sign in first, keep the token)","properties":{"type":{"type":"string","enum":["none","static","login"]},"login":{"type":"object","properties":{"method":{"type":"string","enum":["GET","POST","PUT","PATCH"]},"path":{"type":"string","description":"Relative to baseUrl, starts with /"},"query":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"},"body":{"type":"string","description":"Body template ({{secret.NAME}})"},"bodyType":{"type":"string","enum":["json","form","raw"]},"tokenPath":{"type":"string","description":"Dot path to the token in the JSON login response, e.g. token or result.sid"},"ttlSeconds":{"type":"integer","minimum":60,"maximum":604800},"reloginOnStatus":{"type":"array","items":{"type":"integer"},"description":"Default [401, 403]"},"reloginOnBodyMatch":{"type":"string","description":"Response text that also means the session expired"}}}}},"inject":{"type":"object","description":"Added to every tool call through this connection. A login connection must send {{token}} here.","properties":{"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"},"query":{"type":"object","additionalProperties":{"type":"string"},"description":"name → value template; values may use {{secret.NAME}} and, for login connections, {{token}}"}}}}},"secretNames":{"type":"array","items":{"type":"string"},"description":"Names only — values are write-only"},"signedIn":{"type":"boolean","description":"A login connection currently holds an unexpired token"},"tokenExpiresAt":{"type":"string","format":"date-time","nullable":true},"lastCheckedAt":{"type":"string","format":"date-time","nullable":true},"lastCheckOk":{"type":"boolean","nullable":true},"lastError":{"type":"string","nullable":true},"usedBy":{"type":"array","items":{"type":"object","properties":{"toolId":{"type":"string","format":"uuid"},"name":{"type":"string"}}}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}}}},"400":{"description":"Invalid patch"},"404":{"description":"Not found"}},"tags":["API connections"]},"delete":{"summary":"Delete an API connection","description":"Refused with 409 while any tool still uses it.","responses":{"204":{"description":"Deleted"},"404":{"description":"Not found"},"409":{"description":"Still used by tools"}},"tags":["API connections"]}},"/v1/api-connections/{id}/test":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"post":{"summary":"Test an API connection","description":"A login connection signs in fresh; others do a GET of the base URL. The token is never returned.","responses":{"200":{"description":"Outcome","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"message":{"type":"string"}}}}}},"404":{"description":"Not found"}},"tags":["API connections"]}},"/v1/knowledge-bases":{"get":{"summary":"List knowledge bases","description":"Read-only in v1. Includes source counts and which products use each KB.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"updatedAt":{"type":"string","format":"date-time"},"sourceCount":{"type":"integer"},"usedBy":{"type":"array","items":{"type":"object"}}}}}}}},"403":{"description":"Product-scoped keys cannot read workspace knowledge bases"}},"tags":["Knowledge bases"]}},"/v1/knowledge-bases/{id}/sources":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"List the sources of a knowledge base","description":"Read-only in v1. Each source has its type, title, uri, ingest status, language and, for a document split into sections, its short name and section count. A spreadsheet source fetched from a server also carries `remote`: host, port, username, path, cadence, last and next fetch, the last result (ok, unchanged, held, failed) with its reason code, and whether it is fetched on a schedule. Passwords and keys are never returned. Creating a source that is fetched from a server is dashboard-only, because it takes an SFTP password; so are binary uploads (PDF/docx).","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["url","document"]},"title":{"type":"string","nullable":true},"uri":{"type":"string","nullable":true},"status":{"type":"string"},"language":{"type":"string","nullable":true},"refreshHours":{"type":"integer","nullable":true},"lastIngestedAt":{"type":"string","format":"date-time","nullable":true},"structured":{"type":"boolean"},"shortName":{"type":"string","nullable":true},"sectionCount":{"type":"integer","nullable":true},"remote":{"type":"object","description":"Only on a source fetched from a server.","properties":{"host":{"type":"string"},"port":{"type":"integer"},"username":{"type":"string"},"path":{"type":"string"},"cadence":{"type":"string","enum":["daily","weekly","monthly"]},"lastRunAt":{"type":"string","format":"date-time","nullable":true},"nextRunAt":{"type":"string","format":"date-time","nullable":true},"lastStatus":{"type":"string","enum":["ok","unchanged","held","failed"]},"lastMessage":{"type":"string","nullable":true,"description":"A plain English sentence about the last result."},"lastCode":{"type":"string","nullable":true,"description":"Why it was held or failed: auth, hostkey, virus, scanner, connect, timeout, missing, toolarge, type, layout, rows, rules, index, plan, other."},"scheduled":{"type":"boolean"}}}}}}}}},"403":{"description":"Product-scoped keys cannot read workspace knowledge bases"},"404":{"description":"Not found"}},"tags":["Knowledge bases"]}},"/v1/transfers/targets":{"get":{"summary":"List transfer targets","description":"Workspaces the key's user owns or administers. direct = same owner as this workspace (POST /v1/transfers runs at once); otherwise send a transfer request to ownerEmail.","responses":{"200":{"description":"Array of { id, name, isPersonal, isSource, direct, ownerEmail }"},"403":{"description":"Product-scoped keys cannot transfer"}},"tags":["Transfers"]}},"/v1/transfers/preview":{"post":{"summary":"Preview a transfer","description":"Dry run. A tool or knowledge base used only by what is moving moves; one still used here is copied; an identical tool already in the target is reused. Saved browser logins never cross owners. Changes nothing.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["items","targetWorkspaceId"],"properties":{"items":{"type":"array","maxItems":200,"description":"What to transfer. Attached tools, knowledge bases and saved logins come along automatically.","items":{"type":"object","required":["kind","id"],"properties":{"kind":{"type":"string","enum":["agent","mcp","knowledge_base","tool"]},"id":{"type":"string","format":"uuid"}}}},"targetWorkspaceId":{"type":"string","format":"uuid","description":"Destination. May equal the key's workspace for an in-place duplicate."},"mode":{"type":"string","enum":["move","duplicate"],"default":"move"},"handOverConnections":{"type":"boolean","default":false,"description":"Across owners only: move WhatsApp/Telegram channels and custom domains too."}}}}}},"responses":{"200":{"description":"The plan","content":{"application/json":{"schema":{"type":"object","description":"What happens to each piece. blockers non-empty = the transfer will not run.","properties":{"mode":{"type":"string","enum":["move","duplicate"]},"sameWorkspace":{"type":"boolean"},"sameOwner":{"type":"boolean"},"products":{"type":"array","items":{"type":"object"}},"tools":{"type":"array","items":{"type":"object","description":"action: move | copy | reuse | reuse_existing; credential: move | copy | strip"}},"knowledgeBases":{"type":"array","items":{"type":"object","description":"action: move | copy | reuse"}},"credentials":{"type":"array","items":{"type":"object"}},"channels":{"type":"array","items":{"type":"object","description":"action: move | remove"}},"domains":{"type":"array","items":{"type":"object","description":"action: keep | remove"}},"revokedApiKeys":{"type":"integer"},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}},"blockers":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}}},"403":{"description":"Not an owner/admin of the workspaces involved"}},"tags":["Transfers"]}},"/v1/transfers":{"post":{"summary":"Transfer items","description":"Same-owner targets only (or an in-place duplicate). Runs in one transaction after re-planning; refuses with 409 and the plan when there are blockers. Moved agents keep their id, link, widget code, channels and conversations; usage history stays in the source workspace. Product-scoped API keys of moved agents are revoked.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["items","targetWorkspaceId"],"properties":{"items":{"type":"array","maxItems":200,"description":"What to transfer. Attached tools, knowledge bases and saved logins come along automatically.","items":{"type":"object","required":["kind","id"],"properties":{"kind":{"type":"string","enum":["agent","mcp","knowledge_base","tool"]},"id":{"type":"string","format":"uuid"}}}},"targetWorkspaceId":{"type":"string","format":"uuid","description":"Destination. May equal the key's workspace for an in-place duplicate."},"mode":{"type":"string","enum":["move","duplicate"],"default":"move"},"handOverConnections":{"type":"boolean","default":false,"description":"Across owners only: move WhatsApp/Telegram channels and custom domains too."}}}}}},"responses":{"200":{"description":"{ plan, productIds: { sourceId: resultingId }, followUpErrors }"},"409":{"description":"Blocked (plan limits, paying subscribers, pending request) or the target belongs to someone else (error: needs_request)"}},"tags":["Transfers"]}},"/v1/transfer-requests":{"get":{"summary":"List transfer requests","description":"`outgoing` = requests sent from this workspace; `incoming` = requests addressed to the key's user.","parameters":[{"name":"direction","in":"query","schema":{"type":"string","enum":["outgoing","incoming"],"default":"outgoing"}}],"responses":{"200":{"description":"Array of requests: status pending | accepted | declined | cancelled | expired"}},"tags":["Transfers"]},"post":{"summary":"Request a transfer","description":"Emails recipientEmail. They choose one of their workspaces, see the plan against it and accept or decline within 7 days.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["items","recipientEmail"],"properties":{"items":{"type":"array","maxItems":200,"description":"What to transfer. Attached tools, knowledge bases and saved logins come along automatically.","items":{"type":"object","required":["kind","id"],"properties":{"kind":{"type":"string","enum":["agent","mcp","knowledge_base","tool"]},"id":{"type":"string","format":"uuid"}}}},"recipientEmail":{"type":"string","format":"email"},"mode":{"type":"string","enum":["move","duplicate"],"default":"move"},"handOverConnections":{"type":"boolean","default":false},"message":{"type":"string","maxLength":1000},"targetWorkspaceId":{"type":"string","format":"uuid","description":"Optional: pin the destination workspace"}}}}}},"responses":{"201":{"description":"The request"},"409":{"description":"Blocked by the source (shared tool, paying subscribers, already pending)"}},"tags":["Transfers"]}},"/v1/transfer-requests/{id}/accept":{"post":{"summary":"Accept a transfer request","description":"Moves the requested items into this key's workspace.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"{ plan, productIds, followUpErrors }"},"404":{"description":"Not addressed to the key user's verified email"},"409":{"description":"Blocked or already decided"}},"tags":["Transfers"]}},"/v1/transfer-requests/{id}/decline":{"post":{"summary":"Decline a transfer request","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Declined; the sender is emailed"}},"tags":["Transfers"]}},"/v1/transfer-requests/{id}/cancel":{"post":{"summary":"Cancel a transfer request","description":"Withdraws a pending request this workspace sent.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Cancelled"},"409":{"description":"Not pending"}},"tags":["Transfers"]}},"/v1/sessions":{"get":{"summary":"List conversations","description":"Conversations across your workspace's products, newest activity first. Product-scoped keys see only their own product's sessions.","parameters":[{"name":"product_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"has_lead","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true` returns only conversations that produced a lead; `false` only those that did not."},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["open","waiting_human","with_human","resolved","active"]},"description":"Workflow status; `active` = everything but resolved."},{"name":"assignee_user_id","in":"query","required":false,"schema":{"type":"string"},"description":"Only conversations assigned to this member"},{"name":"unassigned","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true` = only conversations with no assignee"},{"name":"tag_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"},"description":"Only conversations carrying this tag"},{"name":"team_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"},"description":"Only conversations in this team (queue)"},{"name":"customer","in":"query","required":false,"schema":{"type":"string","minLength":2,"maxLength":100},"description":"Only conversations with this customer: matches the person's name, email (account, guest contact or host-site identity), WhatsApp number (any formatting) or Telegram name/handle. Case-insensitive, partial."},{"name":"spam","in":"query","required":false,"schema":{"type":"string","enum":["exclude","only","include"],"default":"exclude"},"description":"Conversations filed under Spam are left out by default. `only` = the Spam folder, `include` = both."},{"name":"archived","in":"query","required":false,"schema":{"type":"string","enum":["exclude","only"],"default":"exclude"},"description":"Archived conversations are left out by default. `only` = the Archived view."},{"name":"archivedBy","in":"query","required":false,"schema":{"type":"string","enum":["team","customer"]},"description":"Only with `archived=only`: `team` = archived by the team, `customer` = deleted by the customer from their own chat list (`visitorDeletedAt` set). Omit for both."},{"name":"deleted","in":"query","required":false,"schema":{"type":"string","enum":["exclude","only"],"default":"exclude"},"description":"Soft-deleted conversations are left out of every list by default. `only` = Recently deleted (restorable for 30 days; spam and archive markers ignored)."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":30,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Pass the previous page's nextCursor to fetch the next page"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid"},"productSlug":{"type":"string"},"productTitle":{"type":"string"},"endUserEmail":{"type":"string","nullable":true},"guest":{"type":"boolean"},"name":{"type":"string","nullable":true},"lastMessageAt":{"type":"string","format":"date-time"},"lastMessagePreview":{"type":"string","nullable":true},"messageCount":{"type":"integer"},"leadCount":{"type":"integer","description":"Leads this conversation produced. Filter the list with `has_lead`."},"status":{"type":"string","enum":["open","waiting_human","with_human","resolved"],"description":"Human-agent workflow status"},"archivedAt":{"type":"string","format":"date-time","nullable":true,"description":"Archived (hidden from the default lists until the visitor writes again); null = not archived"},"deletedAt":{"type":"string","format":"date-time","nullable":true,"description":"Soft-deleted (only in `deleted=only`, restorable for 30 days); null = not deleted"},"visitorDeletedAt":{"type":"string","format":"date-time","nullable":true,"description":"The customer deleted it from their own chat list: listed with the archived ones, replies and unarchive refused; null = not deleted by the customer"},"spam":{"type":"object","nullable":true,"description":"Filed under Spam (hidden from the default lists, the AI no longer answers); null = a normal conversation","properties":{"at":{"type":"string","format":"date-time"},"source":{"type":"string","enum":["member","api","ai"],"description":"Who decided: a member, the API / MCP, or the background classifier"},"reason":{"type":"string","nullable":true}}},"priority":{"type":"integer","enum":[0,1]},"assignee":{"nullable":true,"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"}}},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"color":{"type":"string"}}}}}}},"nextCursor":{"type":"string","nullable":true}}}}}},"400":{"description":"Malformed product_id"},"403":{"description":"product_id outside the key's product scope"}},"tags":["Conversations"]}},"/v1/sessions/{id}/messages":{"get":{"summary":"Get a conversation transcript","description":"Read-only transcript (user/assistant/tool messages). System messages and raw tool payloads are never included.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"type":"object","properties":{"id":{"type":"string"},"productId":{"type":"string"},"productSlug":{"type":"string"},"endUserEmail":{"type":"string","nullable":true},"name":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}}},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["user","assistant","tool"]},"content":{"type":"string","nullable":true},"model":{"type":"string","nullable":true},"promptTokens":{"type":"integer","nullable":true},"completionTokens":{"type":"integer","nullable":true},"createdAt":{"type":"string","format":"date-time"},"attachments":{"type":"array","description":"Files stored with this message (person-agents). Fetch the bytes with GET /v1/attachments/{id}; there is no public URL.","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"filename":{"type":"string"},"mediaType":{"type":"string"},"sizeBytes":{"type":"integer"},"kind":{"type":"string","enum":["image","audio","document"]}}}},"feedback":{"type":"object","nullable":true,"description":"The visitor's 👍/👎 on this reply (assistant messages), with what the feedback form asked.","properties":{"rating":{"type":"string","enum":["up","down"]},"categoryKey":{"type":"string","nullable":true},"categoryLabel":{"type":"string","nullable":true,"description":"A custom category's label in the default language; null for built-ins"},"comment":{"type":"string","nullable":true}}}}}}}}}}},"403":{"description":"Session outside the key's product scope"},"404":{"description":"Not found / not yours"}},"tags":["Conversations"]}},"/v1/attachments/{id}":{"get":{"summary":"Download an attachment","description":"The bytes of a file a visitor sent, as listed under a transcript message's `attachments`. Images and audio are served inline; everything else (PDF, SVG, text) as a download with Content-Disposition: attachment. Product-scoped keys can only read attachments of their own agent.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The file","content":{"*/*":{"schema":{"type":"string","format":"binary"}}}},"403":{"description":"Attachment outside the key's product scope"},"404":{"description":"Not found / not yours"}},"tags":["Conversations"]}},"/v1/sessions/{id}/messages/{messageId}/trace":{"get":{"summary":"Get a reply's timing trace","description":"Where one AI reply's time went. `trace.spans` lists each setup phase, model call and tool run as startMs/endMs from the moment the request arrived; tools running at once overlap. `summary` totals setup, model, tools and other time and names the slowest span. Timings, tokens and tool names only, never arguments or results. 404 for human replies and for replies older than this feature.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"messageId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"messageId":{"type":"string"},"sessionId":{"type":"string"},"productId":{"type":"string"},"model":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"summary":{"type":"object","properties":{"setupMs":{"type":"integer"},"modelMs":{"type":"integer"},"toolMs":{"type":"integer","description":"Wall clock: tools running at once count once"},"otherMs":{"type":"integer"},"inputTokens":{"type":"integer"},"outputTokens":{"type":"integer"},"cacheReadTokens":{"type":"integer"},"slowest":{"type":"object","nullable":true,"description":"The longest span"}}},"trace":{"type":"object","properties":{"v":{"type":"integer"},"totalMs":{"type":"integer"},"truncated":{"type":"boolean"},"spans":{"type":"array","items":{"type":"object","required":["kind","startMs","endMs"],"properties":{"kind":{"type":"string","enum":["phase","model","tool"]},"startMs":{"type":"integer"},"endMs":{"type":"integer"},"phase":{"type":"string","description":"kind=phase"},"firstOutputMs":{"type":"integer","nullable":true,"description":"kind=model"},"finish":{"type":"string","nullable":true,"description":"kind=model"},"webSearches":{"type":"integer","description":"kind=model: provider-side searches run inside the call"},"inputTokens":{"type":"integer","description":"kind=model"},"outputTokens":{"type":"integer","description":"kind=model"},"cacheReadTokens":{"type":"integer","description":"kind=model"},"cacheWriteTokens":{"type":"integer","description":"kind=model"},"reasoningTokens":{"type":"integer","description":"kind=model"},"failed":{"type":"boolean","description":"kind=model: the attempt never finished"},"name":{"type":"string","description":"kind=tool: the tool's real name"},"step":{"type":"string","description":"kind=tool: the progress step visitors see"},"label":{"type":"string","description":"kind=tool: the creator's label as visitors see it"},"ok":{"type":"boolean","description":"kind=tool"}}}}}}}}}}},"403":{"description":"Reply outside the key's product scope"},"404":{"description":"Not found / not yours / no trace"}},"tags":["Conversations"]}},"/v1/sessions/{id}/workflow":{"get":{"summary":"Get a conversation's workflow","description":"Status, assignee, priority, tags, internal notes and the event timeline. Workspace keys only.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","description":"Workflow state of one conversation: status, who handles it, tags, internal notes and the event timeline.","properties":{"status":{"type":"string","enum":["open","waiting_human","with_human","resolved"]},"mode":{"type":"string","enum":["ai","human"],"description":"Who answers the next visitor message"},"archivedAt":{"type":"string","format":"date-time","nullable":true,"description":"Archived (hidden from the default lists until the visitor writes again); null = not archived"},"deletedAt":{"type":"string","format":"date-time","nullable":true,"description":"Soft-deleted (only in `deleted=only`, restorable for 30 days); null = not deleted"},"visitorDeletedAt":{"type":"string","format":"date-time","nullable":true,"description":"The customer deleted it from their own chat list: listed with the archived ones, replies and unarchive refused; null = not deleted by the customer"},"spam":{"type":"object","nullable":true,"description":"Filed under Spam (hidden from the default lists, the AI no longer answers); null = a normal conversation","properties":{"at":{"type":"string","format":"date-time"},"source":{"type":"string","enum":["member","api","ai"],"description":"Who decided: a member, the API / MCP, or the background classifier"},"reason":{"type":"string","nullable":true}}},"priority":{"type":"integer","enum":[0,1]},"assignee":{"nullable":true,"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"image":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","admin","member","agent"]},"availability":{"type":"string","enum":["available","away"],"description":"The member's own switch (list endpoint only)"},"online":{"type":"boolean","description":"Available AND the dashboard is open right now (list endpoint only)"}}},"team":{"type":"object","nullable":true,"description":"The team (queue) it is in","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}}},"queuePosition":{"type":"integer","nullable":true,"description":"Place in the team's line while waiting unassigned (1 = next)"},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","description":"Lower-cased, unique per workspace"},"color":{"type":"string","enum":["gray","red","orange","amber","green","teal","blue","indigo","purple","pink"]},"usageCount":{"type":"integer","description":"Conversations carrying the tag (list endpoint only)"}}}},"notes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"body":{"type":"string"},"author":{"nullable":true,"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"image":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","admin","member","agent"]},"availability":{"type":"string","enum":["available","away"],"description":"The member's own switch (list endpoint only)"},"online":{"type":"boolean","description":"Available AND the dashboard is open right now (list endpoint only)"}}},"createdAt":{"type":"string","format":"date-time"}}}},"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["status_changed","assigned","unassigned","tagged","untagged","note_added","priority_changed","reopened_by_visitor","human_replied","human_requested","returned_to_ai","visitor_email","team_changed","marked_spam","unmarked_spam","archived","unarchived","deleted","restored"]},"actorType":{"type":"string","enum":["member","api","system","visitor"]},"actor":{"nullable":true,"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"image":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","admin","member","agent"]},"availability":{"type":"string","enum":["available","away"],"description":"The member's own switch (list endpoint only)"},"online":{"type":"boolean","description":"Available AND the dashboard is open right now (list endpoint only)"}}},"data":{"type":"object","nullable":true},"createdAt":{"type":"string","format":"date-time"}}}},"humanRequestedAt":{"type":"string","format":"date-time","nullable":true},"firstHumanReplyAt":{"type":"string","format":"date-time","nullable":true},"lastHumanReplyAt":{"type":"string","format":"date-time","nullable":true},"resolvedAt":{"type":"string","format":"date-time","nullable":true},"visitorEmail":{"type":"string","nullable":true,"description":"Where a reply can reach the visitor by email (account email, or one a guest gave while waiting)"},"visitorEmailSource":{"type":"string","enum":["account","given"],"nullable":true},"visitorLocation":{"type":"object","nullable":true,"description":"The place the person pinned or shared: a map pin, an address search, their device location (chat page and widget, via request_location) or WhatsApp/Telegram \"share location\". A claim by the person, never verified. The latest share wins.","properties":{"lat":{"type":"number"},"lng":{"type":"number"},"address":{"type":"string","nullable":true},"details":{"type":"string","nullable":true,"description":"Floor, apartment, landmark — as typed"},"source":{"type":"string","enum":["map","search","device","whatsapp","telegram"]},"accuracyM":{"type":"integer","nullable":true,"description":"Device accuracy radius in metres"},"sharedAt":{"type":"string","format":"date-time"}}}}}}}},"403":{"description":"Workspace key required"},"404":{"description":"Not found / not yours"}},"tags":["Conversations"]},"patch":{"summary":"Update a conversation's workflow","description":"Any subset of: `teamId` (move to another team, or null; an assignee outside the new team is dropped and the conversation waits in that team's line), `status`, `assigneeUserId` (a member id, or null to unassign), `priority` (0/1), `tagIds` (the COMPLETE tag list). Assigning an open or queued conversation moves it to `with_human`; unassigning a `with_human` one returns it to `waiting_human`. A visitor writing into a resolved conversation reopens it automatically. `spam` (true/false) files the conversation under Spam or takes it back out: a spam conversation is hidden from the default list, the AI stops answering it, a new visitor message does not reopen it, and one a person held is resolved and unassigned. `archived` (true/false) archives a conversation or takes it back out: hidden from the default lists and counts until the visitor writes again (which clears the marker), the AI keeps answering. `deleted` (true) soft-deletes it: hidden everywhere except `deleted=only`, restorable with `deleted: false` for 30 days, after which a daily job removes it permanently; a new visitor message does not undelete it.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["open","waiting_human","with_human","resolved"]},"assigneeUserId":{"type":"string","nullable":true},"priority":{"type":"integer","enum":[0,1]},"tagIds":{"type":"array","items":{"type":"string","format":"uuid"}},"teamId":{"type":"string","format":"uuid","nullable":true},"spam":{"type":"boolean"},"archived":{"type":"boolean"},"deleted":{"type":"boolean","description":"true = soft-delete (restorable for 30 days), false = restore"}}}}}},"responses":{"200":{"description":"The updated workflow state","content":{"application/json":{"schema":{"type":"object","description":"Workflow state of one conversation: status, who handles it, tags, internal notes and the event timeline.","properties":{"status":{"type":"string","enum":["open","waiting_human","with_human","resolved"]},"mode":{"type":"string","enum":["ai","human"],"description":"Who answers the next visitor message"},"archivedAt":{"type":"string","format":"date-time","nullable":true,"description":"Archived (hidden from the default lists until the visitor writes again); null = not archived"},"deletedAt":{"type":"string","format":"date-time","nullable":true,"description":"Soft-deleted (only in `deleted=only`, restorable for 30 days); null = not deleted"},"visitorDeletedAt":{"type":"string","format":"date-time","nullable":true,"description":"The customer deleted it from their own chat list: listed with the archived ones, replies and unarchive refused; null = not deleted by the customer"},"spam":{"type":"object","nullable":true,"description":"Filed under Spam (hidden from the default lists, the AI no longer answers); null = a normal conversation","properties":{"at":{"type":"string","format":"date-time"},"source":{"type":"string","enum":["member","api","ai"],"description":"Who decided: a member, the API / MCP, or the background classifier"},"reason":{"type":"string","nullable":true}}},"priority":{"type":"integer","enum":[0,1]},"assignee":{"nullable":true,"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"image":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","admin","member","agent"]},"availability":{"type":"string","enum":["available","away"],"description":"The member's own switch (list endpoint only)"},"online":{"type":"boolean","description":"Available AND the dashboard is open right now (list endpoint only)"}}},"team":{"type":"object","nullable":true,"description":"The team (queue) it is in","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}}},"queuePosition":{"type":"integer","nullable":true,"description":"Place in the team's line while waiting unassigned (1 = next)"},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","description":"Lower-cased, unique per workspace"},"color":{"type":"string","enum":["gray","red","orange","amber","green","teal","blue","indigo","purple","pink"]},"usageCount":{"type":"integer","description":"Conversations carrying the tag (list endpoint only)"}}}},"notes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"body":{"type":"string"},"author":{"nullable":true,"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"image":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","admin","member","agent"]},"availability":{"type":"string","enum":["available","away"],"description":"The member's own switch (list endpoint only)"},"online":{"type":"boolean","description":"Available AND the dashboard is open right now (list endpoint only)"}}},"createdAt":{"type":"string","format":"date-time"}}}},"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["status_changed","assigned","unassigned","tagged","untagged","note_added","priority_changed","reopened_by_visitor","human_replied","human_requested","returned_to_ai","visitor_email","team_changed","marked_spam","unmarked_spam","archived","unarchived","deleted","restored"]},"actorType":{"type":"string","enum":["member","api","system","visitor"]},"actor":{"nullable":true,"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"image":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","admin","member","agent"]},"availability":{"type":"string","enum":["available","away"],"description":"The member's own switch (list endpoint only)"},"online":{"type":"boolean","description":"Available AND the dashboard is open right now (list endpoint only)"}}},"data":{"type":"object","nullable":true},"createdAt":{"type":"string","format":"date-time"}}}},"humanRequestedAt":{"type":"string","format":"date-time","nullable":true},"firstHumanReplyAt":{"type":"string","format":"date-time","nullable":true},"lastHumanReplyAt":{"type":"string","format":"date-time","nullable":true},"resolvedAt":{"type":"string","format":"date-time","nullable":true},"visitorEmail":{"type":"string","nullable":true,"description":"Where a reply can reach the visitor by email (account email, or one a guest gave while waiting)"},"visitorEmailSource":{"type":"string","enum":["account","given"],"nullable":true},"visitorLocation":{"type":"object","nullable":true,"description":"The place the person pinned or shared: a map pin, an address search, their device location (chat page and widget, via request_location) or WhatsApp/Telegram \"share location\". A claim by the person, never verified. The latest share wins.","properties":{"lat":{"type":"number"},"lng":{"type":"number"},"address":{"type":"string","nullable":true},"details":{"type":"string","nullable":true,"description":"Floor, apartment, landmark — as typed"},"source":{"type":"string","enum":["map","search","device","whatsapp","telegram"]},"accuracyM":{"type":"integer","nullable":true,"description":"Device accuracy radius in metres"},"sharedAt":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Invalid status / priority / tag ids, or a user who is not a member"},"403":{"description":"Workspace key required"},"404":{"description":"Not found / not yours"},"409":{"description":"Already in that state"}},"tags":["Conversations"]}},"/v1/sessions/{id}/reply":{"post":{"summary":"Reply to a conversation","description":"Writes a human (not AI) message into the conversation. Telegram and WhatsApp deliver immediately, signed with the member's first name (API replies are unsigned); the web chat and widget show it within seconds. WhatsApp only accepts replies within 24 hours of the person's last message. The conversation moves to `with_human`. Until the hand-off release the AI may still answer the visitor's next message.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"body":{"type":"string","description":"Markdown, max 4000 characters. May be empty when attachments are sent."},"attachments":{"type":"array","maxItems":5,"description":"Files to send with the reply (images, audio, PDF, text; 5 MB each). Audio is delivered as a voice note on WhatsApp/Telegram. Needs file storage on the server (503 attachments_unavailable otherwise).","items":{"type":"object","required":["filename","mediaType","dataBase64"],"properties":{"filename":{"type":"string"},"mediaType":{"type":"string"},"dataBase64":{"type":"string","description":"Base64 without the data-URL prefix"}}}}}}}}},"responses":{"201":{"description":"Delivered (channels) or stored for the chat to pick up (web)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"object","properties":{"id":{"type":"string"},"content":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"authorName":{"type":"string","nullable":true},"attachments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"filename":{"type":"string"},"mediaType":{"type":"string"},"sizeBytes":{"type":"integer"},"kind":{"type":"string","enum":["image","audio","document"]}}}}}},"deliveredVia":{"type":"string","enum":["web","telegram","whatsapp"]},"workflow":{"type":"object","description":"Workflow state of one conversation: status, who handles it, tags, internal notes and the event timeline.","properties":{"status":{"type":"string","enum":["open","waiting_human","with_human","resolved"]},"mode":{"type":"string","enum":["ai","human"],"description":"Who answers the next visitor message"},"archivedAt":{"type":"string","format":"date-time","nullable":true,"description":"Archived (hidden from the default lists until the visitor writes again); null = not archived"},"deletedAt":{"type":"string","format":"date-time","nullable":true,"description":"Soft-deleted (only in `deleted=only`, restorable for 30 days); null = not deleted"},"visitorDeletedAt":{"type":"string","format":"date-time","nullable":true,"description":"The customer deleted it from their own chat list: listed with the archived ones, replies and unarchive refused; null = not deleted by the customer"},"spam":{"type":"object","nullable":true,"description":"Filed under Spam (hidden from the default lists, the AI no longer answers); null = a normal conversation","properties":{"at":{"type":"string","format":"date-time"},"source":{"type":"string","enum":["member","api","ai"],"description":"Who decided: a member, the API / MCP, or the background classifier"},"reason":{"type":"string","nullable":true}}},"priority":{"type":"integer","enum":[0,1]},"assignee":{"nullable":true,"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"image":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","admin","member","agent"]},"availability":{"type":"string","enum":["available","away"],"description":"The member's own switch (list endpoint only)"},"online":{"type":"boolean","description":"Available AND the dashboard is open right now (list endpoint only)"}}},"team":{"type":"object","nullable":true,"description":"The team (queue) it is in","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}}},"queuePosition":{"type":"integer","nullable":true,"description":"Place in the team's line while waiting unassigned (1 = next)"},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","description":"Lower-cased, unique per workspace"},"color":{"type":"string","enum":["gray","red","orange","amber","green","teal","blue","indigo","purple","pink"]},"usageCount":{"type":"integer","description":"Conversations carrying the tag (list endpoint only)"}}}},"notes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"body":{"type":"string"},"author":{"nullable":true,"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"image":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","admin","member","agent"]},"availability":{"type":"string","enum":["available","away"],"description":"The member's own switch (list endpoint only)"},"online":{"type":"boolean","description":"Available AND the dashboard is open right now (list endpoint only)"}}},"createdAt":{"type":"string","format":"date-time"}}}},"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["status_changed","assigned","unassigned","tagged","untagged","note_added","priority_changed","reopened_by_visitor","human_replied","human_requested","returned_to_ai","visitor_email","team_changed","marked_spam","unmarked_spam","archived","unarchived","deleted","restored"]},"actorType":{"type":"string","enum":["member","api","system","visitor"]},"actor":{"nullable":true,"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"image":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","admin","member","agent"]},"availability":{"type":"string","enum":["available","away"],"description":"The member's own switch (list endpoint only)"},"online":{"type":"boolean","description":"Available AND the dashboard is open right now (list endpoint only)"}}},"data":{"type":"object","nullable":true},"createdAt":{"type":"string","format":"date-time"}}}},"humanRequestedAt":{"type":"string","format":"date-time","nullable":true},"firstHumanReplyAt":{"type":"string","format":"date-time","nullable":true},"lastHumanReplyAt":{"type":"string","format":"date-time","nullable":true},"resolvedAt":{"type":"string","format":"date-time","nullable":true},"visitorEmail":{"type":"string","nullable":true,"description":"Where a reply can reach the visitor by email (account email, or one a guest gave while waiting)"},"visitorEmailSource":{"type":"string","enum":["account","given"],"nullable":true},"visitorLocation":{"type":"object","nullable":true,"description":"The place the person pinned or shared: a map pin, an address search, their device location (chat page and widget, via request_location) or WhatsApp/Telegram \"share location\". A claim by the person, never verified. The latest share wins.","properties":{"lat":{"type":"number"},"lng":{"type":"number"},"address":{"type":"string","nullable":true},"details":{"type":"string","nullable":true,"description":"Floor, apartment, landmark — as typed"},"source":{"type":"string","enum":["map","search","device","whatsapp","telegram"]},"accuracyM":{"type":"integer","nullable":true,"description":"Device accuracy radius in metres"},"sharedAt":{"type":"string","format":"date-time"}}}}}}}}}},"400":{"description":"Empty or over-long body"},"403":{"description":"Workspace key required"},"404":{"description":"Not found / not yours"},"409":{"description":"whatsapp_window_closed (last inbound message over 24 h ago) or channel_unavailable (channel disconnected)"},"502":{"description":"delivery_failed: the messaging provider refused the message; nothing was stored"}},"tags":["Conversations"]}},"/v1/sessions/{id}/notes":{"post":{"summary":"Add an internal note","description":"Team-only note on a conversation; never shown to the visitor. Max 4000 characters.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["body"],"properties":{"body":{"type":"string"}}}}}},"responses":{"201":{"description":"Created — the note with its author (null for API-written notes)"},"400":{"description":"Empty body"},"403":{"description":"Workspace key required"},"404":{"description":"Not found / not yours"}},"tags":["Conversations"]}},"/v1/conversation-tags":{"get":{"summary":"List conversation tags","description":"The workspace's tag vocabulary with per-tag usage counts.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","description":"Lower-cased, unique per workspace"},"color":{"type":"string","enum":["gray","red","orange","amber","green","teal","blue","indigo","purple","pink"]},"usageCount":{"type":"integer","description":"Conversations carrying the tag (list endpoint only)"}}}}}}}},"tags":["Inbox setup"]},"post":{"summary":"Create a conversation tag","description":"Names are trimmed, lower-cased and unique per workspace (max 40 chars). Up to 100 tags per workspace.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"color":{"type":"string","enum":["gray","red","orange","amber","green","teal","blue","indigo","purple","pink"],"default":"gray"}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","description":"Lower-cased, unique per workspace"},"color":{"type":"string","enum":["gray","red","orange","amber","green","teal","blue","indigo","purple","pink"]},"usageCount":{"type":"integer","description":"Conversations carrying the tag (list endpoint only)"}}}}}},"400":{"description":"Empty name, unknown colour, or the workspace tag limit"},"409":{"description":"A tag with that name already exists"}},"tags":["Inbox setup"]}},"/v1/conversation-tags/{id}":{"patch":{"summary":"Update a conversation tag","description":"Rename or recolour; only supplied fields change.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"color":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","description":"Lower-cased, unique per workspace"},"color":{"type":"string","enum":["gray","red","orange","amber","green","teal","blue","indigo","purple","pink"]},"usageCount":{"type":"integer","description":"Conversations carrying the tag (list endpoint only)"}}}}}},"404":{"description":"Not found / not yours"},"409":{"description":"A tag with that name already exists"}},"tags":["Inbox setup"]},"delete":{"summary":"Delete a conversation tag","description":"Removes the tag from every conversation that carried it.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Deleted"},"404":{"description":"Not found / not yours"}},"tags":["Inbox setup"]}},"/v1/saved-replies":{"get":{"summary":"List saved replies","description":"The team's canned answers, inserted from the inbox reply box with /shortcut.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"shortcut":{"type":"string","description":"Lowercase a-z 0-9 - _, unique per workspace; typed as /shortcut in the inbox"},"title":{"type":"string"},"body":{"type":"string","description":"{{name}} = visitor's first name, {{agent}} = the member's; filled on insert"},"updatedAt":{"type":"string","format":"date-time"}}}}}}}},"tags":["Inbox setup"]},"post":{"summary":"Create a saved reply","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["shortcut","body"],"properties":{"shortcut":{"type":"string"},"title":{"type":"string"},"body":{"type":"string"}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"shortcut":{"type":"string","description":"Lowercase a-z 0-9 - _, unique per workspace; typed as /shortcut in the inbox"},"title":{"type":"string"},"body":{"type":"string","description":"{{name}} = visitor's first name, {{agent}} = the member's; filled on insert"},"updatedAt":{"type":"string","format":"date-time"}}}}}},"400":{"description":"Empty shortcut/body, body over 4000 chars, or the 200-per-workspace limit"},"409":{"description":"Shortcut already exists"}},"tags":["Inbox setup"]}},"/v1/saved-replies/{id}":{"patch":{"summary":"Update a saved reply","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"shortcut":{"type":"string"},"title":{"type":"string"},"body":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"shortcut":{"type":"string","description":"Lowercase a-z 0-9 - _, unique per workspace; typed as /shortcut in the inbox"},"title":{"type":"string"},"body":{"type":"string","description":"{{name}} = visitor's first name, {{agent}} = the member's; filled on insert"},"updatedAt":{"type":"string","format":"date-time"}}}}}},"404":{"description":"Not found / not yours"},"409":{"description":"Shortcut already exists"}},"tags":["Inbox setup"]},"delete":{"summary":"Delete a saved reply","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Deleted"},"404":{"description":"Not found / not yours"}},"tags":["Inbox setup"]}},"/v1/teams":{"get":{"summary":"List teams","description":"Teams are the queues a hand-over to a person lands in. Attach them to an agent with `humanSupport.teamIds` (first = default): the AI picks the team from the conversation; the team's hours apply (then its backup team's); the least-busy online member under `maxChatsPerPerson` gets the chat, otherwise the visitor waits in line and is told their place. Workspace keys only.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","description":"Unique per workspace"},"description":{"type":"string","nullable":true,"description":"What this team handles; the AI reads it to choose the team"},"hours":{"type":"object","nullable":true,"description":"Business hours; null = always open. {timezone IANA, days {mon..sun: {open HH:MM, close HH:MM} | null}}"},"maxChatsPerPerson":{"type":"integer","minimum":1,"maximum":200,"description":"Chats each member holds at once; beyond it new hand-overs wait in line"},"backupTeamId":{"type":"string","format":"uuid","nullable":true,"description":"Takes over while this team is closed (one hop)"},"offlineMessage":{"type":"string","nullable":true,"description":"Shown when this team and its backup are closed"},"members":{"type":"array","items":{"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"image":{"type":"string","nullable":true}}}},"updatedAt":{"type":"string","format":"date-time"}}}}}}}},"tags":["Inbox setup"]},"post":{"summary":"Create a team","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"hours":{"type":"object","nullable":true},"maxChatsPerPerson":{"type":"integer","minimum":1,"maximum":200,"default":20},"backupTeamId":{"type":"string","format":"uuid","nullable":true},"offlineMessage":{"type":"string","nullable":true},"memberUserIds":{"type":"array","items":{"type":"string"}}},"required":["name"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","description":"Unique per workspace"},"description":{"type":"string","nullable":true,"description":"What this team handles; the AI reads it to choose the team"},"hours":{"type":"object","nullable":true,"description":"Business hours; null = always open. {timezone IANA, days {mon..sun: {open HH:MM, close HH:MM} | null}}"},"maxChatsPerPerson":{"type":"integer","minimum":1,"maximum":200,"description":"Chats each member holds at once; beyond it new hand-overs wait in line"},"backupTeamId":{"type":"string","format":"uuid","nullable":true,"description":"Takes over while this team is closed (one hop)"},"offlineMessage":{"type":"string","nullable":true,"description":"Shown when this team and its backup are closed"},"members":{"type":"array","items":{"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"image":{"type":"string","nullable":true}}}},"updatedAt":{"type":"string","format":"date-time"}}}}}},"400":{"description":"Empty name, a backup team outside the workspace, a user who is not a member, or the 50-per-workspace limit"},"409":{"description":"A team with that name already exists"}},"tags":["Inbox setup"]}},"/v1/teams/{id}":{"patch":{"summary":"Update a team","description":"Any subset of the fields. Raising the cap serves the line at once.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"hours":{"type":"object","nullable":true},"maxChatsPerPerson":{"type":"integer","minimum":1,"maximum":200,"default":20},"backupTeamId":{"type":"string","format":"uuid","nullable":true},"offlineMessage":{"type":"string","nullable":true}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","description":"Unique per workspace"},"description":{"type":"string","nullable":true,"description":"What this team handles; the AI reads it to choose the team"},"hours":{"type":"object","nullable":true,"description":"Business hours; null = always open. {timezone IANA, days {mon..sun: {open HH:MM, close HH:MM} | null}}"},"maxChatsPerPerson":{"type":"integer","minimum":1,"maximum":200,"description":"Chats each member holds at once; beyond it new hand-overs wait in line"},"backupTeamId":{"type":"string","format":"uuid","nullable":true,"description":"Takes over while this team is closed (one hop)"},"offlineMessage":{"type":"string","nullable":true,"description":"Shown when this team and its backup are closed"},"members":{"type":"array","items":{"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"image":{"type":"string","nullable":true}}}},"updatedAt":{"type":"string","format":"date-time"}}}}}},"400":{"description":"Invalid field"},"404":{"description":"Not found / not yours"},"409":{"description":"A team with that name already exists"}},"tags":["Inbox setup"]},"delete":{"summary":"Delete a team","description":"Its waiting conversations fall back to the workspace-wide round-robin; agents stop listing it.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Deleted"},"404":{"description":"Not found / not yours"}},"tags":["Inbox setup"]}},"/v1/teams/{id}/members":{"put":{"summary":"Replace a team's members","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["userIds"],"properties":{"userIds":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","description":"Unique per workspace"},"description":{"type":"string","nullable":true,"description":"What this team handles; the AI reads it to choose the team"},"hours":{"type":"object","nullable":true,"description":"Business hours; null = always open. {timezone IANA, days {mon..sun: {open HH:MM, close HH:MM} | null}}"},"maxChatsPerPerson":{"type":"integer","minimum":1,"maximum":200,"description":"Chats each member holds at once; beyond it new hand-overs wait in line"},"backupTeamId":{"type":"string","format":"uuid","nullable":true,"description":"Takes over while this team is closed (one hop)"},"offlineMessage":{"type":"string","nullable":true,"description":"Shown when this team and its backup are closed"},"members":{"type":"array","items":{"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"image":{"type":"string","nullable":true}}}},"updatedAt":{"type":"string","format":"date-time"}}}}}},"400":{"description":"A user who is not a workspace member"},"404":{"description":"Not found / not yours"}},"tags":["Inbox setup"]}},"/v1/members":{"get":{"summary":"List workspace members","description":"People a conversation can be assigned to. Human support agents (role `agent`, inbox-only) are listed first.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"image":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","admin","member","agent"]},"availability":{"type":"string","enum":["available","away"],"description":"The member's own switch (list endpoint only)"},"online":{"type":"boolean","description":"Available AND the dashboard is open right now (list endpoint only)"}}}}}}}},"tags":["Members & invites"]}},"/v1/members/{userId}":{"patch":{"summary":"Change a member's role","description":"Admin or owner only, with the same rules as the Team page: you can change people below your own rank, to a role up to your own. The owner (see transfers), your own role and a partner's staff cannot be changed here. Dropping a member below admin revokes their API keys.","parameters":[{"name":"userId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["role"],"properties":{"role":{"type":"string","enum":["admin","member","agent"]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"changed":{"type":"boolean"},"from":{"type":"string"},"to":{"type":"string"}}}}}},"403":{"description":"Not an admin, or a product-scoped key"},"409":{"description":"Refused: the reason is in detail"}},"tags":["Members & invites"]}},"/v1/analytics/summary":{"get":{"summary":"Get totals","description":"Visits, conversations, messages, leads and rates for the range, read from the hourly rollups (refreshed every 5 minutes). `previous` is the same-length period before the range on Pro/Enterprise, null on Starter. Requires a plan with analytics.","parameters":[{"name":"range","in":"query","required":false,"schema":{"type":"string","enum":["24h","7d","30d","90d"],"default":"7d"}},{"name":"product_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"},"description":"Only this agent"},{"name":"tz","in":"query","required":false,"schema":{"type":"string"},"description":"IANA zone for day boundaries (default UTC)"}],"responses":{"200":{"description":"Totals","content":{"application/json":{"schema":{"type":"object","properties":{"range":{"type":"string"},"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"},"tz":{"type":"string"},"current":{"type":"object","description":"Counts for the range","properties":{"visits":{"type":"integer"},"opens":{"type":"integer"},"conversations":{"type":"integer"},"userMessages":{"type":"integer"},"assistantReplies":{"type":"integer"},"leads":{"type":"integer"},"blocked":{"type":"integer"},"toolCalls":{"type":"integer"},"latencyMs":{"type":"integer","nullable":true,"description":"Mean reply time in ms (Pro/Enterprise)"},"engagementRate":{"type":"number","nullable":true,"description":"Conversations per 100 visits"},"leadRate":{"type":"number","nullable":true,"description":"Leads per 100 conversations"}}},"previous":{"type":"object","description":"Counts for the range","properties":{"visits":{"type":"integer"},"opens":{"type":"integer"},"conversations":{"type":"integer"},"userMessages":{"type":"integer"},"assistantReplies":{"type":"integer"},"leads":{"type":"integer"},"blocked":{"type":"integer"},"toolCalls":{"type":"integer"},"latencyMs":{"type":"integer","nullable":true,"description":"Mean reply time in ms (Pro/Enterprise)"},"engagementRate":{"type":"number","nullable":true,"description":"Conversations per 100 visits"},"leadRate":{"type":"number","nullable":true,"description":"Leads per 100 conversations"}},"nullable":true}}}}}},"403":{"description":"analytics_not_in_plan, or a product-scoped key"}},"tags":["Analytics"]}},"/v1/analytics/timeseries":{"get":{"summary":"Get a time series","description":"One point per hour (24h) or per day (7d and up), day boundaries in `tz`. Each point carries the same counters as the summary.","parameters":[{"name":"range","in":"query","required":false,"schema":{"type":"string","enum":["24h","7d","30d","90d"],"default":"7d"}},{"name":"product_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"},"description":"Only this agent"},{"name":"tz","in":"query","required":false,"schema":{"type":"string"},"description":"IANA zone for day boundaries (default UTC)"},{"name":"granularity","in":"query","required":false,"schema":{"type":"string","enum":["hour","day"]}}],"responses":{"200":{"description":"Series","content":{"application/json":{"schema":{"type":"object","properties":{"range":{"type":"string"},"granularity":{"type":"string"},"tz":{"type":"string"},"points":{"type":"array","items":{"allOf":[{"type":"object","properties":{"t":{"type":"string","description":"Bucket start, local to tz"}}},{"type":"object","description":"Counts for the range","properties":{"visits":{"type":"integer"},"opens":{"type":"integer"},"conversations":{"type":"integer"},"userMessages":{"type":"integer"},"assistantReplies":{"type":"integer"},"leads":{"type":"integer"},"blocked":{"type":"integer"},"toolCalls":{"type":"integer"},"latencyMs":{"type":"integer","nullable":true,"description":"Mean reply time in ms (Pro/Enterprise)"},"engagementRate":{"type":"number","nullable":true,"description":"Conversations per 100 visits"},"leadRate":{"type":"number","nullable":true,"description":"Leads per 100 conversations"}}}]}}}}}}},"403":{"description":"analytics_not_in_plan, or a product-scoped key"}},"tags":["Analytics"]}},"/v1/analytics/geo":{"get":{"summary":"Get visitors by location","description":"Per-country totals and city points (coarse edge geolocation, city-centroid quality, lat/lon rounded to ~1 km). Days are UTC.","parameters":[{"name":"range","in":"query","required":false,"schema":{"type":"string","enum":["24h","7d","30d","90d"],"default":"7d"}},{"name":"product_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"},"description":"Only this agent"},{"name":"tz","in":"query","required":false,"schema":{"type":"string"},"description":"IANA zone for day boundaries (default UTC)"}],"responses":{"200":{"description":"Geo","content":{"application/json":{"schema":{"type":"object","properties":{"range":{"type":"string"},"countries":{"type":"array","items":{"type":"object","properties":{"country":{"type":"string","description":"ISO 3166-1 alpha-2, empty when unknown"},"visits":{"type":"integer"},"conversations":{"type":"integer"},"leads":{"type":"integer"}}}},"cities":{"type":"array","items":{"type":"object","properties":{"country":{"type":"string"},"city":{"type":"string"},"lat":{"type":"number"},"lon":{"type":"number"},"visits":{"type":"integer"},"conversations":{"type":"integer"},"leads":{"type":"integer"}}}}}}}}},"403":{"description":"analytics_not_in_plan, or a product-scoped key"}},"tags":["Analytics"]}},"/v1/analytics/breakdown":{"get":{"summary":"Get a breakdown","description":"Totals per channel (surface), country, device, browser or language. Device, browser and language need Pro/Enterprise.","parameters":[{"name":"range","in":"query","required":false,"schema":{"type":"string","enum":["24h","7d","30d","90d"],"default":"7d"}},{"name":"product_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"},"description":"Only this agent"},{"name":"tz","in":"query","required":false,"schema":{"type":"string"},"description":"IANA zone for day boundaries (default UTC)"},{"name":"dimension","in":"query","required":false,"schema":{"type":"string","enum":["surface","country","device","browser","language"],"default":"surface"}}],"responses":{"200":{"description":"Rows","content":{"application/json":{"schema":{"type":"object","properties":{"range":{"type":"string"},"dimension":{"type":"string"},"rows":{"type":"array","items":{"allOf":[{"type":"object","properties":{"value":{"type":"string"}}},{"type":"object","description":"Counts for the range","properties":{"visits":{"type":"integer"},"opens":{"type":"integer"},"conversations":{"type":"integer"},"userMessages":{"type":"integer"},"assistantReplies":{"type":"integer"},"leads":{"type":"integer"},"blocked":{"type":"integer"},"toolCalls":{"type":"integer"},"latencyMs":{"type":"integer","nullable":true,"description":"Mean reply time in ms (Pro/Enterprise)"},"engagementRate":{"type":"number","nullable":true,"description":"Conversations per 100 visits"},"leadRate":{"type":"number","nullable":true,"description":"Leads per 100 conversations"}}}]}}}}}}},"400":{"description":"invalid_dimension"},"403":{"description":"analytics_not_in_plan, advanced_plan_required, or a product-scoped key"}},"tags":["Analytics"]}},"/v1/analytics/leads":{"get":{"summary":"Get the lead funnel","description":"Visits → chat opened → conversations → leads, plus CRM delivery outcomes (delivered / stored / failed / pending) on Pro/Enterprise.","parameters":[{"name":"range","in":"query","required":false,"schema":{"type":"string","enum":["24h","7d","30d","90d"],"default":"7d"}},{"name":"product_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"},"description":"Only this agent"},{"name":"tz","in":"query","required":false,"schema":{"type":"string"},"description":"IANA zone for day boundaries (default UTC)"}],"responses":{"200":{"description":"Funnel","content":{"application/json":{"schema":{"type":"object","properties":{"range":{"type":"string"},"funnel":{"type":"object","properties":{"visits":{"type":"integer"},"opens":{"type":"integer"},"conversations":{"type":"integer"},"leads":{"type":"integer"},"delivered":{"type":"integer"},"stored":{"type":"integer"},"failed":{"type":"integer"},"pending":{"type":"integer"}}}}}}}},"403":{"description":"analytics_not_in_plan, or a product-scoped key"}},"tags":["Analytics"]}},"/v1/analytics/tools":{"get":{"summary":"Get tool usage","description":"Every tool your agents called in the range — calls per tool name, and on Pro/Enterprise the error count, mean duration and the tool's own billed cost (llm / browser / web-search tools). `mcpCalls` counts invocations of the same tool name on your published MCP servers.","parameters":[{"name":"range","in":"query","required":false,"schema":{"type":"string","enum":["24h","7d","30d","90d"],"default":"7d"}},{"name":"product_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"},"description":"Only this agent or MCP server"}],"responses":{"200":{"description":"Rows","content":{"application/json":{"schema":{"type":"object","properties":{"range":{"type":"string"},"tools":{"type":"array","items":{"type":"object","properties":{"tool":{"type":"string"},"calls":{"type":"integer"},"errors":{"type":"integer","nullable":true},"meanMs":{"type":"integer","nullable":true},"mcpCalls":{"type":"integer"},"mcpErrors":{"type":"integer","nullable":true},"mcpMeanMs":{"type":"integer","nullable":true},"costMicros":{"type":"integer","nullable":true,"description":"Micro-USD billed for the tool's own model/browser spend"}}}}}}}}},"403":{"description":"analytics_not_in_plan, or a product-scoped key"}},"tags":["Analytics"]}},"/v1/analytics/mcp":{"get":{"summary":"Get MCP server usage","description":"Tool invocations on each MCP server you publish, by external clients (Claude, Cursor, …): calls per server, and on Pro/Enterprise errors, mean duration and the per-tool split.","parameters":[{"name":"range","in":"query","required":false,"schema":{"type":"string","enum":["24h","7d","30d","90d"],"default":"7d"}},{"name":"product_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"},"description":"Only this MCP server"}],"responses":{"200":{"description":"Servers","content":{"application/json":{"schema":{"type":"object","properties":{"range":{"type":"string"},"servers":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string"},"slug":{"type":"string"},"calls":{"type":"integer"},"errors":{"type":"integer","nullable":true},"meanMs":{"type":"integer","nullable":true},"tools":{"type":"array","items":{"type":"object","properties":{"tool":{"type":"string"},"calls":{"type":"integer"},"errors":{"type":"integer"},"meanMs":{"type":"integer","nullable":true}}}}}}}}}}}},"403":{"description":"analytics_not_in_plan, or a product-scoped key"}},"tags":["Analytics"]}},"/v1/analytics/live":{"get":{"summary":"Get live visitors","description":"Browsers that pinged in the last ~2 minutes, with coarse location, surface, agent and whether they are chatting (a message in the last 5 minutes). Pro/Enterprise only. No IP, no identity — a per-browser id only.","parameters":[{"name":"product_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Presence","content":{"application/json":{"schema":{"type":"object","properties":{"online":{"type":"integer"},"active":{"type":"integer"},"asOf":{"type":"string","format":"date-time"},"visitors":{"type":"array","items":{"type":"object","properties":{"visitorId":{"type":"string"},"productId":{"type":"string"},"sessionId":{"type":"string","nullable":true},"surface":{"type":"string"},"country":{"type":"string","nullable":true},"region":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"lat":{"type":"number","nullable":true},"lon":{"type":"number","nullable":true},"device":{"type":"string","nullable":true},"browser":{"type":"string","nullable":true},"language":{"type":"string","nullable":true},"page":{"type":"string","nullable":true},"messages":{"type":"integer"},"firstSeenAt":{"type":"string"},"lastSeenAt":{"type":"string"},"lastMessageAt":{"type":"string","nullable":true},"active":{"type":"boolean"}}}}}}}}},"403":{"description":"analytics_not_in_plan, advanced_plan_required, or a product-scoped key"}},"tags":["Analytics"]}},"/v1/contacts":{"get":{"summary":"List contacts","description":"Signed-in people across the workspace's agents, most recently active first. Archived contacts are left out unless `archived=true`, which lists only them.","parameters":[{"name":"search","in":"query","required":false,"schema":{"type":"string"},"description":"Matches email or name"},{"name":"product_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"},"description":"Only this agent's contacts"},{"name":"archived","in":"query","required":false,"schema":{"type":"boolean","default":false},"description":"`true` = list the archived contacts instead"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"name":{"type":"string","nullable":true},"image":{"type":"string","nullable":true},"emailVerified":{"type":"boolean"},"firstSeen":{"type":"string","format":"date-time"},"lastActiveAt":{"type":"string","format":"date-time","nullable":true},"conversations":{"type":"integer"},"messages":{"type":"integer"},"agents":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string","format":"uuid"},"title":{"type":"string"}}},"description":"The agents this person signed in to."},"subscriptionStatus":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"device":{"type":"string","nullable":true},"archivedAt":{"type":"string","format":"date-time","nullable":true,"description":"When the team archived this contact; null = active."}}}}}}}}},"400":{"description":"Malformed product_id"},"403":{"description":"Workspace-scoped key required"}},"tags":["Contacts"]}},"/v1/contacts/{email}":{"get":{"summary":"Get a contact","description":"One contact's profile: the agents they use, their conversations and what the agents remember about them.","parameters":[{"name":"email","in":"path","required":true,"schema":{"type":"string"},"description":"URL-encoded email"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"name":{"type":"string","nullable":true},"image":{"type":"string","nullable":true},"emailVerified":{"type":"boolean"},"firstSeen":{"type":"string","format":"date-time"},"device":{"type":"object","nullable":true,"description":"The latest browser and location seen for this person."},"identities":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string","format":"uuid"},"productTitle":{"type":"string"},"subscriptionStatus":{"type":"string","nullable":true}}}},"conversations":{"type":"array","items":{"type":"object","properties":{"sessionId":{"type":"string","format":"uuid"},"productTitle":{"type":"string"},"name":{"type":"string","nullable":true},"lastMessageAt":{"type":"string","format":"date-time"},"messageCount":{"type":"integer"}}}},"memories":{"type":"array","items":{"type":"object","properties":{"productTitle":{"type":"string"},"content":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}},"description":"Facts the agents remember about this person."},"archivedAt":{"type":"string","format":"date-time","nullable":true,"description":"Set when every identity of this email is archived."}}}}}},"403":{"description":"Workspace-scoped key required"},"404":{"description":"No contact with that email in this workspace"}},"tags":["Contacts"]}},"/v1/contacts/archive":{"post":{"summary":"Archive contacts","description":"Hide contacts from the Contacts list, by email, across every agent in the workspace (up to 500 per call). They can still sign in where allowed, and their conversations stay in the Inbox. Archiving an archived contact changes nothing.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["emails"],"properties":{"emails":{"type":"array","items":{"type":"string"},"maxItems":500,"description":"Contacts' emails (case does not matter)"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"updated":{"type":"integer","description":"Identities changed (one email can have one per agent). 0 = nothing to change."}}}}}},"400":{"description":"emails_required or too_many_emails"},"403":{"description":"Workspace-scoped key required"}},"tags":["Contacts"]}},"/v1/contacts/restore":{"post":{"summary":"Restore contacts","description":"Bring archived contacts back to the Contacts list, by email (up to 500 per call).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["emails"],"properties":{"emails":{"type":"array","items":{"type":"string"},"maxItems":500,"description":"Contacts' emails (case does not matter)"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"updated":{"type":"integer","description":"Identities changed (one email can have one per agent). 0 = nothing to change."}}}}}},"400":{"description":"emails_required or too_many_emails"},"403":{"description":"Workspace-scoped key required"}},"tags":["Contacts"]}},"/v1/leads":{"get":{"summary":"List leads","description":"Every lead your agents captured, newest first — **whether or not a CRM is connected**. Leads with no CRM destination come back with `status: \"stored\"` and are yours to pull from here; that is the supported way to run lead capture without an integration.\n\nThis is an outbox, not a pipeline: there is no stage, owner or value, and no way to edit a lead through the API. Work them in your CRM or your own system.","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["stored","pending","delivered","failed"]}},{"name":"product_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"},"description":"Only this agent's leads"},{"name":"search","in":"query","required":false,"schema":{"type":"string"},"description":"Matches name, email or phone"},{"name":"in_crm","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true` = only leads that reached a CRM; `false` = everything that has not (stored, pending or failed)."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"maximum":200}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Pass the previous page's nextCursor to fetch the next page"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"email":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"fields":{"type":"object","additionalProperties":{"type":"string"},"description":"Answers to the tool's extra questions."},"status":{"type":"string","enum":["stored","pending","delivered","failed"],"description":"`stored` = kept here, no CRM was the destination (a terminal, healthy state). `pending` = delivery in flight. `delivered` = written to the CRM. `failed` = we stopped retrying; the lead is still here."},"provider":{"type":"string","nullable":true,"description":"CRM it was destined for, or null when it is kept in SuperCognit."},"externalUrl":{"type":"string","nullable":true,"description":"Deep link into the CRM record, once delivered."},"externalId":{"type":"string","nullable":true},"matchedExistingContact":{"type":"boolean","nullable":true},"lastError":{"type":"string","nullable":true},"attempts":{"type":"integer"},"agentTitle":{"type":"string","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"sessionId":{"type":"string","format":"uuid","nullable":true,"description":"The conversation it came out of."},"consent":{"type":"boolean","nullable":true,"description":"Whether the person agreed their details could be shared."},"sourceUrl":{"type":"string","nullable":true},"deliveredAt":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"}}}},"nextCursor":{"type":"string","nullable":true}}}}}},"400":{"description":"Malformed product_id or unknown status"},"403":{"description":"Workspace-scoped key required"}},"tags":["Leads"]}},"/v1/leads/{id}":{"get":{"summary":"Get a lead","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"email":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"fields":{"type":"object","additionalProperties":{"type":"string"},"description":"Answers to the tool's extra questions."},"status":{"type":"string","enum":["stored","pending","delivered","failed"],"description":"`stored` = kept here, no CRM was the destination (a terminal, healthy state). `pending` = delivery in flight. `delivered` = written to the CRM. `failed` = we stopped retrying; the lead is still here."},"provider":{"type":"string","nullable":true,"description":"CRM it was destined for, or null when it is kept in SuperCognit."},"externalUrl":{"type":"string","nullable":true,"description":"Deep link into the CRM record, once delivered."},"externalId":{"type":"string","nullable":true},"matchedExistingContact":{"type":"boolean","nullable":true},"lastError":{"type":"string","nullable":true},"attempts":{"type":"integer"},"agentTitle":{"type":"string","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"sessionId":{"type":"string","format":"uuid","nullable":true,"description":"The conversation it came out of."},"consent":{"type":"boolean","nullable":true,"description":"Whether the person agreed their details could be shared."},"sourceUrl":{"type":"string","nullable":true},"deliveredAt":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"}}}}}},"403":{"description":"Workspace-scoped key required"},"404":{"description":"Not found / not yours"}},"tags":["Leads"]}},"/v1/leads/{id}/retry":{"post":{"summary":"Retry CRM delivery","description":"For a lead the CRM rejected (`failed`), or one captured before a CRM was connected (`stored`). An already-delivered lead is a 409 rather than a second CRM record.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Delivered"},"403":{"description":"Workspace-scoped key required"},"404":{"description":"Not found / not yours"},"409":{"description":"Already delivered, no CRM connected, or the CRM rejected it again — see `detail`"}},"tags":["Leads"]}},"/v1/webhooks":{"get":{"summary":"List webhook endpoints","description":"The signing secret is never returned — it is shown once at creation.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string","enum":["conversation.created","message.created","message.completed","lead.captured","lead.delivered","lead.failed","payment.requested","payment.completed","payment.refunded","payment.expired","subscription.created","subscription.canceled","channel.connected","channel.disconnected","integration.connected","integration.disconnected","knowledge.source.ready","knowledge.source.failed","product.published","product.unpublished","browser_task.completed","conversation.handoff_requested","conversation.assigned","conversation.resolved","conversation.team_replied"]},"description":"Subscribed events. An EMPTY array subscribes to all events."},"enabled":{"type":"boolean"},"consecutiveFailures":{"type":"integer"},"disabledAt":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"}}}}}}},"403":{"description":"Product-scoped keys cannot manage webhooks"}},"tags":["Webhooks"]},"post":{"summary":"Create a webhook endpoint","description":"Max 10 endpoints per workspace. The URL must be public https (SSRF-guarded). The response contains the signing `secret` (whsec_…) exactly once — store it; it cannot be retrieved again.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","description":"Public https receiver URL"},"events":{"type":"array","items":{"type":"string","enum":["conversation.created","message.created","message.completed","lead.captured","lead.delivered","lead.failed","payment.requested","payment.completed","payment.refunded","payment.expired","subscription.created","subscription.canceled","channel.connected","channel.disconnected","integration.connected","integration.disconnected","knowledge.source.ready","knowledge.source.failed","product.published","product.unpublished","browser_task.completed","conversation.handoff_requested","conversation.assigned","conversation.resolved","conversation.team_replied"]},"description":"Events to subscribe to. Empty/omitted = all events."}}}}}},"responses":{"201":{"description":"Created — includes the one-time signing secret","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"secret":{"type":"string","example":"whsec_…"}}}}}},"400":{"description":"Invalid URL / unknown event / endpoint limit reached"},"403":{"description":"Product-scoped keys cannot manage webhooks"}},"tags":["Webhooks"]}},"/v1/webhooks/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"patch":{"summary":"Update a webhook endpoint","description":"Setting enabled=true resets the consecutive-failure counter (used after an auto-disable).","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"}}}}}},"responses":{"200":{"description":"OK"},"400":{"description":"Invalid patch"},"403":{"description":"Product-scoped key"},"404":{"description":"Not found"}},"tags":["Webhooks"]},"delete":{"summary":"Delete a webhook endpoint","description":"Its delivery log is deleted with it.","responses":{"200":{"description":"OK"},"403":{"description":"Product-scoped key"}},"tags":["Webhooks"]}},"/v1/webhooks/{id}/deliveries":{"get":{"summary":"List an endpoint's deliveries","description":"Newest first. Unknown/foreign endpoints return an empty array.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"maximum":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"event":{"type":"string"},"payload":{"type":"object","description":"The exact JSON body that was (or will be) POSTed"},"status":{"type":"integer","nullable":true,"description":"HTTP status of the last attempt; null = network failure"},"error":{"type":"string","nullable":true},"attempt":{"type":"integer","description":"Attempts made so far (max 5)"},"nextAttemptAt":{"type":"string","format":"date-time"},"succeededAt":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"}}}}}}},"403":{"description":"Product-scoped keys cannot read webhook deliveries"}},"tags":["Webhooks"]}}}}