{"openapi":"3.1.0","info":{"title":"Ody API","version":"2026-11-06","description":"The Ody REST API: contacts, conversations, SMS/MMS sending, call history,\nphone numbers (search, buy, route), 10DLC registration, outbound AI calls,\nAI agent configuration, Business AI Texting (the agent answers inbound texts),\nthe Knowledge hub (what your AI agents know), link tracking (tracked short links in every\noutbound text), and outbound webhooks for your workspace.\n\n**Agent Phone** — everything an AI agent provisions through this API (numbers,\n10DLC, calls) appears in the customer's account exactly as if they did it in the\napp: same billing, same gates, same timeline. A human can take over at any moment.\n\n**Authentication** — every request sends `Authorization: Bearer <key>`.\n`ody_live_…` keys are live; `ody_test_…` keys behave identically but message\nsends are **simulated** (recorded with deliveryStatus `simulated`, no SMS is sent).\n\n**Rate limits** — 600 requests/minute per key. Every response carries\n`RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`; a 429 adds `Retry-After`.\n\n**Idempotency** — send an `Idempotency-Key` header on `POST /messages`; retries\nwithin 24h replay the stored response (`Idempotency-Replayed: true`).\n\n**Request ids** — every response carries `X-Request-Id`; error bodies echo it.\n\n**Webhooks** — deliveries are signed per [Standard Webhooks](https://www.standardwebhooks.com):\nheaders `webhook-id`, `webhook-timestamp`, `webhook-signature` (`v1,<base64 HMAC-SHA256>`\nover `id.timestamp.body`, key = base64-decoded secret after `whsec_`).\n\n**MCP** — the same workspace is exposed as Model Context Protocol tools at\n`POST /v1/mcp` (Streamable HTTP) with the same keys and scopes."},"servers":[{"url":"https://api.ody.co","description":"Production"},{"url":"https://ody-api-rtvqk5tg2a-uc.a.run.app","description":"Production (direct Cloud Run URL)"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"Workspace API key (ody_live_… or ody_test_…) from Settings → Developer API."}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}},"ContactSummary":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"firstName":{"type":["string","null"]},"lastName":{"type":["string","null"]},"company":{"type":["string","null"]},"phone":{"type":["string","null"],"description":"First phone value, if any."},"createdAt":{"type":"string","format":"date-time"}}},"ContactDetail":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"firstName":{"type":["string","null"]},"lastName":{"type":["string","null"]},"company":{"type":["string","null"]},"phones":{"type":"array","items":{"type":"object","required":["value"],"properties":{"value":{"type":"string"},"label":{"type":"string"}}}},"emails":{"type":"array","items":{"type":"object","required":["value"],"properties":{"value":{"type":"string"},"label":{"type":"string"}}}},"notes":{"type":"array","items":{"type":"string"}},"properties":{"type":"object","additionalProperties":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}},"source":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"jobTitle":{"type":["string","null"],"description":"Job title, e.g. \"Operations Manager\"."},"website":{"type":["string","null"],"description":"Personal or company website."},"secondaryPhone":{"type":["string","null"],"description":"A second number for this person, E.164. Not used for matching calls or texts — add it to `phones` for that."},"addressStreet":{"type":["string","null"],"description":"Street address."},"addressCity":{"type":["string","null"],"description":"City."},"addressState":{"type":["string","null"],"description":"State / region."},"addressPostalCode":{"type":["string","null"],"description":"Postal code."},"addressCountry":{"type":["string","null"],"description":"Country — ISO 3166-1 alpha-2 when known (\"US\"), otherwise free text."},"linkedinUrl":{"type":["string","null"],"description":"LinkedIn profile URL (https, linkedin.com)."},"profilePhotoUrl":{"type":["string","null"],"description":"Profile photo URL (https)."},"headline":{"type":["string","null"],"description":"Professional headline, e.g. \"COO at Brightline Logistics\"."},"companyDomain":{"type":["string","null"],"description":"Company domain, e.g. \"brightline.com\"."},"companyLinkedinUrl":{"type":["string","null"],"description":"Company LinkedIn page URL."},"phoneLineType":{"type":["string","null"],"enum":["mobile","landline","voip","toll_free","unknown",null],"description":"Line type of the primary number."},"phoneCarrier":{"type":["string","null"],"description":"Carrier of the primary number."},"callerIdName":{"type":["string","null"],"description":"Caller ID name (CNAM) as listed by the carrier — often a business or a city, not a person."},"aiNotes":{"type":["string","null"],"description":"Short notes Ody AI took from calls and texts, one per line (max 12). Editable."},"enrichmentStatus":{"type":"string","enum":["none","pending","enriched","partial","failed"],"readOnly":true,"description":"`enriched` = Ody AI found something about the person; `partial` = only about the number (line type, carrier); `pending`, `failed`, `none`."},"lastEnrichedAt":{"type":["string","null"],"format":"date-time","readOnly":true},"fieldSources":{"type":"object","readOnly":true,"description":"Who filled each field, keyed by field name (`firstName`, `company`, `email`, `jobTitle`…). Only fields that have a value are listed. Read-only: it is ignored on create/update. Ody AI never overwrites a field whose source is `user`, `import` or `api`.","additionalProperties":{"type":"object","required":["source","aiGenerated","updatedAt"],"properties":{"source":{"type":"string","enum":["user","import","api","ai_extract","blitz","telnyx_identity","telnyx_cnam"],"description":"`user` (typed in the app), `import`, `api` (this API or MCP) — or a machine source: `ai_extract` (said by the contact on a call or in a text), `blitz`, `telnyx_identity`, `telnyx_cnam` (number lookups)."},"aiGenerated":{"type":"boolean","description":"True for machine sources. Any write through the app or the API makes the field yours (`false`) for good."},"updatedAt":{"type":"string","format":"date-time"}}}}}},"ContactInput":{"type":"object","description":"At least one identity field is required on create: firstName, lastName, company, phone/phones, or email/emails.","properties":{"firstName":{"type":["string","null"]},"lastName":{"type":["string","null"]},"company":{"type":["string","null"]},"phone":{"type":"string","description":"Convenience scalar — merged into phones. E.164, e.g. +15125550123."},"email":{"type":"string","description":"Convenience scalar — merged into emails."},"phones":{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"object","required":["value"],"properties":{"value":{"type":"string"},"label":{"type":"string"}}}]},"description":"Full phone list; strings or {value,label} objects."},"emails":{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"object","required":["value"],"properties":{"value":{"type":"string"},"label":{"type":"string"}}}]}},"notes":{"type":"array","items":{"type":"string"}},"properties":{"type":"object","additionalProperties":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}},"jobTitle":{"type":["string","null"],"description":"Job title, e.g. \"Operations Manager\"."},"website":{"type":["string","null"],"description":"Personal or company website."},"secondaryPhone":{"type":["string","null"],"description":"A second number for this person, E.164. Not used for matching calls or texts — add it to `phones` for that."},"addressStreet":{"type":["string","null"],"description":"Street address."},"addressCity":{"type":["string","null"],"description":"City."},"addressState":{"type":["string","null"],"description":"State / region."},"addressPostalCode":{"type":["string","null"],"description":"Postal code."},"addressCountry":{"type":["string","null"],"description":"Country — ISO 3166-1 alpha-2 when known (\"US\"), otherwise free text."},"linkedinUrl":{"type":["string","null"],"description":"LinkedIn profile URL (https, linkedin.com)."},"profilePhotoUrl":{"type":["string","null"],"description":"Profile photo URL (https)."},"headline":{"type":["string","null"],"description":"Professional headline, e.g. \"COO at Brightline Logistics\"."},"companyDomain":{"type":["string","null"],"description":"Company domain, e.g. \"brightline.com\"."},"companyLinkedinUrl":{"type":["string","null"],"description":"Company LinkedIn page URL."},"phoneLineType":{"type":["string","null"],"enum":["mobile","landline","voip","toll_free","unknown",null],"description":"Line type of the primary number."},"phoneCarrier":{"type":["string","null"],"description":"Carrier of the primary number."},"callerIdName":{"type":["string","null"],"description":"Caller ID name (CNAM) as listed by the carrier — often a business or a city, not a person."},"aiNotes":{"type":["string","null"],"description":"Short notes Ody AI took from calls and texts, one per line (max 12). Editable."}}},"ConversationSummary":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"inboxId":{"type":"string","format":"uuid"},"numberE164":{"type":["string","null"],"description":"The Ody number the thread lives on."},"participants":{"type":"array","items":{"type":"string"}},"contactName":{"type":"string"},"status":{"type":"string","enum":["open","done"]},"assigneeUid":{"type":["string","null"]},"lastActivityAt":{"type":"string","format":"date-time"},"preview":{"type":["string","null"]},"unread":{"type":"integer"},"aiTexting":{"type":"object","description":"Business AI Texting state of this thread — returned by GET /v1/api/conversations/{id} only (lists stay lean). `available` = the line has a texting agent linked and that agent's texting is on; `paused` = a human took the thread over, the agent stays quiet until handed back (POST …/ai-texting); `pausedBy` = the member's uid, or `ai` when the agent handed off itself.","properties":{"available":{"type":"boolean"},"paused":{"type":"boolean"},"pausedBy":{"type":["string","null"]},"agentId":{"type":["string","null"],"format":"uuid"},"agentName":{"type":["string","null"]}}}}},"Activity":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","description":"message | call | voicemail | internal_note | system"},"direction":{"type":["string","null"],"enum":["inbound","outbound",null]},"authorUid":{"type":["string","null"]},"body":{"type":["string","null"]},"media":{"type":"array","items":{"type":"object","properties":{"url":{"type":["string","null"],"description":"Short-lived signed URL."},"contentType":{"type":"string","description":"Detected from the file's bytes, not the declared type."},"size":{"type":"integer"},"filename":{"type":"string"},"width":{"type":"integer","description":"Photos only."},"height":{"type":"integer","description":"Photos only."},"delivery":{"type":"string","enum":["mms","link"],"description":"Outbound only. `link` = delivered as a link rather than an MMS frame: a hosted page (`hostedUrl`; when Hosted files is on this is every attachment of every send) or a raw secure link (Hosted files off and the file is too big for MMS, or a non-US/CA recipient)."},"linkExpiresAt":{"type":"string","format":"date-time"},"linkRevokedAt":{"type":"string","format":"date-time"},"hostedUrl":{"type":"string","format":"uri","description":"The `https://link.ody.co/m/<token>` page this item is on (Hosted files, doc 54). Several items share one page."},"hostedMediaId":{"type":"string","format":"uuid","description":"Id of that page — matches `Activity.hostedMedia[].id` and the `media.opened` webhook."}}}},"hostedMedia":{"type":"array","description":"Present on outbound messages that carried a hosted page (Hosted files on; a gallery, a video, a PDF or an oversized file): one entry per page with its title, layout and what the recipient did with it.","items":{"$ref":"#/components/schemas/HostedMediaSummary"}},"mediaOpen":{"type":["object","null"],"description":"Only on synthesized `type: system` entries (`id` = `open:<hostedMediaId>`): the recipient opened a hosted page. `{hostedMediaId, title, layout, itemCount, openCount, viewedItems, saves, websiteClicks, lastOpenedAt, activityId}`."},"deliveryStatus":{"type":["string","null"],"description":"queued | sent | delivered | failed | received | simulated (test keys)"},"call":{"type":["object","null"],"description":"Call metadata: status, duration, transcript, …"},"aiTextingAgentId":{"type":"string","format":"uuid","description":"Present on outbound messages the texting agent sent on its own (Business AI Texting) — the agent's id. Absent on human-sent messages."},"aiTags":{"type":"array","items":{"type":"string"}},"callTranscript":{"type":["array","null"],"items":{"type":"object"}},"trackedLinks":{"type":"array","description":"Present on outbound messages when the workspace has link tracking on: the link.ody.co short links the text carries, with their original destination and click counters. `body` holds the text as sent (short links).","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string","description":"The short-link code (link.ody.co/<code>)."},"shortUrl":{"type":"string","format":"uri","description":"Absolute form (`https://link.ody.co/<code>`). The text body itself carries the scheme-less `link.ody.co/<code>` since 2026-11-07; match either when you look for it in `body`."},"originalUrl":{"type":"string","format":"uri","description":"The URL the sender typed."},"clickCount":{"type":"integer"},"uniqueClickCount":{"type":"integer"},"firstClickedAt":{"type":["string","null"],"format":"date-time"},"lastClickedAt":{"type":["string","null"],"format":"date-time"}}}},"createdAt":{"type":"string","format":"date-time"}}},"Webhook":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string"},"description":"Subscribed event types, or [\"*\"] for all."},"label":{"type":["string","null"]},"status":{"type":"string","enum":["enabled","disabled"]},"apiVersion":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"secret":{"type":"string","description":"whsec_… signing secret — returned ONLY by create and rotate. Store it; verify deliveries per Standard Webhooks."}}},"WorkspaceNumber":{"type":"object","properties":{"e164":{"type":"string"},"type":{"type":"string","description":"local | toll_free (toll-free lines bill the $10/mo toll-free add-on)"},"voiceMode":{"type":"string","description":"agent | app | voicemail | forward"},"agentId":{"type":["string","null"],"description":"The agent that answers this line's CALLS (voiceMode `agent`)."},"textingAgentId":{"type":["string","null"],"description":"The agent that answers this line's inbound TEXTS (Business AI Texting) — independent of `agentId`; set with PUT /v1/api/numbers/{e164}/texting. `null` = texts go to the team only."},"forwardTo":{"type":["string","null"]},"assignedUserId":{"type":["string","null"]},"status":{"type":"string"}}},"MessagingStatus":{"type":"object","description":"10DLC registration status — brand + campaign pipeline (doc 36).","properties":{"step":{"type":"string","enum":["none","profile_ready","brand_pending","brand_failed","brand_otp_pending","brand_ok","campaign_pending","campaign_active","campaign_failed"],"description":"`brand_otp_pending` (sole proprietors only): the brand is accepted but TCR is waiting for the one-time PIN texted to `business.mobilePhone` — submit it via POST /v1/api/messaging/otp/verify."},"canText":{"type":"boolean","description":"True once the campaign is carrier-approved."},"messagingProfileId":{"type":["string","null"]},"brand":{"type":["object","null"],"description":"Brand status, identityStatus, failureReasons; for sole proprietors also otpSentAt + otpMobileLast4."},"campaign":{"type":["object","null"],"description":"Campaign submission/carrier status."}}},"BusinessInput":{"type":"object","required":["displayName","email","vertical","street","city","state","postalCode"],"description":"Legal business identity for the TCR brand. Non-sole-proprietors also need companyName + ein; SOLE_PROPRIETOR needs firstName/lastName + mobilePhone (the owner's mobile — TCR texts a verification PIN to it). Phones accept +E.164 or 10-digit US.","properties":{"entityType":{"type":"string","enum":["PRIVATE_PROFIT","PUBLIC_PROFIT","NON_PROFIT","GOVERNMENT","SOLE_PROPRIETOR"],"description":"Default PRIVATE_PROFIT."},"displayName":{"type":"string"},"email":{"type":"string"},"vertical":{"type":"string","description":"TCR vertical, e.g. PROFESSIONAL, RETAIL, REAL_ESTATE."},"companyName":{"type":"string"},"ein":{"type":"string","description":"9-digit EIN (dash optional)."},"firstName":{"type":"string"},"lastName":{"type":"string"},"phone":{"type":"string","description":"Support phone, +E.164 (10-digit US accepted)."},"mobilePhone":{"type":"string","description":"Required for SOLE_PROPRIETOR: a mobile that can receive the TCR verification text."},"street":{"type":"string"},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"},"website":{"type":"string"},"country":{"type":"string","description":"ISO2, default US."}}},"CampaignInput":{"type":"object","description":"Optional 10DLC campaign config; sensible defaults are applied.","properties":{"useCase":{"type":"string","description":"Default MIXED."},"description":{"type":"string","description":"What the campaign is for (>= 40 chars). Built from the business name and use case when omitted."},"samples":{"type":"array","items":{"type":"string"},"maxItems":5},"optinMessage":{"type":"string"},"helpMessage":{"type":"string"},"messageFlow":{"type":"string","minLength":40,"maxLength":2048,"description":"How subscribers opt in. Describe ONE method concretely. Carriers reject flows that list several methods or reference a web form that does not exist."},"optIn":{"type":"object","description":"Structured opt-in answer for a website sign-up form (preferred). Ody composes messageFlow from it using Telnyx's digital opt-in template, so reviewers see the public URL, where the form is, the full consent wording and a screenshot link. Overrides messageFlow.","required":["method","url","location","formConfirmed"],"properties":{"method":{"type":"string","enum":["web_form"]},"url":{"type":"string","description":"Public https:// address of the page holding the SMS sign-up form."},"location":{"type":"string","description":"Where on that page the form is, e.g. 'the quote form at the bottom of the home page'."},"screenshotUrl":{"type":"string","description":"Optional public link to a screenshot of the form (required by carriers for pop-ups or login-gated forms)."},"formConfirmed":{"type":"boolean","description":"Must be true: your live form shows an unchecked, optional, standalone SMS consent checkbox with the required wording."}}},"optinKeywords":{"type":"string","description":"Keyword that opts a subscriber in (e.g. YES for a double opt-in). Default START."},"embeddedLink":{"type":"boolean"},"embeddedPhone":{"type":"boolean"}}},"Agent":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"greeting":{"type":["string","null"]},"tone":{"type":["string","null"]},"voice":{"type":["string","null"]},"language":{"type":["string","null"]},"instructions":{"type":["string","null"]},"status":{"type":"string","enum":["draft","published"]},"enabled":{"type":"boolean","description":"Master switch — off means the agent answers neither calls nor texts."},"textingEnabled":{"type":"boolean","description":"Business AI Texting: the agent may answer inbound texts on the lines linked to it (PUT /v1/api/numbers/{e164}/texting). Toggle with POST /v1/api/agents/{id}/texting. Needs no publish."},"recordCalls":{"type":"boolean","description":"AI call recording: the audio of every call this agent handles (inbound and outbound) is kept and attached to the call in the thread, next to the transcript. Toggle with POST /v1/api/agents/{id}/recording — enabling needs the Growth-plan call-recording feature. Needs no publish; applies from the next call."},"recordingConsent":{"type":"object","nullable":true,"description":"Who acknowledged the recording-consent note (some jurisdictions require every party on a call to be told it is recorded; the business must say so to callers) and when. Written once, the first time recording is turned on for this agent; never cleared by later on/off changes. `null` until then.","properties":{"acknowledgedAt":{"type":"string","format":"date-time"},"acknowledgedBy":{"type":"string","nullable":true,"description":"User id of the acknowledger."},"acknowledgedByName":{"type":"string","nullable":true,"description":"Their display name at the time."}}},"timezone":{"type":"string"},"businessHours":{"type":"object"},"inHoursAction":{"type":"string","enum":["agent","voicemail","app","forward"]},"offHoursAction":{"type":"string","enum":["agent","voicemail","app","forward"]},"jobs":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"instructions":{"type":"string"}}}},"primary":{"type":"boolean","description":"True for the workspace's first agent — what the singular `/v1/api/agent` routes address."},"createdAt":{"type":"string","format":"date-time"}}},"AgentWithReach":{"allOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"greeting":{"type":["string","null"]},"tone":{"type":["string","null"]},"voice":{"type":["string","null"]},"language":{"type":["string","null"]},"instructions":{"type":["string","null"]},"status":{"type":"string","enum":["draft","published"]},"enabled":{"type":"boolean","description":"Master switch — off means the agent answers neither calls nor texts."},"textingEnabled":{"type":"boolean","description":"Business AI Texting: the agent may answer inbound texts on the lines linked to it (PUT /v1/api/numbers/{e164}/texting). Toggle with POST /v1/api/agents/{id}/texting. Needs no publish."},"recordCalls":{"type":"boolean","description":"AI call recording: the audio of every call this agent handles (inbound and outbound) is kept and attached to the call in the thread, next to the transcript. Toggle with POST /v1/api/agents/{id}/recording — enabling needs the Growth-plan call-recording feature. Needs no publish; applies from the next call."},"recordingConsent":{"type":"object","nullable":true,"description":"Who acknowledged the recording-consent note (some jurisdictions require every party on a call to be told it is recorded; the business must say so to callers) and when. Written once, the first time recording is turned on for this agent; never cleared by later on/off changes. `null` until then.","properties":{"acknowledgedAt":{"type":"string","format":"date-time"},"acknowledgedBy":{"type":"string","nullable":true,"description":"User id of the acknowledger."},"acknowledgedByName":{"type":"string","nullable":true,"description":"Their display name at the time."}}},"timezone":{"type":"string"},"businessHours":{"type":"object"},"inHoursAction":{"type":"string","enum":["agent","voicemail","app","forward"]},"offHoursAction":{"type":"string","enum":["agent","voicemail","app","forward"]},"jobs":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"instructions":{"type":"string"}}}},"primary":{"type":"boolean","description":"True for the workspace's first agent — what the singular `/v1/api/agent` routes address."},"createdAt":{"type":"string","format":"date-time"}}},{"type":"object","properties":{"reach":{"type":"object","properties":{"numbers":{"type":"array","items":{"type":"string"},"description":"Lines whose inbound calls go straight to this agent."},"menuNumbers":{"type":"array","items":{"type":"object","properties":{"e164":{"type":"string"},"digit":{"type":"string"}}},"description":"Lines whose phone menu has a key for this agent (digit = the key path, e.g. \"2\" or \"13\")."},"flowNumbers":{"type":"array","items":{"type":"string"},"description":"Lines running a call flow whose Astra step uses this agent by default."},"textingNumbers":{"type":"array","items":{"type":"string"},"description":"Lines whose inbound TEXTS this agent answers (Business AI Texting). A separate link from the voice ones above."}}}}}]},"AgentLinks":{"type":"object","description":"Where an agent reaches: the lines that send it their calls and the lines that send it their texts.","properties":{"voiceNumbers":{"type":"array","items":{"type":"string"},"description":"Lines whose inbound calls go straight to this agent."},"textingNumbers":{"type":"array","items":{"type":"string"},"description":"Lines whose inbound texts this agent answers."}}},"AiTextingRun":{"type":"object","description":"One inbound text the texting agent looked at — whether it replied, skipped (and why) or failed. Newest first. Only `replied` runs cost credits.","properties":{"id":{"type":"string","format":"uuid"},"agentId":{"type":["string","null"],"format":"uuid"},"agentName":{"type":["string","null"]},"conversationId":{"type":["string","null"],"format":"uuid"},"inboundActivityId":{"type":["string","null"],"format":"uuid","description":"The customer's text that triggered the run."},"replyActivityId":{"type":["string","null"],"format":"uuid","description":"The agent's reply (status `replied`)."},"lineE164":{"type":["string","null"]},"contactE164":{"type":["string","null"]},"status":{"type":"string","enum":["replied","skipped","failed"]},"reason":{"type":["string","null"],"enum":["texting_off","agent_off","workspace_restricted","trial_locked","paused","empty_message","opt_out_keyword","superseded","rate_limited","no_credits","no_actor","not_configured","model_declined","model_unavailable","texting_not_enabled","send_failed","already_replied",null],"description":"Why no reply went out. `texting_off` no agent on the line · `agent_off` agent or its texting switch off · `texting_not_enabled` texting not live on the workspace yet (10DLC) · `paused` a human took the thread over · `superseded` / `already_replied` a teammate replied first · `opt_out_keyword` STOP/HELP/… · `rate_limited` 20 replies/hour cap · `no_credits` wallet empty · `model_declined` the agent chose to hand off without a reply."},"detail":{"type":["string","null"]},"groundingMode":{"type":["string","null"],"enum":["none","inline","vector","fulltext","truncated",null],"description":"How knowledge was retrieved for the reply."},"groundingSources":{"type":"array","items":{"type":"object"},"description":"Knowledge articles the reply drew on."},"handoff":{"type":"boolean","description":"True when the agent handed the thread to the team (the thread is paused for the agent from then on)."},"segments":{"type":["integer","null"],"description":"Carrier segments of the reply (status `replied`)."},"credits":{"type":["integer","null"],"description":"AI credits charged — 30 per segment (status `replied`)."},"createdAt":{"type":"string","format":"date-time"}}},"KnowledgeArticle":{"type":"object","description":"A knowledge article with its Markdown body.","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"kind":{"type":"string","enum":["text","url","file"],"description":"`text` = written; `url` = a website Ody read and organized."},"sourceUrl":{"type":["string","null"],"description":"Website articles: the address that was read."},"status":{"type":"string","enum":["ready","pending","embedded","failed"]},"pageCount":{"type":["integer","null"],"description":"Website articles: pages read into the document."},"fetchedAt":{"type":["string","null"],"format":"date-time"},"folderId":{"type":["string","null"],"format":"uuid"},"enabled":{"type":"boolean","description":"The article-level \"Available to AI\" switch."},"audience":{"type":"string","enum":["all","selected"],"description":"`all` = every AI consumer; `selected` = only `consumers`."},"consumers":{"type":"array","items":{"type":"string"},"description":"Consumer keys granted when audience is `selected`: `agent:<id>`, `texting` (AI texting on every number) or `texting:<e164>` (AI texting on one number)."},"chars":{"type":"integer","description":"Characters in the body."},"indexedAt":{"type":["string","null"],"format":"date-time","description":"When the search index last matched the body (null = not indexed yet)."},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"content":{"type":["string","null"],"description":"Markdown body (≤ 20,000 characters)."}}},"KnowledgeArticleSummary":{"type":"object","description":"A knowledge article without its body (list endpoints). Fetch one by id for `content`.","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"kind":{"type":"string","enum":["text","url","file"],"description":"`text` = written; `url` = a website Ody read and organized."},"sourceUrl":{"type":["string","null"],"description":"Website articles: the address that was read."},"status":{"type":"string","enum":["ready","pending","embedded","failed"]},"pageCount":{"type":["integer","null"],"description":"Website articles: pages read into the document."},"fetchedAt":{"type":["string","null"],"format":"date-time"},"folderId":{"type":["string","null"],"format":"uuid"},"enabled":{"type":"boolean","description":"The article-level \"Available to AI\" switch."},"audience":{"type":"string","enum":["all","selected"],"description":"`all` = every AI consumer; `selected` = only `consumers`."},"consumers":{"type":"array","items":{"type":"string"},"description":"Consumer keys granted when audience is `selected`: `agent:<id>`, `texting` (AI texting on every number) or `texting:<e164>` (AI texting on one number)."},"chars":{"type":"integer","description":"Characters in the body."},"indexedAt":{"type":["string","null"],"format":"date-time","description":"When the search index last matched the body (null = not indexed yet)."},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"KnowledgeArticleInput":{"type":"object","properties":{"title":{"type":"string","maxLength":120},"content":{"type":"string","maxLength":20000,"description":"Markdown body."},"folderId":{"type":["string","null"],"format":"uuid","description":"`null` moves the article to the top level."},"enabled":{"type":"boolean"},"audience":{"type":"string","enum":["all","selected"]},"consumers":{"type":"array","items":{"type":"string"},"description":"Required meaningfully when `audience` is `selected`."}}},"KnowledgeFolder":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"parentId":{"type":["string","null"],"format":"uuid","description":"`null` at the top level. Folders nest up to 3 deep."},"name":{"type":"string"},"description":{"type":["string","null"]},"audience":{"type":"string","enum":["all","selected"],"description":"Inherited downward: a `selected` folder admits only its `consumers` for everything inside."},"consumers":{"type":"array","items":{"type":"string"}},"position":{"type":"integer"},"articleCount":{"type":"integer","description":"Articles directly inside (not descendants)."},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"KnowledgeFolderInput":{"type":"object","properties":{"name":{"type":"string","maxLength":120},"description":{"type":["string","null"],"maxLength":500},"parentId":{"type":["string","null"],"format":"uuid"},"audience":{"type":"string","enum":["all","selected"]},"consumers":{"type":"array","items":{"type":"string"}},"position":{"type":"integer"}}},"KnowledgeConsumer":{"type":"object","description":"An AI that can be granted knowledge.","properties":{"key":{"type":"string","description":"`agent:<id>` for an AI agent (voice); `texting` for AI texting on every number (the inbox's AI suggested replies and the automated texting agent); `texting:<e164>` for AI texting on one of the workspace's numbers only. `replies` is a deprecated alias of `texting`, accepted on input."},"kind":{"type":"string","enum":["agent","texting"]},"name":{"type":"string"},"channel":{"type":"string","enum":["voice","text"]},"live":{"type":"boolean","description":"Agents only: published and enabled."},"numberE164":{"type":"string","description":"Texting on one number: the line. Absent for every-number texting."},"detail":{"type":"string","description":"Texting on one number: the inbox name, for pickers."}}},"KnowledgeSearchHit":{"type":"object","properties":{"articleId":{"type":"string","format":"uuid"},"title":{"type":"string"},"folderId":{"type":["string","null"],"format":"uuid"},"kind":{"type":"string"},"sourceUrl":{"type":["string","null"]},"chunkIndex":{"type":"integer"},"content":{"type":"string","description":"The matching passage."},"score":{"type":"number","description":"0–1, higher is better."}}},"LinkTrackingSettings":{"type":"object","description":"The workspace's link-tracking preference (Settings → Analytics in the app). On by default since 2026-11-07; `PATCH {enabled:false}` opts the workspace out. When `enabled`, every URL in an OUTBOUND text — sent by a teammate, the AI texting agent, Astra during a call, or this API — leaves as a `link.ody.co/<code>` short link that 302s to the original URL with `utmTemplate` appended; the stored message body is the text as sent (`Activity.trackedLinks` carries the originals). Human clicks are counted and fire `link.clicked`; previewers and scanners never count. Inbound texts are never rewritten.","properties":{"enabled":{"type":"boolean","description":"Rewrite links in outbound texts as tracked short links."},"showInThread":{"type":"boolean","description":"Show a '… clicked your link' entry in the conversation and move it to the top of the inbox on the first click (never an unread badge). Clicks are counted either way."},"utmTemplate":{"type":["string","null"],"description":"Query string appended to every destination, `k=v&k=v`, ≤ 512 chars. Placeholders: `{source}` (ody_text · ody_ai_text · ody_ai_call_text · ody_api), `{contactRef}` (anonymous contact id, never the phone number), `{workspaceRef}`, `{line}`, `{code}`. Parameters already on a link are never overwritten. `null` = the default template (see `defaults.utmTemplate`)."}},"required":["enabled","showInThread","utmTemplate"]},"LinkTrackingResponse":{"type":"object","properties":{"settings":{"$ref":"#/components/schemas/LinkTrackingSettings"},"defaults":{"type":"object","properties":{"utmTemplate":{"type":"string"}},"description":"What `utmTemplate: null` resolves to."},"baseUrl":{"type":"string","description":"Prefix of the short links this workspace's texts carry (`https://link.ody.co`)."},"placeholders":{"type":"array","items":{"type":"string"},"description":"Placeholders the template accepts."}}},"HostedMediaSummary":{"type":"object","description":"A hosted page (Hosted files, doc 54) attached to an outbound message, with the recipient's activity on it.","properties":{"id":{"type":"string","format":"uuid"},"url":{"type":["string","null"],"format":"uri","description":"Always null here — the token is not recoverable from its stored hash. Read `media[].hostedUrl` on the same activity."},"title":{"type":"string","description":"What the text said: `7 photos`, `1 video`, `contract.pdf`, `3 files`."},"layout":{"type":"string","enum":["gallery","single","mixed"]},"itemCount":{"type":"integer"},"openCount":{"type":"integer","description":"Human opens; previewers and scanners never count."},"uniqueOpenCount":{"type":"integer"},"firstOpenedAt":{"type":["string","null"],"format":"date-time"},"lastOpenedAt":{"type":["string","null"],"format":"date-time"},"viewedItems":{"type":"integer","description":"Distinct photos / files the recipient looked at."},"saves":{"type":"integer","description":"Downloads (when saving is allowed)."},"websiteClicks":{"type":"integer","description":"Taps on the page's Visit-website button (a tracked link, source `media_page`)."},"expiresAt":{"type":"string","format":"date-time"},"revokedAt":{"type":["string","null"],"format":"date-time"},"activityId":{"type":["string","null"],"format":"uuid"}}},"HostedMediaSettings":{"type":"object","description":"Hosted files (Settings → Analytics → Hosted files in the app). On by default since 2026-11-07. When `enabled`, EVERY attachment of a text — one photo, one PDF, a gallery, a video — is delivered as a branded `link.ody.co/m/<token>` page (never as an MMS frame; there is no per-send choice) — the business's name, logo, accent and a tracked Visit-website button, Ody only as a footer wordmark — and the recipient's opens, photo views and saves surface in the thread, in Analytics → Files and as `media.opened` / `media.downloaded` webhooks. `enabled: false` is exactly the old behaviour: MMS when it fits, a raw `api.ody.co/m/<token>` link per oversized file, no page, no events.","properties":{"enabled":{"type":"boolean","description":"Send every attachment as a hosted page. `false` = plain picture messages / raw links, nothing tracked."},"displayName":{"type":["string","null"],"description":"Business name on the page; null = the workspace name. ≤ 60 chars."},"logoKey":{"type":["string","null"],"description":"Storage key of the uploaded logo (upload it in the app); null = none."},"accent":{"type":["string","null"],"description":"`#rrggbb`; null = Ody neutral."},"websiteUrl":{"type":["string","null"],"format":"uri","description":"`https://` only. Shows a Visit-website button that is a tracked link (`utm_medium=hosted_media`)."},"expiryDays":{"type":"integer","enum":[7,30,90,0],"description":"How long a page stays open; 0 (the default) = while the conversation exists."},"allowSave":{"type":"object","properties":{"photos":{"type":"boolean"},"documents":{"type":"boolean"},"video":{"type":"boolean"}},"description":"Whether the page offers a Save button per kind. Default photos + documents on, video off."},"trackOpens":{"type":"boolean","description":"Record opens / views / saves and show them in the thread."}},"required":["enabled","displayName","logoKey","accent","websiteUrl","expiryDays","allowSave","trackOpens"]},"HostedMediaResponse":{"type":"object","properties":{"settings":{"$ref":"#/components/schemas/HostedMediaSettings"},"baseUrl":{"type":"string","description":"Prefix of the pages this workspace's texts carry (`https://link.ody.co/m`)."}}},"ContactFieldSource":{"type":"object","required":["source","aiGenerated","updatedAt"],"properties":{"source":{"type":"string","enum":["user","import","api","ai_extract","blitz","telnyx_identity","telnyx_cnam"],"description":"`user` (typed in the app), `import`, `api` (this API or MCP) — or a machine source: `ai_extract` (said by the contact on a call or in a text), `blitz`, `telnyx_identity`, `telnyx_cnam` (number lookups)."},"aiGenerated":{"type":"boolean","description":"True for machine sources. Any write through the app or the API makes the field yours (`false`) for good."},"updatedAt":{"type":"string","format":"date-time"}}}}},"paths":{"/v1/api/contacts":{"get":{"summary":"List or search contacts","description":"Requires scope `contacts:read`. Newest first; `q` runs full-text search.","parameters":[{"name":"q","in":"query","schema":{"type":"string"},"description":"Full-text search query."},{"name":"limit","in":"query","description":"Page size (1–200, default 50).","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},{"name":"cursor","in":"query","description":"Opaque page cursor — pass the previous response's nextCursor.","schema":{"type":"string"}}],"responses":{"200":{"description":"A page of contacts","content":{"application/json":{"schema":{"type":"object","properties":{"contacts":{"type":"array","items":{"$ref":"#/components/schemas/ContactSummary"}},"nextCursor":{"type":["string","null"]}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}},"post":{"summary":"Create a contact","description":"Requires scope `contacts:write`. A phone that matches an unnamed auto-created contact adopts it (threads keep their history).","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"contact":{"$ref":"#/components/schemas/ContactDetail"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/contacts/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"Get a contact","description":"Requires scope `contacts:read`.","responses":{"200":{"description":"The contact","content":{"application/json":{"schema":{"type":"object","properties":{"contact":{"$ref":"#/components/schemas/ContactDetail"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}},"patch":{"summary":"Update a contact","description":"Requires scope `contacts:write`. Only provided fields change; phones/emails/notes/properties/tags are replaced wholesale when supplied.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactInput"}}}},"responses":{"200":{"description":"The updated contact","content":{"application/json":{"schema":{"type":"object","properties":{"contact":{"$ref":"#/components/schemas/ContactDetail"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}},"delete":{"summary":"Delete a contact","description":"Requires scope `contacts:write`.","responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/conversations":{"get":{"summary":"List conversations","description":"Requires scope `conversations:read`. Newest activity first.","parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["open","done"]}},{"name":"limit","in":"query","description":"Page size (1–100, default 50).","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"cursor","in":"query","description":"Opaque page cursor — pass the previous response's nextCursor.","schema":{"type":"string"}}],"responses":{"200":{"description":"A page of conversations","content":{"application/json":{"schema":{"type":"object","properties":{"conversations":{"type":"array","items":{"$ref":"#/components/schemas/ConversationSummary"}},"nextCursor":{"type":["string","null"]}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/conversations/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"Get a conversation thread","description":"Requires scope `conversations:read`. Full activity timeline (messages, calls, voicemails with transcripts + signed media URLs).","responses":{"200":{"description":"Conversation + activities (oldest → newest)","content":{"application/json":{"schema":{"type":"object","properties":{"conversation":{"$ref":"#/components/schemas/ConversationSummary"},"activities":{"type":"array","items":{"$ref":"#/components/schemas/Activity"}}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}},"patch":{"summary":"Update a conversation (status)","description":"Requires scope `conversations:write`. Set `status` to `open` or `done`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["open","done"]}}}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"type":"object","properties":{"conversation":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"}}}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/conversations/{id}/ai-texting":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"post":{"summary":"Take a thread over from the texting agent, or hand it back","description":"Requires scope `conversations:write`. Business AI Texting: `paused: true` makes the agent stay quiet in THIS conversation (every other thread keeps working) until `paused: false` hands it back — even if the customer texts again days later. The thread's current state is `conversation.aiTexting` on GET /v1/api/conversations/{id}. Replying with POST /v1/api/messages does NOT pause the agent by itself; pause first when a human takes over.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["paused"],"properties":{"paused":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"conversation":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"aiTextingPaused":{"type":"boolean"}}}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/conversations/{id}/ai-texting/runs":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"What the texting agent did in a thread","description":"Requires scope `conversations:read`. Every inbound text the agent looked at in this conversation — replied, skipped (with the reason) or failed — newest first. Use it to answer \"why didn't the AI reply?\". Empty for conversations on lines without a texting agent.","parameters":[{"name":"limit","in":"query","description":"Page size (1–100, default 20).","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Runs, newest first","content":{"application/json":{"schema":{"type":"object","properties":{"runs":{"type":"array","items":{"$ref":"#/components/schemas/AiTextingRun"}}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/messages":{"post":{"summary":"Send an SMS/MMS","description":"Requires scope `messages:send`. Provide `conversationId` OR `to` (E.164; the conversation is created from your workspace number, honoring `from` when you own it). Supports the `Idempotency-Key` header. Test keys (`ody_test_…`) record the message with deliveryStatus `simulated` and never send a real SMS.","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","maxLength":200},"description":"Retries with the same key within 24h replay the first response."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["body"],"properties":{"body":{"type":"string"},"conversationId":{"type":"string","format":"uuid"},"to":{"type":"string","description":"Recipient in E.164, e.g. +15125550123."},"from":{"type":"string","description":"One of your workspace numbers (optional)."},"mediaUrls":{"type":"array","items":{"type":"string","format":"uri"},"maxItems":10,"description":"Publicly fetchable https:// media URLs. With Hosted files on (the default) every attachment is delivered as one `link.ody.co/m/<token>` page (see `Activity.hostedMedia`). With Hosted files off they ride as MMS (US/CA only — keep the whole message under ~1 MB from a local number, 600 KB from toll-free) or as a raw secure link when they don't fit."}}}}}},"responses":{"201":{"description":"Sent (or simulated for test keys)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"$ref":"#/components/schemas/Activity"},"conversationId":{"type":"string"},"simulated":{"type":"boolean"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"409":{"description":"Workspace has no active number / texting not enabled (10DLC)","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/messages/search":{"get":{"summary":"Search messages","description":"Requires scope `conversations:read`. Case-insensitive substring search across message bodies and stored transcripts, newest first.","parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"Page size (1–100, default 25).","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}],"responses":{"200":{"description":"Matches","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object","properties":{"activityId":{"type":"string"},"conversationId":{"type":"string"},"type":{"type":"string"},"direction":{"type":["string","null"]},"body":{"type":["string","null"]},"participants":{"type":"array","items":{"type":"string"}},"numberE164":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"}}}}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/calls":{"get":{"summary":"List call & voicemail history","description":"Requires scope `conversations:read`. Newest first, flattened across conversations.","parameters":[{"name":"limit","in":"query","description":"Page size (1–200, default 50).","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}}],"responses":{"200":{"description":"Call history","content":{"application/json":{"schema":{"type":"object","properties":{"calls":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"conversationId":{"type":"string"},"type":{"type":"string","enum":["call","voicemail"]},"direction":{"type":"string","enum":["inbound","outbound"]},"status":{"type":["string","null"]},"durationSec":{"type":["integer","null"]},"externalE164":{"type":"string"},"contactName":{"type":["string","null"]},"forwardedTo":{"type":["string","null"]},"callerName":{"type":["string","null"]},"lineE164":{"type":["string","null"],"description":"Your workspace number on this call — the line that rang (inbound) or the caller ID used (outbound)."},"createdAt":{"type":"string","format":"date-time"}}}}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}},"post":{"summary":"Place an outbound AI call","description":"Requires scope `calls:place`. The workspace's PUBLISHED AI agent dials `to` from one of your numbers (default: the agent-connected line), converses, and the finished call lands on the contact's timeline with AI credits billed — exactly like an inbound AI-answered call (100 credits, <15s free). Test keys (`ody_test_…`) simulate — nothing is dialed.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["to"],"properties":{"to":{"type":"string","description":"Destination in E.164, e.g. +15125550123."},"from":{"type":"string","description":"Optional caller ID — one of your active numbers."},"agentId":{"type":"string","format":"uuid","description":"Which AI agent speaks (GET /v1/api/agents). Default: the primary agent."}}}}}},"responses":{"201":{"description":"Call queued (or simulated for test keys)","content":{"application/json":{"schema":{"type":"object","properties":{"call":{"type":"object","properties":{"id":{"type":["string","null"],"description":"Telnyx call sid."},"to":{"type":"string"},"from":{"type":"string"},"status":{"type":"string"}}},"simulated":{"type":"boolean"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"409":{"description":"No plan / agent not published / no active number / intl not enabled","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/numbers":{"get":{"summary":"List workspace phone numbers","description":"Requires scope `numbers:read`.","responses":{"200":{"description":"Numbers","content":{"application/json":{"schema":{"type":"object","properties":{"numbers":{"type":"array","items":{"$ref":"#/components/schemas/WorkspaceNumber"}}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}},"post":{"summary":"Buy a phone number","description":"Requires scope `numbers:manage`. Orders the number and bills the workspace's plan exactly like an in-app purchase: the plan includes 1 local number, further local numbers bill as the $5/mo additional-number add-on, and a toll-free (+1 8xx) number is always the $10/mo toll-free add-on. The billed type is derived from the number itself; `type` is only a hint. Toll-free numbers are calling-only (no texting yet). Same hard gates as the app: the workspace must have a plan, (where required) a verified identity, and not be billed through the App Store when the purchase would add an add-on. Supports the `Idempotency-Key` header. Test keys (`ody_test_…`) simulate — no order, no charge.","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","maxLength":200},"description":"Retries with the same key within 24h replay the first response."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["phoneNumber"],"properties":{"phoneNumber":{"type":"string","description":"E.164 from /numbers/available."},"type":{"type":"string","enum":["local","toll_free"],"description":"Number type hint (default 'local'); the server derives the real type from the number."}}}}}},"responses":{"201":{"description":"Purchased (or simulated for test keys)","content":{"application/json":{"schema":{"type":"object","properties":{"number":{"$ref":"#/components/schemas/WorkspaceNumber"},"simulated":{"type":"boolean"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"409":{"description":"Billing-gated / identity-unverified workspace, or the number is gone","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/numbers/available":{"get":{"summary":"Search numbers available to buy","description":"Requires scope `numbers:manage`. Live carrier inventory with Ody's retail monthly price per type: local numbers are quoted at the $5/mo additional-number price (the first is included with the plan); toll-free numbers at the $10/mo toll-free add-on. `phone_number_type` in each result is Ody's classification (`local` | `toll_free`).","parameters":[{"name":"country","in":"query","schema":{"type":"string","default":"US"},"description":"ISO2 code."},{"name":"type","in":"query","schema":{"type":"string","enum":["local","toll_free"],"default":"local"},"description":"Number type: local (default) or toll_free (+1 8xx; $10/mo add-on, calling-only)."},{"name":"startsWith","in":"query","schema":{"type":"string"},"description":"Leading digits (area code) — local numbers only."},{"name":"contains","in":"query","schema":{"type":"string"},"description":"Digits anywhere."},{"name":"locality","in":"query","schema":{"type":"string"},"description":"City."},{"name":"state","in":"query","schema":{"type":"string"},"description":"State / region."},{"name":"limit","in":"query","description":"Page size (1–50, default 20).","schema":{"type":"integer","minimum":1,"maximum":50,"default":20}}],"responses":{"200":{"description":"Candidates","content":{"application/json":{"schema":{"type":"object","properties":{"available":{"type":"array","items":{"type":"object","properties":{"phone_number":{"type":"string"},"phone_number_type":{"type":"string","enum":["local","toll_free"],"description":"Ody's classification of the number."},"region_information":{"type":"array","items":{"type":"object"}},"cost_information":{"type":"object","properties":{"monthly_cost":{"type":"string"},"upfront_cost":{"type":"string"},"currency":{"type":"string"}}}}}}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/numbers/{e164}/connect":{"parameters":[{"name":"e164","in":"path","required":true,"schema":{"type":"string"}}],"post":{"summary":"Route a number's inbound calls to an AI agent","description":"Requires scope `agent:manage`. Default: the primary agent (PATCH /v1/api/agent first); pass `agentId` for another agent. To put a second agent behind a line that already has one, use POST /v1/api/agents/{id}/attach with mode `menu`.","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"agentId":{"type":"string","format":"uuid"}}}}}},"responses":{"200":{"description":"Connected","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"voiceMode":{"type":"string"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/numbers/{e164}/disconnect":{"parameters":[{"name":"e164","in":"path","required":true,"schema":{"type":"string"}}],"post":{"summary":"Route a number away from the AI agent","description":"Requires scope `agent:manage`. `mode` picks who answers instead: app (ring the team, default), voicemail, or forward (needs `forwardTo`).","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"mode":{"type":"string","enum":["app","voicemail","forward"],"default":"app"},"forwardTo":{"type":"string","description":"E.164 forward target (mode 'forward')."}}}}}},"responses":{"200":{"description":"Disconnected","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"voiceMode":{"type":"string"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/numbers/{e164}/texting":{"parameters":[{"name":"e164","in":"path","required":true,"schema":{"type":"string"}}],"put":{"summary":"Choose which agent answers a number's texts","description":"Requires scope `agent:manage`. Business AI Texting: link the line's inbound TEXTS to an agent (`agentId`) or turn it off for the line (`agentId: null`). Independent of the voice link — a line can ring the team for calls (POST …/disconnect) and still let an agent answer its texts. A line texts with at most one agent; linking another moves it. The response echoes the agent-side state so you can tell whether the link is live or merely wired: replies only go out when `agentEnabled`, `agentTextingEnabled` and `textingReady` (10DLC approved or toll-free) are all true.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["agentId"],"properties":{"agentId":{"type":["string","null"],"format":"uuid","description":"`null` = texts go to the team only."}}}}}},"responses":{"200":{"description":"Linked / unlinked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"e164":{"type":"string"},"textingAgentId":{"type":["string","null"],"format":"uuid"},"agentEnabled":{"type":"boolean","description":"Linked only: the agent's master switch."},"agentTextingEnabled":{"type":"boolean","description":"Linked only: the agent's AI texting switch (POST /v1/api/agents/{id}/texting)."},"textingReady":{"type":"boolean","description":"Outbound texting is live on the workspace (10DLC approved or toll-free)."}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/messaging":{"get":{"summary":"10DLC registration status","description":"Requires scope `numbers:manage`. Where the workspace is in the brand → campaign pipeline and whether outbound texting is unlocked.","responses":{"200":{"description":"Status","content":{"application/json":{"schema":{"type":"object","properties":{"messaging":{"$ref":"#/components/schemas/MessagingStatus"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/messaging/registration":{"post":{"summary":"Submit 10DLC registration (brand + campaign)","description":"Requires scope `numbers:manage`. Files the workspace's brand with The Campaign Registry via Telnyx and stages the campaign; carrier review typically takes minutes-to-days. SUBMITTING IS A PURCHASE: a live filing ends a running free trial and charges the plan, plus the one-time $20 messaging setup fee per local number, to the card on file IMMEDIATELY — before the brand or campaign is accepted (never charged again for the same number on a resubmit). Because of that, a trialing workspace must send `acknowledge_trial_end: true`, otherwise 409 `failed_precondition`; if the card declines nothing is filed. The $4/mo messaging add-on starts when the registry accepts the campaign. The owner receives an emailed receipt with a masked copy of the application. Live filings also require a chargeable subscription — a workspace without a payment method on file, with a canceled subscription, or (while trialing) without a submitted identity check gets 409 `failed_precondition` (\"Add a payment method…\"). Every filing is audit-logged with actor 'api'. Test keys (`ody_test_…`) always file in mock mode — full pipeline, no TCR submission, no fee, no billing gate.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["business"],"properties":{"business":{"$ref":"#/components/schemas/BusinessInput"},"campaign":{"$ref":"#/components/schemas/CampaignInput"},"mock":{"type":"boolean","description":"Force Telnyx mock mode (no fee)."},"acknowledge_trial_end":{"type":"boolean","description":"Required (true) when the workspace is on a free trial: confirms the customer was told that filing ends the trial today and charges the plan plus the $20 per-number setup fee immediately."}}}}}},"responses":{"201":{"description":"Submitted","content":{"application/json":{"schema":{"type":"object","properties":{"messaging":{"$ref":"#/components/schemas/MessagingStatus"},"mock":{"type":"boolean"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"409":{"description":"Telnyx/TCR rejected the filing (message says why)","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/messaging/refresh":{"post":{"summary":"Re-check and advance 10DLC registration","description":"Requires scope `numbers:manage`. Polls Telnyx for brand/campaign status and advances the pipeline (creates the campaign once the brand is OK).","responses":{"200":{"description":"Refreshed status","content":{"application/json":{"schema":{"type":"object","properties":{"messaging":{"$ref":"#/components/schemas/MessagingStatus"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/messaging/otp/verify":{"post":{"summary":"Sole proprietor: submit the SMS verification PIN","description":"Requires scope `numbers:manage`. Only meaningful while `step` is `brand_otp_pending`. TCR texts a PIN to `business.mobilePhone` when a SOLE_PROPRIETOR brand is filed; a correct PIN verifies the brand and the campaign is created immediately (response step is usually `campaign_pending`). Codes expire after 24 hours.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["pin"],"properties":{"pin":{"type":"string"}}}}}},"responses":{"200":{"description":"Verified — pipeline advanced","content":{"application/json":{"schema":{"type":"object","properties":{"messaging":{"$ref":"#/components/schemas/MessagingStatus"}}}}}},"400":{"description":"Wrong or expired PIN (or missing `pin`)","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"409":{"description":"The registration isn't waiting for a PIN","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/messaging/otp/resend":{"post":{"summary":"Sole proprietor: text a fresh verification PIN","description":"Requires scope `numbers:manage`. Re-sends the TCR PIN to `business.mobilePhone`. Rate-limited to one send per minute (429).","responses":{"200":{"description":"Sent","content":{"application/json":{"schema":{"type":"object","properties":{"messaging":{"$ref":"#/components/schemas/MessagingStatus"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Asked again inside the one-minute cooldown window","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/agent":{"get":{"summary":"Get the AI agent config","description":"Requires scope `agent:manage`. The agent record (null until created) plus current-cycle AI credit usage.","responses":{"200":{"description":"Agent + credits","content":{"application/json":{"schema":{"type":"object","properties":{"agent":{"oneOf":[{"$ref":"#/components/schemas/Agent"},{"type":"null"}]},"credits":{"type":["object","null"],"properties":{"cycleId":{"type":"string"},"used":{"type":"integer"},"included":{"type":"integer"},"remaining":{"type":"integer"}}}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}},"patch":{"summary":"Create or update the AI agent (draft)","description":"Requires scope `agent:manage`. Only provided fields change; `jobs` is replaced wholesale. Publish with POST /v1/api/agent/publish to make changes live.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"greeting":{"type":"string"},"tone":{"type":"string"},"voice":{"type":"string"},"language":{"type":"string"},"timezone":{"type":"string","description":"IANA timezone."},"inHoursAction":{"type":"string","enum":["agent","voicemail","app","forward"]},"offHoursAction":{"type":"string","enum":["agent","voicemail","app","forward"]},"enabled":{"type":"boolean"},"jobs":{"type":"array","items":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"instructions":{"type":"string"}}}}}}}}},"responses":{"200":{"description":"Saved (draft)","content":{"application/json":{"schema":{"type":"object","properties":{"agent":{"$ref":"#/components/schemas/Agent"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/agent/publish":{"post":{"summary":"Publish the AI agent","description":"Requires scope `agent:manage`. Pushes the saved config live to telephony (creates/updates the voice assistant). Test keys simulate.","responses":{"200":{"description":"Published (or simulated for test keys)","content":{"application/json":{"schema":{"type":"object","properties":{"agent":{"$ref":"#/components/schemas/Agent"},"simulated":{"type":"boolean"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"409":{"description":"Config incomplete (message says what's missing)","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/agents":{"get":{"summary":"List every AI agent","description":"Requires scope `agent:manage`. Every agent of the workspace, oldest (primary) first, each with `reach` — the lines it answers and the phone-menu keys that lead to it — plus `limit`, the plan's agent allowance (Starter 1, Growth 3, Enterprise 10).","responses":{"200":{"description":"Agents + limit","content":{"application/json":{"schema":{"type":"object","properties":{"agents":{"type":"array","items":{"$ref":"#/components/schemas/AgentWithReach"}},"limit":{"type":"integer"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}},"post":{"summary":"Create another AI agent (draft)","description":"Requires scope `agent:manage`. Same body as PATCH /v1/api/agent (all optional; `name` recommended). 429 `resource_exhausted` when the plan's agent limit is reached. The new agent inherits every knowledge article whose audience is `all`; give it a line with POST /v1/api/agents/{id}/attach, then publish it.","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":60},"greeting":{"type":"string"},"tone":{"type":"string"},"voice":{"type":"string"},"language":{"type":"string"},"timezone":{"type":"string"},"jobs":{"type":"array","items":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"instructions":{"type":"string"}}}}}}}}},"responses":{"201":{"description":"Created (draft)","content":{"application/json":{"schema":{"type":"object","properties":{"agent":{"$ref":"#/components/schemas/Agent"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Plan agent limit reached (or rate limited)","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/agents/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"Get one AI agent","description":"Requires scope `agent:manage`.","responses":{"200":{"description":"The agent","content":{"application/json":{"schema":{"type":"object","properties":{"agent":{"$ref":"#/components/schemas/Agent"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}},"patch":{"summary":"Update one AI agent (draft)","description":"Requires scope `agent:manage`. Same body and semantics as PATCH /v1/api/agent, addressed by id.","responses":{"200":{"description":"Saved (draft)","content":{"application/json":{"schema":{"type":"object","properties":{"agent":{"$ref":"#/components/schemas/Agent"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}},"delete":{"summary":"Delete an AI agent","description":"Requires scope `agent:manage`. Never the last agent (409). Lines it answered go back to ringing the team (`voiceMode` app); phone-menu keys that led to it are removed (a menu left empty is turned off). Test keys simulate.","responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"detachedNumbers":{"type":"array","items":{"type":"string"}},"menusUpdated":{"type":"array","items":{"type":"string"}},"simulated":{"type":"boolean"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"409":{"description":"Last agent","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/agents/{id}/publish":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"post":{"summary":"Publish one AI agent","description":"Requires scope `agent:manage`. Same as POST /v1/api/agent/publish, addressed by id. Test keys simulate.","responses":{"200":{"description":"Published (or simulated)","content":{"application/json":{"schema":{"type":"object","properties":{"agent":{"$ref":"#/components/schemas/Agent"},"simulated":{"type":"boolean"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"409":{"description":"Config incomplete","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/agents/{id}/attach":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"post":{"summary":"Make an agent reachable on a line","description":"Requires scope `agent:manage`. `mode: number` — the line's inbound calls go to this agent (same as /numbers/{e164}/connect). `mode: menu` — the failover for a workspace with one line: the line becomes, or extends, a phone menu with a key for this agent; whatever answered before (another agent, the team, voicemail, a forward) keeps key 1 and the new agent takes the next free key (or `digit`). Needs the Growth plan's phone menus (403 otherwise). Lines running a call flow return 409 — give the flow's Astra step an `agentId` instead.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["e164","mode"],"properties":{"e164":{"type":"string"},"mode":{"type":"string","enum":["number","menu"]},"digit":{"type":"string","description":"Preferred key for mode `menu` (0–9)."}}}}}},"responses":{"200":{"description":"Attached","content":{"application/json":{"schema":{"type":"object","properties":{"mode":{"type":"string","enum":["number","menu"]},"e164":{"type":"string"},"digit":{"type":"string","description":"mode `menu`: the key the agent got."},"menuCreated":{"type":"boolean","description":"mode `menu`: true when the line had no menu before."},"menu":{"type":"object","description":"mode `menu`: the resulting phone menu."}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"409":{"description":"Already attached / flow line / menu full","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/agents/{id}/recording":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"post":{"summary":"Turn AI call recording on or off for an agent","description":"Requires scope `agent:manage`. When on, every call the agent handles — inbound calls it answers and outbound calls it places — is recorded (dual-channel: the caller on one track, the agent on the other) and the audio is attached to the call in the conversation thread next to the transcript and AI summary. Enabling requires the Growth-plan call-recording feature (403 `permission_denied` otherwise); disabling is always allowed. No publish is needed — the change applies from the next call. Independent of the per-number call-recording setting (Settings → Numbers in the app), which only covers calls a person answers.\n\n**Consent acknowledgement.** The first time recording is turned on for an agent the request must carry `acknowledgeConsent: true` — your acknowledgement that some jurisdictions require every party on a call to be told it is recorded and that it is the business's job to say so (for example in the agent's greeting; Ody plays no announcement automatically). Without it the call returns `409 failed_precondition` with `reason: \"consent_required\"`. The acknowledgement is stored once as `recordingConsent` (who, when) and never asked again for that agent.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["enabled"],"properties":{"enabled":{"type":"boolean"},"acknowledgeConsent":{"type":"boolean","description":"Required with `enabled: true` the first time for an agent (see above). Ignored afterwards."}}}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"type":"object","properties":{"agent":{"$ref":"#/components/schemas/Agent"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/agents/{id}/texting":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"Business AI Texting status for an agent","description":"Requires scope `agent:manage`. Everything about the agent's texting in one read: the agent-level switch (`enabled`), the master switch (`agentEnabled`), the lines linked for calls and for texts (`links`), whether texting is live on the workspace (`textingReady`), the derived `live` flag (all of the above true and at least one texting line), the price (`creditsPerSegment`, 30) and the most recent runs.","parameters":[{"name":"limit","in":"query","description":"Page size (1–100, default 20).","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Texting status","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean","description":"The agent may answer texts (its AI texting switch)."},"agentEnabled":{"type":"boolean","description":"The agent's master switch."},"links":{"$ref":"#/components/schemas/AgentLinks"},"textingReady":{"type":"boolean","description":"Outbound texting is live on the workspace (10DLC approved or toll-free)."},"live":{"type":"boolean","description":"`enabled && agentEnabled && textingReady && links.textingNumbers.length > 0` — the agent is answering texts right now."},"creditsPerSegment":{"type":"integer","description":"AI credits charged per carrier segment of a reply (30)."},"runs":{"type":"array","items":{"$ref":"#/components/schemas/AiTextingRun"}}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}},"post":{"summary":"Turn Business AI Texting on or off for an agent","description":"Requires scope `agent:manage`. Sets the agent-level switch; no publish is needed — replies are written server-side on every inbound text, so the change is immediate. Lines linked to the agent stay linked when you turn it off and resume when you turn it back on; pass `unlinkLines: true` with `enabled: false` to also clear every line's texting link (returned as `released`). The agent only answers once a line is linked (PUT /v1/api/numbers/{e164}/texting), its master switch is on and texting is live on the workspace.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["enabled"],"properties":{"enabled":{"type":"boolean"},"unlinkLines":{"type":"boolean","description":"With `enabled: false`: also clear the texting link on every line pointing at this agent."}}}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"type":"object","properties":{"agent":{"$ref":"#/components/schemas/Agent"},"links":{"$ref":"#/components/schemas/AgentLinks"},"textingReady":{"type":"boolean"},"released":{"type":"array","items":{"type":"string"},"description":"Lines whose texting link was cleared (`unlinkLines: true` only)."}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/link-tracking":{"get":{"summary":"Link tracking settings","description":"Requires scope `workspace:manage`. The workspace's link-tracking switches — the same three the app shows under Settings → Analytics — plus the default template, the short-link base URL and the placeholders the template accepts.","responses":{"200":{"description":"Current settings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkTrackingResponse"}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}},"patch":{"summary":"Turn link tracking on or off, show clicks in conversations, set the UTM template","description":"Requires scope `workspace:manage`. Only the fields you send change. Immediate — the next outbound text follows the new setting; texts already sent are unaffected either way (their short links keep working). Pass `utmTemplate: null` (or `\"\"`) to go back to the default; an invalid template is a 400 `invalid_argument` carrying the same sentence the app shows under the field. Sending no recognised field is also a 400.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"showInThread":{"type":"boolean"},"utmTemplate":{"type":["string","null"],"description":"`k=v&k=v` with placeholders; `null` resets to the default."}}}}}},"responses":{"200":{"description":"Updated settings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkTrackingResponse"}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/hosted-media":{"get":{"summary":"Hosted files settings","description":"Requires scope `workspace:manage`. The workspace's Hosted files settings — the same switches the app shows under Settings → Analytics → Hosted files — and the page base URL.","responses":{"200":{"description":"Current settings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HostedMediaResponse"}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}},"patch":{"summary":"Change Hosted files: on/off, branding, expiry, saving, open tracking","description":"Requires scope `workspace:manage`. Only the fields you send change; immediate for the next text sent (pages already sent keep their branding snapshot and keep working). `null` or `\"\"` clears `displayName`, `logoKey`, `accent`, `websiteUrl`. A bad value is a 400 `invalid_argument` carrying the sentence the app shows under the field (for example `The website must start with https://`). The logo itself is uploaded in the app; this endpoint only accepts a `logoKey` that came from that upload.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"displayName":{"type":["string","null"]},"logoKey":{"type":["string","null"]},"accent":{"type":["string","null"],"description":"`#rrggbb`"},"websiteUrl":{"type":["string","null"],"description":"`https://` URL"},"expiryDays":{"type":"integer","enum":[7,30,90,0]},"allowSave":{"type":"object","properties":{"photos":{"type":"boolean"},"documents":{"type":"boolean"},"video":{"type":"boolean"}}},"trackOpens":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Updated settings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HostedMediaResponse"}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/knowledge":{"get":{"summary":"Read the knowledge hub","description":"Requires scope `knowledge:read`. Folders, articles (without bodies) and the AI consumers that knowledge can be granted to. Every AI in the workspace — the voice agent(s) and the inbox's suggested replies — reads from this one hub; audience rules decide who sees what.","responses":{"200":{"description":"The hub","content":{"application/json":{"schema":{"type":"object","properties":{"folders":{"type":"array","items":{"$ref":"#/components/schemas/KnowledgeFolder"}},"articles":{"type":"array","items":{"$ref":"#/components/schemas/KnowledgeArticleSummary"}},"consumers":{"type":"array","items":{"$ref":"#/components/schemas/KnowledgeConsumer"}}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/knowledge/search":{"get":{"summary":"Search the knowledge base","description":"Requires scope `knowledge:read`. Returns the passages that best answer `q` — semantic (vector) search over every indexed article, full-text when the index is still building. Pass `consumer` to see exactly what one agent knows (audience rules applied).","parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string"}},{"name":"consumer","in":"query","schema":{"type":"string"},"description":"`agent:<id>`, `texting` or `texting:<e164>` — restrict to what that consumer may read."},{"name":"folderId","in":"query","schema":{"type":"string","format":"uuid"},"description":"Only this folder and its sub-folders."},{"name":"limit","in":"query","description":"Page size (1–20, default 6).","schema":{"type":"integer","minimum":1,"maximum":20,"default":6}}],"responses":{"200":{"description":"Hits, best first","content":{"application/json":{"schema":{"type":"object","properties":{"hits":{"type":"array","items":{"$ref":"#/components/schemas/KnowledgeSearchHit"}}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/knowledge/folders":{"post":{"summary":"Create a folder","description":"Requires scope `knowledge:write`. Folders nest up to 3 levels (`parentId`). A `selected` audience applies to everything inside.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":120},"description":{"type":["string","null"],"maxLength":500},"parentId":{"type":["string","null"],"format":"uuid"},"audience":{"type":"string","enum":["all","selected"]},"consumers":{"type":"array","items":{"type":"string"}},"position":{"type":"integer"}},"required":["name"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"folder":{"$ref":"#/components/schemas/KnowledgeFolder"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/knowledge/folders/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"patch":{"summary":"Update a folder","description":"Requires scope `knowledge:write`. Rename, move (`parentId`, `null` = top level), reorder, or change the audience. Setting `audience` to `all` clears `consumers`. Published agents are re-synced.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":120},"description":{"type":["string","null"],"maxLength":500},"parentId":{"type":["string","null"],"format":"uuid"},"audience":{"type":"string","enum":["all","selected"]},"consumers":{"type":"array","items":{"type":"string"}},"position":{"type":"integer"}}}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"type":"object","properties":{"folder":{"$ref":"#/components/schemas/KnowledgeFolder"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}},"delete":{"summary":"Delete a folder","description":"Requires scope `knowledge:write`. By default the folder's articles and sub-folders move up to its parent; pass `deleteContents=true` to delete everything inside.","parameters":[{"name":"deleteContents","in":"query","schema":{"type":"boolean","default":false}}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"},"movedArticles":{"type":"integer"},"deletedArticles":{"type":"integer"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/knowledge/articles":{"get":{"summary":"List articles","description":"Requires scope `knowledge:read`. Newest first, without bodies. Filter with `folderId`.","parameters":[{"name":"folderId","in":"query","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Articles","content":{"application/json":{"schema":{"type":"object","properties":{"articles":{"type":"array","items":{"$ref":"#/components/schemas/KnowledgeArticleSummary"}}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}},"post":{"summary":"Create a text article","description":"Requires scope `knowledge:write`. Writes a Markdown article (≤ 20,000 characters). It is `ready` at once, indexed for search, and inlined into every published agent its audience admits — no publish step.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","maxLength":120},"content":{"type":"string","maxLength":20000,"description":"Markdown body."},"folderId":{"type":["string","null"],"format":"uuid","description":"`null` moves the article to the top level."},"enabled":{"type":"boolean"},"audience":{"type":"string","enum":["all","selected"]},"consumers":{"type":"array","items":{"type":"string"},"description":"Required meaningfully when `audience` is `selected`."}},"required":["content"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"article":{"$ref":"#/components/schemas/KnowledgeArticle"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/knowledge/articles/import":{"post":{"summary":"Import a website","description":"Requires scope `knowledge:write`. Ody reads the public website (up to 20 same-site pages, ~35 s), organizes what it found into one Markdown knowledge document and saves it as a `url` article. Blocking; typically 20–40 s. `409 failed_precondition` with `reason` `blocked` | `unreachable` | `no_content` when the site could not be read (no article is created).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri"},"title":{"type":"string","maxLength":120},"folderId":{"type":["string","null"],"format":"uuid"}}}}}},"responses":{"201":{"description":"Imported","content":{"application/json":{"schema":{"type":"object","properties":{"article":{"$ref":"#/components/schemas/KnowledgeArticle"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"409":{"description":"The site could not be read (see `message`)","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/knowledge/articles/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"Retrieve an article","description":"Requires scope `knowledge:read`. Includes the full Markdown body.","responses":{"200":{"description":"Article","content":{"application/json":{"schema":{"type":"object","properties":{"article":{"$ref":"#/components/schemas/KnowledgeArticle"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}},"patch":{"summary":"Update an article","description":"Requires scope `knowledge:write`. Only provided fields change: `title`, `content`, `folderId`, `enabled`, `audience` + `consumers`. Re-indexed and re-synced to published agents.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","maxLength":120},"content":{"type":"string","maxLength":20000,"description":"Markdown body."},"folderId":{"type":["string","null"],"format":"uuid","description":"`null` moves the article to the top level."},"enabled":{"type":"boolean"},"audience":{"type":"string","enum":["all","selected"]},"consumers":{"type":"array","items":{"type":"string"},"description":"Required meaningfully when `audience` is `selected`."}}}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"type":"object","properties":{"article":{"$ref":"#/components/schemas/KnowledgeArticle"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}},"delete":{"summary":"Delete an article","description":"Requires scope `knowledge:write`. Every agent stops using it on the next sync (immediate for published agents).","responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/knowledge/articles/{id}/refresh":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"post":{"summary":"Re-read a website article","description":"Requires scope `knowledge:write`. Fetches the article's `sourceUrl` again and replaces the body in place (same id, folder and audience). Website articles only.","responses":{"200":{"description":"Refreshed","content":{"application/json":{"schema":{"type":"object","properties":{"article":{"$ref":"#/components/schemas/KnowledgeArticle"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"409":{"description":"Not a website article, or the site could not be read","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/webhook-events":{"get":{"summary":"List webhook event types","description":"Requires scope `webhooks:manage`. The catalog you can subscribe endpoints to.","responses":{"200":{"description":"Event types","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"type":"string"}}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/webhooks":{"get":{"summary":"List webhook endpoints","description":"Requires scope `webhooks:manage`. Secrets are never included.","responses":{"200":{"description":"Endpoints","content":{"application/json":{"schema":{"type":"object","properties":{"webhooks":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}},"post":{"summary":"Register a webhook endpoint","description":"Requires scope `webhooks:manage`. HTTPS only; max 50 endpoints per workspace. `events` lists types or [\"*\"]. The response includes the signing secret ONCE.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url","events"],"properties":{"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string"}},"label":{"type":"string"}}}}}},"responses":{"201":{"description":"Created — includes the whsec_ secret (shown once)","content":{"application/json":{"schema":{"type":"object","properties":{"webhook":{"$ref":"#/components/schemas/Webhook"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/webhooks/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"Get a webhook endpoint","responses":{"200":{"description":"The endpoint","content":{"application/json":{"schema":{"type":"object","properties":{"webhook":{"$ref":"#/components/schemas/Webhook"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}},"patch":{"summary":"Update a webhook endpoint","description":"Patch url / events / label / status (enabled|disabled).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string"}},"label":{"type":["string","null"]},"status":{"type":"string","enum":["enabled","disabled"]}}}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"type":"object","properties":{"webhook":{"$ref":"#/components/schemas/Webhook"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}},"delete":{"summary":"Delete a webhook endpoint","responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/webhooks/{id}/rotate":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"post":{"summary":"Rotate the signing secret","description":"Returns the NEW whsec_ secret once. Old signatures stop validating immediately.","responses":{"200":{"description":"Rotated — includes the new secret","content":{"application/json":{"schema":{"type":"object","properties":{"webhook":{"$ref":"#/components/schemas/Webhook"}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/webhooks/{id}/test":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"post":{"summary":"Send a signed test delivery","description":"Posts a `{\"type\":\"ping\"}` event to the endpoint, signed exactly like a real delivery.","responses":{"200":{"description":"Attempt result","content":{"application/json":{"schema":{"type":"object","properties":{"delivered":{"type":"boolean"},"attempt":{"type":"object","properties":{"at":{"type":"string"},"statusCode":{"type":"integer"},"error":{"type":"string"},"durationMs":{"type":"integer"}}}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}},"/v1/api/webhooks/{id}/deliveries":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"List recent deliveries","description":"Delivery history with per-attempt status codes/errors — the debugging view.","parameters":[{"name":"limit","in":"query","description":"Page size (1–200, default 50).","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}}],"responses":{"200":{"description":"Deliveries, newest first","content":{"application/json":{"schema":{"type":"object","properties":{"deliveries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"webhookId":{"type":"string"},"eventId":{"type":"string"},"status":{"type":"string","enum":["pending","success","failed"]},"attempts":{"type":"array","items":{"type":"object"}},"createdAt":{"type":"string","format":"date-time"}}}}}}}}},"400":{"description":"Invalid argument","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"401":{"description":"Missing/invalid/revoked API key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"403":{"description":"Key lacks the required scope","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}},"429":{"description":"Rate limit exceeded — respect Retry-After","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthenticated","permission_denied","invalid_argument","failed_precondition","not_found","resource_exhausted","internal"]},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id — quote it to support."}}}}}}}}}}}}}