bicardinal · API reference · Markdown for agents: https://bicardinal.com/docs.md

bicardinal API reference

Enterprise

The API is part of the Enterprise plan. Enterprise is for putting bicardinal inside your own product (a support widget, an internal tool) as well as using it on the web: the same assistants, files, spaces and chat, reached over HTTP, with each of your users kept apart and every cost visible. The plan is chosen when the account is created.

NameMeaning
API accessAPI keys, up to ten per account, each able to use every assistant of the account. Personal has no API access.
Your usersPass end_user_id with a chat and each of your users gets their own memory and history; without it, API traffic shares one. Their conversations are listed with GET /conversations?source=api, and their memory can be read and cleared.
Guidance and auditRules for an assistant that apply to every user (tone, sources, what to always or never say), and an audit that reads a conversation and proposes the rule that would have fixed it. Enterprise only.
UsageA week's usage by the hour, conversations and users, and each assistant's share: GET /usage. Enterprise only.
AssistantsUp to 20, each with its own files, instruction, memory and history. Personal: 4.
Storage10 GB and 100,000 files, shared by the account's assistants. Personal: 1 GB and 10,000 files.
Modelsastra, sol, terra and luna, with reasoning from none to max as each model accepts; the same on both plans.
BillingPrepaid, at model cost with nothing on top: credit is added, every turn and upload is charged as it happens, and requests are refused with 402 once the balance runs out. An email reminder can be set for a low balance.
LimitsSixty requests a minute and eight at once, per account; beyond that, 429.

Getting started

NameMeaning
Base URLhttps://bicardinal.com/api
FormatJSON, except file uploads and chat messages, which are multipart/form-data.
Identifiers32-character hex strings. The assistant must be named in every request; an API key alone does not identify one.
MoneyAll amounts are integers in nano-dollars: 1,000,000,000 is one dollar.
TimeUnix seconds.
curl https://bicardinal.com/api/assistants \
  -H "Authorization: Bearer mb_xxxxxxxxxxxxxxxx"

Authentication

Create an API key in the dashboard. The key is shown only once, when it is created, and goes in the Authorization header of every request. An account can have up to ten keys, and every key has access to all of the account's assistants; delete a leaked key from the dashboard.

Authorization: Bearer mb_...

Each account is limited to sixty requests per minute and eight concurrent requests; beyond that, 429 is returned.

Assistants

An assistant has its own set of files, an instruction, memory and history. Budget and storage belong to the account and are shared between assistants.

GET /assistants

The list of assistants, the maximum number, and the models the plan allows.

POST /assistants

NameMeaning
nameName, up to 60 characters.
instructionInstruction, up to 20,000 characters; prepended to every conversation.

PATCH /assistants/{id}

DELETE /assistants/{id}

Deleting an assistant permanently removes its files, conversations and memory. The account's last assistant cannot be deleted.

Files

Files are processed after upload: the text is extracted, summarised and indexed, and the assistant can search it. Supported types: text, docx, pdf, images and audio, up to 50 MB. Each upload is answered at once with a job, and the processing happens in the background.

Files live in places. place=shared, the default, is the library that chat, the API and every space read. A space's id as the place holds files only that space's conversations read, alongside Shared. Every file route takes place, and paths are relative to it.

POST /files/check

Which files are already uploaded, by the SHA-256 of their bytes, and where: ask before uploading. The same bytes are stored once per assistant.

POST https://bicardinal.com/api/files/check
{"assistant_id": "…", "sha256": ["9f86d081884c7d65…"]}

→ {"duplicates": {"9f86d081884c7d65…": {"duplicate_of": "…", "place": "shared", "place_title": "Shared", "path": "policies/handbook.pdf", "in_trash": false}}}

POST /files/quote

Before uploading, an estimate of the cost and whether the budget covers it. Stores nothing.

POST https://bicardinal.com/api/files/quote
{"assistant_id": "…", "files": [{"name": "report.pdf", "bytes": 2902609, "pages": 35}]}

→ {"files": [{"name": "report.pdf", "kind": "pdf", "bound_nano": 234666500, "typical_nano": 180333250}],
   "bound_nano": 234666500, "typical_nano": 180333250, "affordable": true, "shortfall_nano": 0, "quota": {…}}

