Skip to main content
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/connectors
Discover the source connectors the knowledge base can ingest from. status 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}
Fetch a single connector by the id values from the list above, including the configuration fields the import endpoint accepts for it.
An unknown connector id returns 404 NOT_FOUND — branch on it when you cache the catalog client-side.

3. List knowledge documents

GET /knowledge/documents
Every document in the org-wide knowledge base, with the ingest status you poll after a upload, import, or reindex: pending 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}
The full record for a single document, including its ingest status and chunk count. An unknown id returns 404 NOT_FOUND.

5. Run the staleness scan

GET /knowledge/stale-scan
Score the whole knowledge base for freshness in one read. score 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
Run one piece of text through sentiment, intent, language, and topic detection in a single call. Send { "text": "..." } (1–10 000 characters); the reply carries all four dimensions on data. Request
An empty text fails validation before any inference runs and is never charged:
422

7. Analyze a message and persist the result

POST /ai/analyze/persist
Analyze one stored message by id and write the result back onto the message record, so the Messages and Interactions surfaces show the same analysis you received here. The reply carries the message_id and the analysis object exactly as stored. Request
A message id that does not exist in your workspace returns 404 NOT_FOUND:
404

8. OpenAI-compatible chat completion

POST /ai/chat/completions
Point any OpenAI SDK at your /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
An empty messages array is rejected before inference:
422

9. Classify intent

POST /ai/classify-intent
Classify the intent behind a conversation, not a single string: send { "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
A missing conversation_id fails validation with 422 VALIDATION_ERROR (“Conversation ID is required”) and is not charged.

10. Generate a campaign blueprint

POST /ai/campaign-blueprint
Describe a campaign goal in plain English and receive a draft blueprint: a name 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
A goal shorter than a sentence is rejected so the model never drafts from a fragment:
422

11. Generate dashboard insights

POST /ai/dashboard-insights
Send your current dashboard statistics and receive two to three actionable insights. The result is cached server-side for one hour, so repeated calls inside the hour return the same insights with cached: 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
Turn one string, or up to 96 strings, into embedding vectors using the same model Orbit uses for its own retrieval. The payload mirrors OpenAI’s /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
Vectors are truncated above for readability; each real entry carries the model’s full dimension. A batch above the 96-input ceiling is rejected as oversized before any spend:
413

13. Generate content for a channel

POST /ai/content-for-channel
Draft message copy from a prompt and tone, tuned for the target channel (sms, whatsapp, email, voice). Use it anywhere you compose a send: the campaign wizard, send dialogs, or your own tooling. Request
An empty prompt returns 422 VALIDATION_ERROR (“Prompt is required”) and is not charged.

14. Rewrite text

POST /ai/rewrite-text
Rewrite existing text with a named action: 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
An empty text returns 422 VALIDATION_ERROR (“Text is required”).

15. Ask the knowledge base

POST /ai/ask
Ask a question in plain language and receive a grounded answer drawn from your indexed documents, with the citations 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
An empty question returns 422 VALIDATION_ERROR before the search and answer steps run.

16. Ingest a document

POST /knowledge/documents
Add one document by upload, URL, or inline markdown. Indexing is asynchronous: the create returns immediately with the document record in pending status, and you poll GET /knowledge/documents/{id} until it reads indexed (or error). Requires an owner or admin seat.
Requests without a valid credential, or from a seat below owner/admin, are refused before anything is stored:
401

17. Reindex a document

POST /knowledge/documents/{id}/reindex
Re-queue a document for chunking and embedding. Use it after a failed ingest (status: "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.
An unknown document id returns 404 NOT_FOUND.

18. Verify a document

POST /knowledge/documents/{id}/verify
Run a verification pass over one indexed document: whether its source still resolves, whether its content still matches the indexed chunks, and whether it remains retrievable in search. verified: true means all checks passed; otherwise issues names each failed check so you know what to fix before reindexing.
An unknown document id returns 404 NOT_FOUND.

19. Import a help center

POST /knowledge/import/help-center
Seed the knowledge base from an existing help center in one call. Send the provider (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
A subdomain or locale that does not resolve to a public help center returns 404 NOT_FOUND; a private or rate-limited help center surfaces as 502 BAD_GATEWAY:
404

20. Search the knowledge base

GET /knowledge/search
Raw semantic search over the indexed documents, scored 0–1. Use it when you want the matching passages themselves; use POST /ai/ask when you want a single grounded answer composed from them.
The knowledge-source write routes (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 returns 201 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}/memory
Manual teach. contact_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_4f2a9c1e
Read back the same contact’s facts. By default only fact-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.
The 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 intended model, 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=84129
When the same call with monthly_tokens_used=250000 (already at the budget) the verdict flips — gate on it before you send:
200
Once the precheck clears, the turn itself is the chat call — the response carries the token split you add to your own usage accounting:
POST /api/v1/agents/{agentId}/chat
200

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
Retry buckets (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.