Skip to content

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.

Base URLhttps://app.qbrin.com/api
Cited or it abstains

Answers carry citations to the source, or return a plain “not in your records”. Designed for zero false accepts.

Permission-aware

Answers respect the source permissions of the key’s owner.

JSON or streaming

Get the whole answer as JSON, or stream tokens over Server-Sent Events for a live UI.

Scoped keys

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.

Header
Authorization: Bearer qbrin_3f9a…c1d7

Key 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.

ScopeCan do
readGET requests only — search and read-only lookups. Note: asking a question is a POST, so it needs write.
writeEverything read can, plus POST / PUT / PATCH / DELETE — asking questions, adding content, feedback.
adminFull access. Note: ZIP upload additionally requires the key’s owner to be a workspace admin.
authorize:decideThe 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.
mcpThe 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.

POST/api/documentsScope: write

Send text or markdown directly. Best for programmatic, per-document ingestion.

FieldTypeDescription
contentstringRequiredThe document body (plain text or markdown). Up to ~800,000 characters.
titlestringOptionalA title for the document. Defaults to “Untitled document”.
cURL
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…" }'
Response
// 201 Created
{
  "document": {
    "id": "doc_a91f22e0",
    "extractStatus": "pending"
  }
}
POST/api/uploads/zipAdmin only

Bulk-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.

RequirementDetail
Content-Typemultipart/form-data, exactly one file field.
FormatA genuine .zip archive (checked by header, not extension).
Max size100 MB compressed.
AvailabilityThe key’s owner must be a workspace admin, and file upload must be enabled for your workspace.
cURL
curl https://app.qbrin.com/api/uploads/zip \
  -H "Authorization: Bearer qbrin_3f9a…c1d7" \
  -F "file=@handbook.zip"
Response
// 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.

  1. queued
  2. extract
  3. embedding
  4. done

Track a ZIP upload

GET/api/uploads/{jobId}/status

Poll with the jobId from the upload response until phase is "done".

Response
{
  "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

GET/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.

Response
{
  "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

POST/api/askScope: write

The 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

FieldTypeDescription
questionstringRequiredThe question to answer. Up to 4,000 characters.
kintegerOptionalHow many source excerpts to retrieve. 1–20, default 12.

Example request

cURL
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 }'
JavaScript
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

JSON
{
  "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.

FieldValuesMeaning
decisionallowabstainblockShip it, it did not know, or it was withheld as unsupported.
levelverified · cited_unverified · abstained · blockedHow strongly the answer was checked.
axesprovenance, entailment, …Per-check results; unmeasured checks read not_assessed rather than a fake pass.
certificateIdstringA 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.

EventPayload
tokenAn answer fragment. A reset marks a verified replacement — discard what streamed and take the next stream.
citationsThe sources, so you can render them alongside the text.
doneFinal envelope: queryId, trust (when present), usage, timings.
followups2–3 suggested next questions (may arrive after done).
errorA 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
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"}}

Answer feedback

POST/api/{queryId}/feedbackScope: write

Tell qbrin whether an answer was useful, using the queryId returned by /api/ask. This tunes future answers.

FieldDescription
helpfulRequired1 helpful · 0 neutral · -1 not helpful.
cURL
curl https://app.qbrin.com/api/qy_8fb2a1c0/feedback \
  -H "Authorization: Bearer qbrin_3f9a…c1d7" \
  -H "Content-Type: application/json" \
  -d '{ "helpful": 1 }'

qbrin: evidence-backed authorization for AI agents

POST/v1/authorizePublic sandbox / zero-auth

Verify before AI acts. qbrin is an evidence-backed authorization layer for AI agents. Before an agent takes an important action, qbrin checks whether the action is actually justified by current evidence, permissions, and company policy. It then answers go, hold or ask a person. In the API those are the words ALLOW, HOLD and ESCALATE.

Even simpler: qbrin is a safety layer between AI agents and the tools they use. It checks whether an action has enough proof and permission before letting it happen.

FieldDescription
actionRequiredAction or tool name (e.g. browser_action, refund_payment, deploy_production, merge).
argsOptionalKey-value map of action parameters and targets.
evidenceOptionalArray of evidence objects (human approval, CI status, customer ticket) verifying the action. Evidence you attach yourself is untrusted until it is attested by a system of record.
cURL
curl -X POST https://app.qbrin.com/v1/authorize \
  -H "Content-Type: application/json" \
  -d '{
    "action": "browser_action",
    "args": {
      "action": "click",
      "target": "#confirm-order",
      "url": "https://internal.portal.net/orders/409"
    }
  }'
JavaScript / Node
const res = await fetch("https://app.qbrin.com/v1/authorize", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    action: "browser_action",
    args: { action: "click", target: "#confirm-order", url: "https://internal.portal.net/orders/409" }
  })
});
const data = await res.json();
// production tenants get a grant; the public sandbox never mints one and returns a grantPreview
console.log(data.decision, data.reason, (data.grant ?? data.grantPreview)?.token);
Response (200 OK, sandbox)
{
  "decision": "allow",
  "reason": "ok",
  "stage": "access",
  "action": "browser_action",
  "blastRadius": "external",
  "reversible": false,
  "stages": [
    {
      "stage": "access",
      "decision": "allow",
      "reason": "ok"
    },
    {
      "stage": "agent_policy_default",
      "decision": "allow",
      "reason": "policy allows send"
    },
    {
      "stage": "evidence",
      "decision": "allow",
      "reason": "no_evidence_required"
    },
    {
      "stage": "envelope",
      "decision": "allow",
      "reason": "within_envelope"
    }
  ],
  "evidence": {
    "examined": 0,
    "bound": 0,
    "required": 0,
    "ignored": 0
  },
  "grant": null,
  "grantPreview": {
    "token": "qgrant_sbx_2bc7d0…0a9e",
    "action": "browser_action",
    "aud": "qbrin-sandbox",
    "environment": "sandbox",
    "isSandbox": true,
    "scope": "browser_action",
    "expiresAt": "2026-09-30T16:44:57.445Z",
    "argsHash": "sha256…a365",
    "evidenceRoot": "sha256…b945",
    "nonce": "7i2yNplExBJG"
  },
  "enforcementMode": "shadow",
  "mayProceed": true,
  "wouldBlock": false,
  "receiptId": "qb_rec_c8fccbb73e6e478d",
  "latencyMs": 1.06,
  "publicSandbox": true
}

