Developers
One endpoint: post a question, get a cited answer — or an explicit abstain.
Ask your company brain over HTTP. Authenticate with an API key, push in your knowledge, then POST a question and get a source-cited answer — or a clear abstain. This reference covers every endpoint, field and status code.
Overview
The qbrin REST API turns everything your team has connected into cited, grounded answers. Every response either links to the exact source it came from, or tells you it does not know — it is built to cite or abstain rather than guess. All requests are made over HTTPS to a single base URL.
https://app.qbrin.com/apiAnswers carry citations to the source, or return a plain “not in your records”. Designed for zero false accepts.
Answers respect the source permissions of the key’s owner.
Get the whole answer as JSON, or stream tokens over Server-Sent Events for a live UI.
Issue read-only, read-write or admin keys per integration, and revoke any of them in one click.
Authentication
Every request authenticates with an API key sent as a Bearer token. Create one in the console under Settings → API keys. The key is shown once at creation and always starts with qbrin_ — store it somewhere safe, because it can never be retrieved again.
Authorization: Bearer qbrin_3f9a…c1d7Key scopes
Give each integration the least privilege it needs. Scope is enforced per HTTP method, so a read-only key that leaks can never write.
| Scope | Can do |
|---|---|
read | GET requests only — search and read-only lookups. Note: asking a question is a POST, so it needs write. |
write | Everything read can, plus POST / PUT / PATCH / DELETE — asking questions, adding content, feedback. |
admin | Full access. Note: ZIP upload additionally requires the key’s owner to be a workspace admin. |
authorize:decide | The authorization endpoints: POST /v1/authorize, and reading the receipts of its own decisions. Every other REST route answers 403. Meant for an agent that only needs a go, hold or ask-a-person answer. |
mcp | The MCP endpoint and nothing else. It cannot be combined with another scope, and it acts with the owner’s member view, never the admin’s. |
Add content
Two ways to push knowledge in over the API. Both feed the same pipeline — text is chunked, embedded into the vector index and entity-extracted automatically. There is no separate “embed” call; you watch it complete (next section) and then it is answerable.
/api/documentsScope: writeSend text or markdown directly. Best for programmatic, per-document ingestion.
| Field | Type | Description | |
|---|---|---|---|
content | string | Required | The document body (plain text or markdown). Up to ~800,000 characters. |
title | string | Optional | A title for the document. Defaults to “Untitled document”. |
curl https://app.qbrin.com/api/documents \
-H "Authorization: Bearer qbrin_3f9a…c1d7" \
-H "Content-Type: application/json" \
-d '{ "title": "Refund Policy", "content": "Customers may request a full refund within 30 days…" }'// 201 Created
{
"document": {
"id": "doc_a91f22e0",
"extractStatus": "pending"
}
}/api/uploads/zipAdmin onlyBulk-ingest a folder of files by uploading a single .zip. qbrin streams the archive to disk (never buffering it in memory), verifies it is a real ZIP by its magic bytes, extracts the text from supported files, and ingests each one. The request returns immediately with a job id; a worker does the heavy lifting.
| Requirement | Detail |
|---|---|
| Content-Type | multipart/form-data, exactly one file field. |
| Format | A genuine .zip archive (checked by header, not extension). |
| Max size | 100 MB compressed. |
| Availability | The key’s owner must be a workspace admin, and file upload must be enabled for your workspace. |
curl https://app.qbrin.com/api/uploads/zip \
-H "Authorization: Bearer qbrin_3f9a…c1d7" \
-F "file=@handbook.zip"// 202 Accepted — ingestion enqueued
{
"jobId": "upload-7c1e9a4b2f0d",
"archive": "handbook.zip"
}Embedding & status
You never call an embed endpoint directly. Everything you ingest flows through one pipeline — extract text, chunk, embed into the vector index, extract entities — and only becomes answerable once the embedding step finishes. These endpoints let you watch that happen.
- queued
- extract
- embedding
- done
Track a ZIP upload
/api/uploads/{jobId}/statusPoll with the jobId from the upload response until phase is "done".
{
"jobId": "upload-7c1e9a4b2f0d",
"phase": "embedding", // queued | extract | embedding | done | error
"state": "done",
"ingested": 42, // files turned into documents
"skipped": 3, // unsupported / empty files
"embed": { "total": 380, "embedded": 294 }, // chunks embedded — progress bar
"files": [ "handbook/onboarding.md", "handbook/pto.pdf" ],
"error": null
}Track a single document
/api/documents/{id}For content added via POST /api/documents, fetch the document and read chunkCounts — it moves from pending to embedded as the vector index fills in.
{
"document": { "id": "doc_a91f22e0", "title": "Refund Policy", "extractStatus": "done" },
"chunkCounts": { "pending": 0, "embedded": 6, "extracted": 6 }
}Use GET /api/documents?limit=50 to list recently ingested documents. Embedding is fully managed — the model, dimensions and hardware are a server-side detail you do not configure per request.
Ask
/api/askScope: writeThe core endpoint. Send a question; qbrin retrieves across the connected sources, composes an answer grounded in what it found, verifies it, and returns the answer with its citations. If the answer is not supported, it abstains instead of guessing. Asking logs a query, so it is a POST and needs a write (or admin) key.
Request body
| Field | Type | Description | |
|---|---|---|---|
question | string | Required | The question to answer. Up to 4,000 characters. |
k | integer | Optional | How many source excerpts to retrieve. 1–20, default 12. |
Example request
curl https://app.qbrin.com/api/ask \
-H "Authorization: Bearer qbrin_3f9a…c1d7" \
-H "Content-Type: application/json" \
-d '{ "question": "What is our refund window?", "k": 8 }'const res = await fetch("https://app.qbrin.com/api/ask", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.QBRIN_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ question: "What is our refund window?", k: 8 }),
});
const data = await res.json();
// An abstain is signalled by an empty citations array (path-independent).
const abstained = data.citations.length === 0;
console.log(data.answer, abstained, data.trust?.decision);Response 200
{
"answer": "Customers may request a full refund within 30 days of purchase. [1]",
"queryId": "qy_8fb2a1c0",
"citations": [
{
"n": 1,
"documentId": "doc_a91f",
"source": "gdrive",
"title": "Refund Policy.pdf",
"snippet": "…a full refund within 30 days of purchase…",
"authorEmail": "ops@acme.com",
"occurredAt": "2026-03-11T00:00:00Z"
}
],
"trust": {
"decision": "allow",
"level": "verified",
"axes": { "provenance": "cited", "entailment": "passed" },
"certificateId": "a1b2c3d4e5f6"
},
"usage": { "prompt_tokens": 1840, "completion_tokens": 42 },
"timings": { "retrieveMs": 210, "totalMs": 640 }
}The trust object
When present, an answer also carries a trust certificate so you can decide programmatically whether to show, flag or withhold it. Use it as an additional signal on top of the citation check above.
| Field | Values | Meaning |
|---|---|---|
decision | Ship it, it did not know, or it was withheld as unsupported. | |
level | verified · cited_unverified · abstained · blocked | How strongly the answer was checked. |
axes | provenance, entailment, … | Per-check results; unmeasured checks read not_assessed rather than a fake pass. |
certificateId | string | A stable id for auditing or logging the exact verdict. |
Streaming (Server-Sent Events)
Send Accept: text/event-stream to stream the answer token-by-token. Read named events until done.
| Event | Payload |
|---|---|
token | An answer fragment. A reset marks a verified replacement — discard what streamed and take the next stream. |
citations | The sources, so you can render them alongside the text. |
done | Final envelope: queryId, trust (when present), usage, timings. |
followups | 2–3 suggested next questions (may arrive after done). |
error | A failure occurred mid-stream; payload is { message }. Stop consuming and surface or retry — a done will not arrive. |
You may also see informational qwsec and fallback events. Ignore any event name you do not recognise so the stream stays forward-compatible.
curl -N https://app.qbrin.com/api/ask \
-H "Authorization: Bearer qbrin_3f9a…c1d7" \
-H "Accept: text/event-stream" \
-H "Content-Type: application/json" \
-d '{ "question": "Summarize last quarter wins" }'
event: token
data: {"text":"We closed 12 enterprise "}
event: citations
data: {"citations":[…]}
event: done
data: {"queryId":"qy_8fb2","trust":{"decision":"allow"}}Search
/api/searchRetrieve matching documents, people and knowledge across the connected sources without composing an answer. Useful for a search box or feeding your own pipeline. Permission-aware, like everything else.
| Param | Description | |
|---|---|---|
q | Required | The search query. |
sources | Optional | Comma-separated source filter, e.g. gdrive,slack. |
types | Optional | Comma-separated result-type filter. |
limit | Optional | Max results, default 20. |
curl "https://app.qbrin.com/api/search?q=onboarding&sources=gdrive&limit=10" \
-H "Authorization: Bearer qbrin_3f9a…c1d7"Answer feedback
/api/{queryId}/feedbackScope: writeTell qbrin whether an answer was useful, using the queryId returned by /api/ask. This tunes future answers.
| Field | Description | |
|---|---|---|
helpful | Required | 1 helpful · 0 neutral · -1 not helpful. |
curl https://app.qbrin.com/api/qy_8fb2a1c0/feedback \
-H "Authorization: Bearer qbrin_3f9a…c1d7" \
-H "Content-Type: application/json" \
-d '{ "helpful": 1 }'Connect an AI agent (MCP)
/api/mcpKey: write, admin or mcpqbrin runs an MCP server, so an agent in Claude Code, or any client that speaks MCP, can ask your company brain without custom code. It uses streamable HTTP (protocol 2025-06-18) at https://app.qbrin.com/api/mcp. A GET on that URL needs no key and lists the tools this server exposes. Every POST needs a key.
1. Get a key
Either of these works:
- A
writekey from Settings → API keys (orqbrin login). It reaches MCP, and it also reaches every REST route awritekey can. Areadkey cannot call MCP: every MCP call is aPOST, so it is refused with 403. - An
mcpkey, for an agent that should reach MCP and nothing else. The console form cannot create one yet, so call the route from a signed-in browser on the console’s own address. The key is shown once, intoken.token.
await fetch("/api/auth/tokens", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ name: "my-agent", scopes: ["mcp"], expiresInDays: 90 }),
}).then((r) => r.json()); // the key is shown once, in token.tokenKeys live 90 days unless you set expiresInDays (1 to 365).
2. Add the server to your client
claude mcp add --transport http qbrin https://app.qbrin.com/api/mcp \
--header "Authorization: Bearer $QBRIN_API_KEY"Any other client that speaks streamable HTTP and lets you set a header needs the same two things: the URL above and Authorization: Bearer <key>.
3. Check it by hand
The server is stateless and answers plain JSON, so no initialize call is needed first. tools/list shows exactly what your key may use; tools/call runs a tool.
curl -s https://app.qbrin.com/api/mcp \
-H "Authorization: Bearer $QBRIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'curl -s https://app.qbrin.com/api/mcp \
-H "Authorization: Bearer $QBRIN_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"ask_qbrin","arguments":{"question":"What is our refund policy?"}}}'Tools
| Tool | What it does | Available |
|---|---|---|
ask_qbrin | A cited answer from the workspace’s knowledge, or an explicit abstention. The question may be up to 4000 characters. | Always |
get_context | The smallest set of relevant passages for a task, within a token budget. No answer. | Only where the server has this tool switched on, and only for a registered AI tool whose manifest lists it. |
propose_action | Asks the authorization gate about an action and returns allow, hold or refuse, with a receipt id. qbrin performs nothing itself. | Only where the server has this tool switched on, and only for a registered AI tool whose manifest lists it. |
Reading the results
An abstention from ask_qbrin is a normal result, not a failure: isError is false and the text starts NO ANSWER. Do not fill the gap from your own knowledge. A hold from propose_action means a person must approve it.
Limits
Each key may make 60 tool calls an hour, unless an admin set another budget for its registered tool. Past that the server answers 429 with a Retry-After header: wait that many seconds. A batch of more than 10 requests is refused with 413. A tool that is hidden from your key and a tool that does not exist both answer error -32602 “Unknown tool”.
Manage API keys
You will normally create and revoke keys in the console (Settings → API keys), but the same operations are available programmatically. These run in your signed-in session, not with a Bearer key.
| Method | Path | Purpose |
|---|---|---|
| GET | /api/auth/tokens | List your keys (name, prefix, last used) — never the secret. |
| POST | /api/auth/tokens | Create a key: name, optional scopes and expiresInDays (1 to 365; 90 if you leave it out). Returns the raw token once. |
| DELETE | /api/auth/tokens/{id} | Revoke a key immediately. |
// 201 Created — the raw secret is returned exactly once, at token.token
{
"token": {
"id": "tok_a1b2c3",
"name": "ci-pipeline",
"prefix": "qbrin_3f9a",
"scopes": ["read"],
"expiresAt": "2026-10-10T00:00:00Z",
"createdAt": "2026-07-12T00:00:00Z",
"token": "qbrin_3f9a2b7c8d1e…c1d7"
}
}Errors & limits
Errors return a JSON body { "error": "…" } with a standard HTTP status.
| Status | Meaning & fix |
|---|---|
| 400 | Bad request — e.g. missing question/content, or over the character limit. Fix the payload. |
| 401 | Missing or invalid API key. Check the Authorization header. |
| 403 | The key’s scope does not permit this action (e.g. a read key doing a POST, or ZIP upload without admin). Issue a wider-scoped key. |
| 404 | Resource not found — e.g. an unknown queryId, document or job id. |
| 413 | Payload too large — a document over ~800k characters, or a ZIP over 100 MB. |
| 429 | Rate limited. Back off and retry with exponential backoff. |
| 503 | A required model or embedder is not configured server-side. Transient — retry or contact support. |
Rate limits
Requests are rate-limited per key to protect the service — comfortable for normal interactive and batch use. If you expect sustained high volume, reach out at hello@qbrin.com and we will raise your ceiling.
See it answer your hardest question.
Bring one real question your team keeps re-asking. We’ll connect a source, read-only, and show you the answer, sourced, in seconds, in a 20-minute walkthrough. Nothing changes in your tools.