The AI API also includes an embedded, org-wide Knowledge Base — not shown
in the auto-generated endpoint list below. Ingest documents by upload, URL,
markdown, or bulk help-center import (
POST /api/v1/ai/kb/documents,
POST /api/v1/ai/kb/import/help-center), keep them fresh with a staleness
scorecard and per-document verification (GET /api/v1/ai/kb/staleness,
POST /api/v1/ai/kb/documents/{id}/verify), and query them with raw semantic
search (POST /api/v1/ai/kb/search) or a grounded answer with citations
(POST /api/v1/ai/kb/answers). See the full
AI Knowledge Base reference. For a
separately provisioned, per-knowledge-base store, use the
Knowledge Bases API.Response envelopes for the generated shells
The auto-generated shells below this section show each route’s schema, but their response examples are empty placeholders. The worked envelopes here show the exact{ data, meta } body your integration receives, with real values, for every knowledge-source and AI-inference route on this page. Read them top to bottom as a pipeline: discover connectors, ingest documents, keep them fresh, then analyze, classify, generate, and search on top of them.
All routes on this page require a signed-in operator seat (or an internal token); the knowledge-source write routes additionally require an owner or admin seat, and every /ai call that runs inference is metered against your workspace’s credit wallet.
1. List knowledge connectors
GET /knowledge/connectorsstatus is live for connectors you can register today and catalogued for sources on the roadmap; auth_required tells you whether registering one needs an OAuth grant or just a public subdomain.
2. Get one knowledge connector
GET /knowledge/connectors/{id}id values from the list above, including the configuration fields the import endpoint accepts for it.
404 NOT_FOUND — branch on it when you cache the catalog client-side.
3. List knowledge documents
GET /knowledge/documentspending while the ingest worker chunks and embeds it, indexed once it is retrievable, error when ingestion failed.
4. Get one knowledge document
GET /knowledge/documents/{id}404 NOT_FOUND.
5. Run the staleness scan
GET /knowledge/stale-scanscore is 0–1 (higher is fresher), and each document carries a fresh / aging / stale classification plus the days since its source changed. Poll it on a schedule and reindex or delete what goes stale.
6. Analyze text
POST /ai/analyze{ "text": "..." } (1–10 000 characters); the reply carries all four dimensions on data.
Request
text fails validation before any inference runs and is never charged:
422
7. Analyze a message and persist the result
POST /ai/analyze/persistmessage_id and the analysis object exactly as stored.
Request
404 NOT_FOUND:
404
8. OpenAI-compatible chat completion
POST /ai/chat/completions/api/v1/ai base URL and it will call this route. The request body is the standard OpenAI subset (messages, optional model, temperature, max_tokens, response_format), and the reply is a faithful chat.completion object wrapped in the Orbit envelope: choices[0].message.content holds the text, usage the token counts to add to your accounting. Inference runs on Orbit’s managed model fleet and is billed to the same wallet as your comms; a model you send is echoed back as requested.
Request
messages array is rejected before inference:
422
9. Classify intent
POST /ai/classify-intent{ "conversation_id": "..." } and the most recent messages are read for you. The reply names the primary intent category with a 0–1 confidence and one sentence of reasoning you can log or show to the operator.
Request
conversation_id fails validation with 422 VALIDATION_ERROR (“Conversation ID is required”) and is not charged.
10. Generate a campaign blueprint
POST /ai/campaign-blueprintname and description, one message body per requested channel, a journey graph (nodes and edges in the visual builder’s shape) ready to load into the canvas, and an audience hint. The result is a draft — review it and launch it yourself. Set audience_segment to start the journey with a score check so only contacts in that bucket receive it.
Request
422
11. Generate dashboard insights
POST /ai/dashboard-insightscached: true. This endpoint is best-effort by design: if inference is unavailable it degrades to an empty insights array with cached: false rather than erroring your dashboard.
12. Create embeddings
POST /ai/embeddings/embeddings wire shape (object: "list", one embedding entry per input, a usage token count), so existing embedding SDKs drop in unchanged. Spend is billed to your wallet per token.
Request
413
13. Generate content for a channel
POST /ai/content-for-channelchannel (sms, whatsapp, email, voice). Use it anywhere you compose a send: the campaign wizard, send dialogs, or your own tooling.
Request
prompt returns 422 VALIDATION_ERROR (“Prompt is required”) and is not charged.
14. Rewrite text
POST /ai/rewrite-textaction: improve, shorter, longer, change_tone, fix_grammar, or rephrase. fix_grammar corrects grammar and spelling only and never rephrases; rephrase keeps meaning and length. This is the endpoint behind the AI-assist button in send dialogs.
Request
text returns 422 VALIDATION_ERROR (“Text is required”).
15. Ask the knowledge base
POST /ai/askcitations list your UI should show alongside it. confidence tells you when to fall back to a human: below your threshold, route the conversation to an operator instead of surfacing the answer.
Request
question returns 422 VALIDATION_ERROR before the search and answer steps run.
16. Ingest a document
POST /knowledge/documentspending status, and you poll GET /knowledge/documents/{id} until it reads indexed (or error). Requires an owner or admin seat.
401
17. Reindex a document
POST /knowledge/documents/{id}/reindexstatus: "error") or after the source of a URL document changed. Like the create, it returns 202 immediately and the document transitions pending → indexed (or back to error); poll the document record for the outcome.
404 NOT_FOUND.
18. Verify a document
POST /knowledge/documents/{id}/verifyverified: true means all checks passed; otherwise issues names each failed check so you know what to fix before reindexing.
404 NOT_FOUND.
19. Import a help center
POST /knowledge/import/help-centerprovider (zendesk_guide today), your subdomain, the help-center locale, and an optional max_articles ceiling. Every published article is queued as a URL-sourced document through the standard ingest pipeline, so queued tells you how many documents to expect and truncated: true means the help center holds more articles than your ceiling; raise max_articles and re-run to capture the rest. Drafts are skipped.
Request
404 NOT_FOUND; a private or rate-limited help center surfaces as 502 BAD_GATEWAY:
404
20. Search the knowledge base
GET /knowledge/searchPOST /ai/ask when you want a single grounded answer composed from them.
POST /knowledge/documents, reindex, verify, and help-center import) all enforce the same owner/admin seat requirement as section 16 shows: a request without a valid credential gets 401, and a signed-in seat below owner/admin gets 403. Every failure on this page uses the shared { error, meta } envelope from the errors table below, so one retry/reframe/escalate switch covers all of them.
Worked session/memory + budget envelopes
The auto-generated response examples below show the OpenAPI schema shape. The worked envelopes in this section show the exact fields your integration sees, with real values, across the three AI chains the reference below only half-covers: the per-contact session-memory read/write pair, the per-agent token-budget precheck, and the chat response the whole flow ends in. Together with the worked agent samples they give you a body you can branch on for every call an agent build makes first. Both the memory round trip and the budget precheck are tenant-owned controls: memory facts are scoped to one contact (and deleted with the contact’s GDPR erasure), and the token budget is a per-agent cap your workspace sets. The session-memory pair has its four statuses —201 write, 200 read, 409 opt-out or per-contact fact cap, 422 validation.
1. Session memory round trip
Teach the agent a fact about a contact, then read the same contact’s facts back. The write returns201 with the stored item; the read returns the newest facts with PII in the fact bodies masked unless your role is in the unmask allowlist and you pass ?reveal=true. When the contact has opted out of memory the write returns 409 MEMORY_DISABLED_FOR_CONTACT and the read returns an empty list with memory_enabled: false.
POST /api/v1/agents/{agentId}/memorycontact_id and fact are required; source is manual (default) or conversation, and importance (0–1) overrides the default 0.9 for manual teaches. The fact body is sanitised, capped to your tenant’s content limit, and stored with an embedding so the agent can retrieve it in later turns.
Request
GET /api/v1/agents/{agentId}/memory?contact_id=ctt_4f2a9c1efact-type entries are returned and phone/email tokens in the bodies are PII-masked; owner, admin, and developer roles can pass reveal=true to unmask (each reveal is audit-logged). A contact that has opted out returns an empty items list with memory_enabled: false.
409 the write returns when the contact has opted out — branch on this before you surface “teach the agent” in your UI:
409
2. Token-budget precheck
Evaluate an action against your agent’s governance policies before the send, so a long turn never starts when it would be denied. Pass the intendedmodel, the tool id (if the action invokes a tool), and the tokens the agent has already consumed this UTC month. The response merges every enabled policy that applies to the agent and returns a single allow/deny verdict with the effective caps it resolved — the monthly token budget is the strictest (minimum) across applying policies, and the model allowlist is the intersection. Gate on allowed: true/false; when the gate denies, reason is one of model_not_allowed, budget_exceeded, or sod_approval_required. Both fields you need to gate the send are on the envelope below.
GET /api/v1/agents/governance-internal/resolve?agent_id=agt_7e3b9c1f&model=claude-sonnet-4-6&monthly_tokens_used=84129monthly_tokens_used=250000 (already at the budget) the verdict flips — gate on it before you send:
200
POST /api/v1/agents/{agentId}/chat200
3. Errors-as-decision-table
Every/ai and /agents failure returns the same { error, meta } envelope. The error.code and status tell you which of the three decisions to take; don’t treat 4xx as one class.
429
429, 502, 503) are the only safe replay: they mean nothing was committed, so the same request can be resent after the wait. Reframe statuses (402, 409, 422) will fail identically every time until you change the request — and 409 MEMORY_DISABLED_FOR_CONTACT specifically means stop, because the contact revoked consent.