When the evidence is not trusted

browser_action above needs no evidence, so it is decided on access and policy alone. A gated action such as refund_payment needs evidence, and evidence the caller supplies is untrusted (authority: "caller"). The gate therefore answers escalate with reason evidence_untrusted; the proof shows exactly which authorities it would have accepted. Allowing it takes evidence attested by a system of record, which is what keeps an agent from vouching for its own action.

Request (refund_payment)
curl -X POST https://app.qbrin.com/v1/authorize \
  -H "Content-Type: application/json" \
  -d '{
    "action": "refund_payment",
    "args": { "paymentId": "PAY_123", "amount": 48500, "currency": "INR" },
    "evidence": [
      { "kind": "customer_request",
        "value": "Customer refund request of INR 48500 for PAY_123 approved by Finance" },
      { "kind": "refund_policy",
        "value": "Policy 2026: full refunds allowed within 30 days" }
    ]
  }'
Response (escalate)
{
  "decision": "escalate",
  "reason": "evidence_untrusted",
  "stage": "evidence",
  "action": "refund_payment",
  "blastRadius": "external",
  "reversible": false,
  "stages": [
    {
      "stage": "access",
      "decision": "allow",
      "reason": "ok"
    },
    {
      "stage": "agent_policy_default",
      "decision": "allow",
      "reason": "policy allows write"
    },
    {
      "stage": "evidence",
      "decision": "hold",
      "reason": "evidence_untrusted"
    }
  ],
  "proof": {
    "claims": [
      {
        "claim": "refund_status(PAY_123)=approved",
        "status": "untrusted_authority",
        "authority": "caller",
        "requiredAuthority": [
          "stripe",
          "billing",
          "finance_erp",
          "finance_approval",
          "zendesk_finance",
          "finance"
        ],
        "trustLevel": "caller_unverified"
      }
    ]
  },
  "evidence": {
    "examined": 2,
    "bound": 0,
    "required": 2,
    "ignored": 0
  },
  "grant": null,
  "grantPreview": null,
  "enforcementMode": "shadow",
  "mayProceed": false,
  "receiptId": "qb_rec_2ddecc386bda4819",
  "latencyMs": 2.5,
  "publicSandbox": true
}

Connect an AI agent (MCP)

POST/api/mcpKey: write, admin or mcp

qbrin 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 write key from Settings → API keys (or qbrin login). It reaches MCP, and it also reaches every REST route a write key can. A read key cannot call MCP: every MCP call is a POST, so it is refused with 403.
  • An mcp key, 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, in token.token.
Create an mcp key (JavaScript)
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.token

Keys live 90 days unless you set expiresInDays (1 to 365).

2. Add the server to your client

Claude Code
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.

List the tools
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"}'
Ask a question
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

ToolWhat it doesAvailable
ask_qbrinA cited answer from the workspace’s knowledge, or an explicit abstention. The question may be up to 4000 characters.Always
get_contextThe 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_actionAsks 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.

MethodPathPurpose
GET/api/auth/tokensList your keys (name, prefix, last used) — never the secret.
POST/api/auth/tokensCreate 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.
POST response
// 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.

StatusMeaning & fix
400Bad request — e.g. missing question/content, or over the character limit. Fix the payload.
401Missing or invalid API key. Check the Authorization header.
403The 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.
404Resource not found — e.g. an unknown queryId, document or job id.
413Payload too large — a document over ~800k characters, or a ZIP over 100 MB.
429Rate limited. Back off and retry with exponential backoff.
503A 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.