POST /files

NameMeaning
fileOne file per request.
assistant_idThe assistant.
placeshared (default) or a space id.
folderFolder within the place, optional; for example reports/2026.
file_idOptional, an identifier you mint yourself. Sending the same identifier again returns the same job and does not process the file twice.

A 202 response with the job: its state is queued, then extracting, summarising, indexing and finally done or failed. A file that was already uploaded is refused with 409, naming the existing copy's place and path; one the budget does not cover, with 402.

GET /files/jobs?assistant_id=&place=&file_id=

The state of the named jobs, or of all unfinished and recently failed ones in the place. Each job carries its cost so far.

DELETE /files/jobs/{job_id}?assistant_id=

GET /files?assistant_id=&place=

The place's processed files with path, size and chunk count; its folders; how many files each place holds; and the account's storage used.

POST /files/folders

Create an empty folder; uploading into a folder creates it too.

{"assistant_id": "…", "place": "shared", "folder": "reports/2026"}

PATCH /files

Move and rename files and folders, free of charge. to_place on a file or folder moves it to another place; it is a path change, so nothing is processed again.

{"assistant_id": "…", "place": "shared", "files": [{"file_id": "…", "folder": "plans", "to_place": "<space id>"}]}

DELETE /files

{"assistant_id": "…", "place": "shared", "file_ids": ["…"], "folders": ["old"]}

Chat

POST /chat

One turn. Multipart, since it may carry an attachment. The model decides for itself whether to search the files, and may search more than once; the reply names its sources. A conversation searches Shared files; one inside a space also searches that space's own.

NameMeaning
messageThe user's message, up to 100,000 characters.
assistant_idThe assistant.
conversation_idOptional. Without it a new conversation is created and its identifier comes back in the reply.
end_user_idYour end user's identifier, optional. Each identifier has its own memory and history; without it, everyone shares one.
modelastra, sol, terra or luna. Default terra.
reasoningnone, low (default), medium, high, xhigh or max. astra does not accept none.
historyOptional, JSON of [{role, content}]. Without it the stored history is used.
fileAttachment, up to 20 MB. A document is extracted and added to the message; an image is given directly to the model and forgotten after this turn.
curl https://bicardinal.com/api/chat \
  -H "Authorization: Bearer mb_…" \
  -F assistant_id=… -F end_user_id=user-42 -F model=terra \
  -F 'message=How much does the enterprise plan cost?'

→ {"conversation_id": "…", "message": "…", "model": "terra", "reasoning": "low",
   "sources": [{"file_id": "…", "path": "pricing.pdf", "chunk": 3}],
   "usage": {"prompt_tokens": 1175, "cached_tokens": 800, "completion_tokens": 86, "reasoning_tokens": 18, "cost_nano": 169100},
   "costs": {"total_nano": 169100, "extraction_nano": 0, "rounds": [...]},
   "quota": {"allowance_nano": …, "spent_nano": …, "remaining_nano": …}}

Every reply also carries the X-Quota-Spent-Nano and X-Quota-Allowance-Nano headers, on errors too. The response speed (normal or fast) comes from the account settings and is the same for every turn.

Spaces

A space holds threads; a thread is one connected map of conversations. It starts with one conversation, then grows by branching from a conversation or combining several into a result. Each conversation is an ordinary one: chat in it with POST /chat and its id as conversation_id. Spaces made with an API key belong to the key's account and are shared by all its callers.

GET /spaces?assistant_id=

POST /spaces

{"assistant_id": "…", "title": "Launch plan"}

GET /spaces/{id}

The space with its threads, conversations (nodes), the connections between them (edges) and its shared memory.

PATCH /spaces/{id}

DELETE /spaces/{id}

Moves the space, with its threads, conversations and files, to the trash.

POST /spaces/{id}/threads

PATCH /spaces/{id}/threads/{thread_id}

DELETE /spaces/{id}/threads/{thread_id}

Moves the thread and its conversations to the trash.

POST /spaces/{id}/nodes

NameMeaning
thread_idThe thread.
parentsThe conversations it grows from: none for a thread's first, one to branch, several to combine (up to 12).
nodes[{title}], up to eight new conversations at once, all with the same parents.
throughOptional: branch from this many messages of the parent, not all of it.

GET /spaces/{id}/nodes/{node_id}/context

The starting context a conversation inherited from its parents, as the model is given it.

PATCH /spaces/{id}/nodes/{node_id}

DELETE /spaces/{id}/nodes/{node_id}

Deletes the conversation for good, with every conversation that grew from it, so the thread stays connected.

POST /spaces/{id}/memory

Shared memory, sent with every turn in the space: up to 20 entries of 2,000 characters. PATCH and DELETE /spaces/{id}/memory/{memory_id} edit and remove one.

History

GET /conversations?assistant_id=&source=api&limit=&offset=

Conversations, newest first. source=api is the conversations of all end users; source=web, your own. Single out one user with end_user_id. Conversations inside spaces are listed with their space, not here.

POST /conversations

NameMeaning
assistant_idThe assistant.
titleTitle, optional.
end_user_idOptional.

GET /conversations/{id}?assistant_id=

The full transcript, with the sources and cost of each reply.

DELETE /conversations/{id}?assistant_id=

Moves the conversation to the trash.

Trash

Deleted spaces, threads and conversations wait in the trash for thirty days, then are deleted for good.

GET /trash?assistant_id=

What is in it, each with deleted_at and expires_at.

POST /trash/restore

{"assistant_id": "…", "kind": "space", "id": "…"}

DELETE /trash/{kind}/{id}?assistant_id=

Deletes one item for good, now. kind is space, thread or conversation.

DELETE /trash?assistant_id=

Empties the trash.

Memory and guidance

Memory is what the assistant records about an end user and uses in each of their turns. Guidance is the rules you set for all users of an assistant: tone, sources, things it should always or never say.

GET /memory?assistant_id=&end_user_id=

DELETE /memory?assistant_id=&end_user_id=

GET /guidance?assistant_id=

POST /guidance?assistant_id=

{"text": "Start every answer with a one-sentence summary."}

PATCH /guidance/{id}?assistant_id=

DELETE /guidance/{id}?assistant_id=

POST /conversations/{id}/audit?assistant_id=

Give a note about a conversation or one of its replies (turn, the message number); the model proposes rules and stores nothing.

{"note": "Prices should only have come from the pricing document.", "turn": 3}

→ {"finding": "…", "changes": [{"action": "add", "text": "…"}, {"action": "delete", "id": "…", "reason": "…"}], "model": "terra", "cost_nano": 61200}

POST /conversations/{id}/audit/apply?assistant_id=

Apply the changes you kept, edited as you like: add, update (with the rule's id) or delete. Answers what was applied and the guidance as it now stands.

{"note": "Prices should only have come from the pricing document.", "turn": 3, "finding": "…",
 "changes": [{"action": "add", "text": "Quote prices only from pricing.pdf."}, {"action": "delete", "id": "…"}]}

Usage and billing

GET /usage?assistant_id=&window=

One week's usage (window such as 2026W38, default the current week) by the hour, the number of conversations and users, each assistant's share, and the budget state.

GET /billing

Total credited, spent, balance, the top-ups made and the daily cost over the past eight weeks. An enterprise account is prepaid: once the balance runs out, requests are refused with 402.

POST /billing/topup

{"amount_nano": 50000000000, "code": "XXXX-XXXX-XXXX"}

PATCH /billing/reminder

The balance below which a reminder is emailed to the account's address, in nano-dollars; null turns it off. Two emails are sent: one when the balance drops below the threshold the account chose, and one when it is nearly gone, under one dollar.

Errors

Every error is JSON with a detail. Each code has one meaning:

NameMeaning
400Invalid value.
401Invalid key or session.
402The budget does not cover it.
403Your plan does not include this feature.
404Not found, or belongs to another account.
409Duplicate: a file, a path, or a code already used.
413Over the limit: size, file count or storage.
415File type not supported.
422The request's shape is wrong: a missing or mistyped field. The detail names it.
429Too many requests.
502 / 503 / 504The model service is unavailable or answered late; try again in a moment. Work that was started may have finished.