API reference

Last updated: November 10, 2026

Read and write the memory of your users from any app: n8n, Make, Zapier, a script or your own SaaS. Base URL https://crystalbrain.ai. The same API as an OpenAPI 3.1 document: /api/v1/openapi.json.

To connect Claude or another AI assistant instead, use the MCP link https://crystalbrain.ai/api/mcp, shown with its steps on the Connections page of your dashboard.

Authentication

Create an API key on the Connections page of your dashboard and send it with every call in the header Authorization: Bearer mp_…. A key opens your whole workspace: keep it on your server, never in a browser or a mobile app.

Users, brains and apps

  • user: your customer’s ID or name in your own app. Each user has its own brains; a search never crosses users. Omit it to work on your own account. A save creates an unknown user.
  • brain: a topic of that user (billing, onboarding, a project). Omit it: a search reads all the user’s brains, a save lets CrystalBrain pick an existing brain or create one.
  • app: the name of your app, shown in your dashboard.

TypeScript SDK

For Node apps (Node 18 or later): npm install crystalbrain. Every input and result is typed from this reference, and an error throws a CrystalBrainError with the codes listed below. Methods: search, save, listBrains, mentionSkill, logToolCalls, getUser, getBrain, listMemories, getMemory, getAnalytics, resolveContradiction, similarMemories, mergeMemories, undoMerge, updateMemory, archiveMemory, createBrain, listUsers, deleteUser, restoreUser. Package on npm.

Python SDK

For Python apps (Python 3.11 or later, no dependency): pip install crystalbrain. Every input and result is typed (TypedDicts generated from this reference), and an error raises a CrystalBrainError with the codes listed below. The same methods as the TypeScript SDK, in snake_case (search, save, list_brains, update_memory, delete_user…), with keyword arguments. Package on PyPI.

POST /api/v1/search

Search a user's memory. Returns what CrystalBrain knows about one user for this request: the closest memories, passages of the brain's documents, and a ready-to-use context block for your LLM. Reads the user's brains and the brains opened to its groups. With tags, only memories holding at least one of them. When passages of images are returned, images gives a link to each image, valid one hour. Send one topic per search: a long request that mixes a customer, a rule and an action lowers the score of a memory about only one of them (a memory that names a person, company, product or code of the request is still kept).

FieldTypeDescription
query (required)stringWhat the user is asking about, in a short sentence. One topic per search: when the request mixes several (a customer, a rule, an action), search each one separately.
userstringYour customer's ID or name. Omit it for your own account. Searches never cross users.
brainstringA brain (topic) of this user, by name: one open in reading for this user (unknown or closed: an error). Omit it to use all the brains open in reading.
types(fact | preference | instruction | goal | episode | learning | decision | entity | example | procedure | term | constraint | question)[]Only these kinds of memory
tagsstring[]Only memories with at least one of these tags. Passages of documents are then left out (only memories carry tags).
limitintegerMaximum number of memories returned. Default 8.
appstringName of your app, shown among the brain's readers. Default: api.
modelstringThe AI model the search is for (its model ID), shown in Usage history and Insights.
skillsbooleanAlso return the workspace skills that fit the request (at most 2, matched by meaning), with their instructions in the context block. Default false.
as_ofstringA past date (YYYY-MM-DD, or an ISO date-time): returns what was true then. Memories replaced later (a contradiction resolved in favour of a newer one) are included and marked "true until" in the context block. Omit for what is true now.

POST /api/v1/save

Save a memory. Stores something durable about one user. CrystalBrain structures the input, may split a long exchange into several memories, picks or creates the brain when you name none, and skips near-duplicates. An unknown user is created. When the brain you name is archived, the memory is saved in the user's General brain instead and the answer says so (space, message). A memory that reads like orders to an AI is saved but held for the account owner's review (held, message). At most 60 memories written by AI apps per user in 10 minutes (429 RATE_LIMITED beyond).

FieldTypeDescription
userstringYour customer's ID or name; created on its first save. Omit it for your own account.
user_kindhuman | agentWhether this user is a person (human, the default) or an AI agent (agent). Used only when the call creates the user; change it later on the user's page in the dashboard.
brainstringA brain by name, open in writing for this user (closed: an error); created when missing, unless the user's settings forbid new brains (then an error). Omit it: the AI picks one of the brains open in writing or creates one. An archived brain is not written to: the memory goes to General.
type (required)fact | preference | instruction | goal | episode | learning | decision | entity | example | procedure | term | constraint | questionKind of memory
title (required)stringShort title
content (required)stringThe information itself, self-contained
source_textstringOptional conversation excerpt this comes from, verbatim: CrystalBrain structures it and may split it into several memories.
fieldsobjectStructured details, e.g. objective, outcome, participants, period
tagsstring[]Tags; only those allowed in the workspace (Settings › Tags, or already in use) are kept.
source_refstringYour own reference for this memory, e.g. a message ID
appstringName of your app, stored on the memory.
modelstringThe AI model that wrote it (its model ID), stored on the memory.
sourcesstring[]Documents, files or web pages your app used for this, by name or URL. Kept on the main memory (at most 20); those CrystalBrain knows are linked on the dashboard.
skillsstring[]Skills your app used for this, by name. Kept on the main memory (at most 20).
tool_callsstring[]Tools your app called for this, by name. Kept on the main memory (at most 20).

GET /api/v1/brains

List a user's brains. The user's brains, then the brains opened to its groups (read only), with their number of memories. An unknown user has none.

Query parameterTypeDescription
userstringYour customer's ID or name. Omit it for your own account.

POST /api/v1/brains

Create a brain. Creates a brain (topic) for one user, with the sentence the AI reads to pick it. When the user already has a brain with this name, that brain is returned (created: false). An unknown user is created, as on a save.

FieldTypeDescription
userstringYour customer's ID or name; created when unknown, as on a save. Omit it for your own account.
user_kindhuman | agentWhether this user is a person (human, the default) or an AI agent (agent). Used only when the call creates the user; change it later on the user's page in the dashboard.
name (required)stringThe brain's name, unique per user
descriptionstringIn one sentence, what the brain is about: the AI reads it to pick the brain

GET /api/v1/users

List your users. Your end users (groups are not listed), by name, one page at a time: call again with offset = next_offset until it is null. Active users unless status says otherwise. Users scheduled for permanent deletion are left out, whatever the status.

Query parameterTypeDescription
qstringPart of the name, external ID or email
statusactive | archived | allactive (default), archived, or all
offsetintegerRows to skip: the next_offset of the previous page. Default 0.
limitintegerRows per page. Default 50, at most 100.

GET /api/v1/user

Read a user. One user's profile, counts, latest AI activity and own brains (archived ones included), plus access: its setting against new brains and the brains opened to its groups with what the AI may do there. Like every GET below, this read changes no read counter and does not count the user as tracked.

Query parameterTypeDescription
userstringYour customer's ID or name. Omit it for your own account.

PATCH /api/v1/user

Set a user's brain access. no_new_brain: when true, the user's saves never create a brain; they go only into the brains open in writing for the user, and a memory none of them fits is not kept (save answers saved: false). brain_access: the user's exceptions for brains opened to its groups, each read and/or write, or inherit to go back to the groups' setting. Answers the user's setting and the brains of its groups with what applies.

FieldTypeDescription
userstringYour customer's ID or name. Omit it for your own account. Searches never cross users.
no_new_brainbooleanTrue: the user's saves never create a brain; they go into the brains open in writing, and a memory none of them fits is not kept
brain_access(object | object)[]The user's exceptions to its groups' settings, brain by brain

GET /api/v1/groups

List the groups of users. The workspace's groups of users, with their members and the brains opened to them (read: their members' searches read it; write: their saves may go into it). A user in several groups gets everything its groups allow.

POST /api/v1/groups

Create a group of users. Creates a group, or returns the existing one of this name or external ID (created: false). A group owns no brain and is not counted as a user: open brains to it with PATCH /api/v1/brain (groups), add members with PATCH /api/v1/group.

FieldTypeDescription
name (required)stringThe group's name
external_idstringIts ID in your app

PATCH /api/v1/group

Change a group's name or members. Renames a group and adds or removes members. A member to add that CrystalBrain does not know yet is created (not counted as a tracked user until the AI reads or writes for it); a member to remove that is not in the group is ignored. Groups and archived users cannot be members.

FieldTypeDescription
group (required)stringA group of users, by ID, external ID or name
namestringNew name
add_membersstring[]Users to add, by ID or name; a user CrystalBrain does not know yet is created
remove_membersstring[]Users to remove; one that is not a member is ignored

DELETE /api/v1/user

Delete a user permanently. For a deletion request under the GDPR. Access is closed at once: the API and the MCP refuse the user (USER_DELETION_PENDING), and the brains it opened to groups are no longer read. Seven days later, all its data (brains, memories and their previous versions, files, web pages, search history, tool calls, skill mentions) is permanently deleted; until then POST /api/v1/user/restore cancels it. Answers 202. Not available to AI assistants through the MCP. After the deletion, a save naming the same user creates a new, empty user.

Query parameterTypeDescription
user (required)stringYour customer's ID or name. Required: your own account cannot be deleted.

POST /api/v1/user/restore

Cancel a user's deletion. Cancels a deletion requested with DELETE /api/v1/user, before it happens. Nothing was deleted; the user is accepted again (an archived user stays archived).

FieldTypeDescription
user (required)stringYour customer's ID or name, as given to DELETE /api/v1/user

GET /api/v1/brain

Read a brain. One brain of a user with its framing, summary, files, web pages, saved prompts and latest memory checks, plus access: what the AI may do there for its owner and for the groups it is opened to. Its memories: GET /api/v1/memories with brain.

Query parameterTypeDescription
brain (required)stringA brain of this user, by name or ID. By ID, user is not needed.
userstringYour customer's ID or name. Omit it for your own account. Searches never cross users.

PATCH /api/v1/brain

Set what the AI may do in a brain. ai_read / ai_write: whether searches for the brain's owner read it, and whether the owner's saves and AI edits may write into it. groups: the groups the brain is opened to, each with read and/or write for their members (the list replaces the current one; [] makes it private again). A brain opened in writing to a group receives its members' saves: every member who reads it sees them, and each memory keeps which user it came from. A search, save or edit on a brain not open for that mode is refused (BRAIN_CLOSED).

FieldTypeDescription
brain (required)stringA brain of this user, by name or ID. By ID, user is not needed.
userstringYour customer's ID or name. Omit it for your own account. Searches never cross users.
ai_readbooleanSearches for the brain's owner read it (default true)
ai_writebooleanThe owner's saves and AI edits may write into it (default true)
groupsobject[]The groups this brain is opened to, with what their members' AI may do there. Replaces the current list: [] makes the brain private again; a group with read and write false is left out. Written memories keep which member they came from

GET /api/v1/memories

List a user's memories. Full memories of one user's own brains, newest first, one page at a time: call again with offset = next_offset until it is null. Active memories unless status says otherwise. An unknown user has none.

Query parameterTypeDescription
userstringYour customer's ID or name. Omit it for your own account. Searches never cross users.
brainstringOnly this brain, by name or ID. Omit it for all the user's brains.
typefact | preference | instruction | goal | episode | learning | decision | entity | example | procedure | term | constraint | questionOnly this kind of memory
tagstringOnly memories with this tag
statusactive | archived | allactive (default), archived, or all
fromstringCreated on or after this day (UTC day, YYYY-MM-DD, included)
tostringCreated on or before this day (UTC day, YYYY-MM-DD, included)
offsetintegerRows to skip: the next_offset of the previous page. Default 0.
limitintegerRows per page. Default 50, at most 100.

GET /api/v1/memory

Read a memory. One memory by ID, with the input it was structured from, the memories merged into it and its contradictions.

Query parameterTypeDescription
id (required)stringThe memory's ID

GET /api/v1/analytics

Read a user's analytics. Raw rows of one user over a period (default: the last 30 days), one kind at a time and one page at a time: activity (AI reads and writes per day), searches, tool_calls, skills, checks, contradictions, merges. An unknown user has none.

Query parameterTypeDescription
kind (required)activity | searches | tool_calls | skills | checks | contradictions | mergesactivity (AI reads and writes per day), searches (query, app, model, brain, memories returned), tool_calls, skills (mentions), checks (memory check runs), contradictions, merges
userstringYour customer's ID or name. Omit it for your own account. Searches never cross users.
fromstringFirst day. Default: 29 days before to (UTC day, YYYY-MM-DD, included)
tostringLast day. Default: today (UTC day, YYYY-MM-DD, included)
offsetintegerRows to skip: the next_offset of the previous page. Default 0.
limitintegerRows per page. Default 50, at most 100.

POST /api/v1/contradictions/resolve

Resolve a contradiction. Same as Keep A, Keep B or Keep both in the Review queue: keep one memory (the other is archived, and other open contradictions on it are closed), or keep both (the contradiction is dismissed).

FieldTypeDescription
id (required)stringThe contradiction's ID (analytics kind contradictions, or the contradictions of GET /api/v1/memory)
keep (required)string"both" to keep the two memories (the contradiction is dismissed), or the ID of the memory to keep (the other one is archived)

GET /api/v1/memory/similar

Find similar memories. The active memories of the same brain closest to one memory, with their similarity score: candidates for a merge.

Query parameterTypeDescription
id (required)stringThe memory's ID
limitintegerHow many similar memories. Default 10, at most 20.

POST /api/v1/memories/merge

Merge memories. Replaces 2 to 10 active memories of one brain by one memory whose title and content you wrote. The originals are archived and the merge shows in the Review queue, where it can be undone. Open contradictions between two of the merged memories are resolved.

FieldTypeDescription
ids (required)string[]The memories to merge, 2 to 10, all active and in the same brain. The first one gives the type, the brain and, on a clash, the fields.
title (required)stringTitle of the merged memory
content (required)stringContent of the merged memory, written by you: everything the merged memories say, nothing lost
typefact | preference | instruction | goal | episode | learning | decision | entity | example | procedure | term | constraint | questionKind of the merged memory. Default: the first memory's
appstringName of your app, stored on the merged memory. Default: api.

POST /api/v1/memories/unmerge

Undo a merge. Undoes a merge, automatic or not: its memories come back (the memory checks never merge them again) and the merged memory is archived.

FieldTypeDescription
id (required)stringID of the merged memory (source merge)

PATCH /api/v1/memory

Change a memory. Changes what you name on one memory of the user (title, content, type, tags, fields); the rest stays. You write the final text: no AI rewrite. Send append instead of content to add a dated follow-up at the end. The previous version is kept and can be restored from the Edit memory screen. Only the user's own memories: brains shared through a group are read-only.

FieldTypeDescription
id (required)stringThe memory's ID (from search, GET /api/v1/memories or GET /api/v1/memory)
userstringYour customer's ID or name: the memory must be one of this user's own (not of a brain shared through a group). Omit it for your own account.
titlestringNew title
contentstringNew content, written by you in full: it replaces the current one (no AI rewrite)
appendstringText to add at the end of the current content, stamped with today's date (UTC), instead of replacing it: a follow-up, progress or a later outcome. Not with content.
typefact | preference | instruction | goal | episode | learning | decision | entity | example | procedure | term | constraint | questionNew kind of memory
tagsstring[]The new list of tags; only those allowed in the workspace (Settings › Tags, or already in use) are kept.
fieldsobjectFields to change: each key replaces the current value, null removes it; the other fields stay.
appstringName of your app, kept with the previous version. Default: api.

POST /api/v1/memory/archive

Archive a memory. Archives one memory of the user, for instance when they ask you to forget it: searches no longer return it. Reversible: you restore it from its brain in the dashboard. Only the user's own memories.

FieldTypeDescription
id (required)stringThe memory's ID
userstringYour customer's ID or name: the memory must be one of this user's own (not of a brain shared through a group). Omit it for your own account.

POST /api/v1/skills

Report the use of a skill. Your app used a skill (reusable instructions). CrystalBrain looks for the user's own skill of that name, then a skill shared by the workspace, counts the use and returns the skill's instructions when it has them; an unknown skill is recorded by name, for that user.

FieldTypeDescription
name (required)stringThe skill's name
userstringYour customer's ID or name, when known. Never created here. Their own skill of that name comes before a shared one; an unknown skill is stored for them.
brainstringThe brain the work is about, if any
appstringName of your app, stored with the mention. Default: api.

POST /api/v1/documents

Add a document. Adds text your app has already extracted (from a PDF, a web page, its own content) as a document of one user's brain, like a file added on the dashboard: cut into passages and indexed, so searches return the passages that fit. Or adds an image (image + media_type): Claude describes it and transcribes its text, and searches return that description with a link to the image. The user is created when unknown; the brain is created when missing, General when omitted.

FieldTypeDescription
title (required)stringThe document's title, shown on the dashboard and in the passages the search returns
textstringThe document's text, already extracted by your app (4 MB at most). CrystalBrain cuts it into passages and indexes them. Send text or image, not both.
imagestringAn image (screenshot, photo, diagram), in base64 without a data: prefix. The whole request must stay under 4.5 MB, so about 3 MB of image. Claude describes it and transcribes its text; searches return that description, and a link to the image. Uses the monthly AI credit.
media_typeimage/png | image/jpeg | image/webp | image/gifThe image's type. Required with image.
userstringYour customer's ID or name; created on its first write. Omit it for your own account.
user_kindhuman | agentWhether this user is a person (human, the default) or an AI agent (agent). Used only when the call creates the user; change it later on the user's page in the dashboard.
brainstringA brain by name, created when missing. Omit it: General. An archived brain is not written to: General is used.

GET /api/v1/skills

List the skills. The active skills that have instructions, by name, with their description: the user's own skills and the skills shared by the whole workspace (shared: true). Fetch a skill's instructions by reporting its use (POST /api/v1/skills). The Chrome extension lists them so that /name in a message adds that skill.

Query parameterTypeDescription
userstringYour customer's ID or name: their own skills and the shared ones. Omit it for your own account.

POST /api/v1/skills/import

Import skills from a zip. Sends a zip of skills as multipart/form-data, in the format of Claude skills: each skill is a SKILL.md file whose front matter gives its name and description, the rest of the file being its instructions. A zip can hold several skills, one per SKILL.md (at most 50); the other files of the zip are not kept. A skill whose name the owner already has is updated (description and instructions replaced, active again, mentions kept); the others are created. Answers 400 INVALID_BODY when the file is not a zip or no SKILL.md could be read.

FieldTypeDescription
file (required)stringThe zip: one or more skills, each in a SKILL.md file (the format of Claude skills), at most 4 MB
userstringYour customer's ID or name: the skills become theirs. Never created here. Omit it: the skills are shared by the whole workspace.

POST /api/v1/tool-calls

Report tool calls. Your app reports the tools its LLM called (one call, or up to 100 in calls), with the model and the MCP server. Shown on the Tool calls page.

FieldTypeDescription
toolstringThe tool's name
modelstringThe LLM model that called it
mcp_serverstringThe MCP server the tool belongs to, if any
statusok | errorWhether the call succeeded
duration_msintegerDuration of the call in milliseconds
called_atstringISO date of the call; default: now
callsobject[]Up to 100 calls at once, instead of the single call fields
userstringYour customer's ID or name. Never created here.
brainstringThe brain the work is about, if any
appstringName of your app. Default: api.

GET /api/v1/extension/status

Chrome extension status. Used by the CrystalBrain Chrome extension: whether Claude already reaches this workspace through the MCP connector (a search by Claude through the MCP in the last 30 days). The connector belongs to the claude.ai account, so it works on every computer; the extension then stays off on claude.ai.

Webhooks

Add an endpoint on Connections › Webhooks in your dashboard and pick its events. CrystalBrain then sends a POST with a JSON body to that HTTPS URL each time one happens. A 2xx answer within 5 seconds is a success; otherwise it tries twice more, 3 and 15 seconds later. Every delivery is listed for 30 days in the dashboard, where you can resend it.

EventWhen
memory.createdSaved or merged by the AI or the API, or added in the dashboard (not imports, nor merges made by memory checks or in the Review queue).
memory.updatedIts text, type, tags or “Stop using after” date changed, or it moved to another brain: the AI or the API corrected it, it was edited or a previous version restored.
memory.archivedBy the AI or the API (the memories they merge included), in the dashboard or by resolving a contradiction (not by memory checks, merges in the Review queue or an undone merge).
contradiction.detectedA memory check found memories that contradict each other.
user.deletedA permanent deletion was carried out, 7 days after the request.
quota.reachedA new user went over the plan's monthly tracked users quota (once a month). The payload says whether that user was still served: a paid plan serves new users up to 150% of its quota.
quota.blockedA new user got no memory because the limit of tracked users is reached: the quota on Free, 150% of it on a paid plan (once a month).
credit.used_upThe workspace's monthly AI credit is used up: new memories are saved as sent and memory checks pause until the 1st (once a month).
write.failedA save failed with a server error, or stored nothing because the limit of tracked users is reached; the payload's reason says which (once a day per reason).

The body is { id, event, created_at, data }. Memory events list the memories in data.memories (ID, type, title, brain, user), never their content: read it with GET /api/v1/memory. Headers: CrystalBrain-Event, CrystalBrain-Delivery (the same id on a retry: use it to ignore duplicates) and CrystalBrain-Signature. Check the signature before trusting the body: it is t=timestamp,v1=hex, where hex is the HMAC SHA-256 of the timestamp, a dot and the raw body, keyed with the endpoint’s secret (shown once when you add it).

Errors

Every error answers {"error": "…", "code": "…"}. The code is stable: test it in your app. The message is for people and can change.

StatusCodeMeaning
400INVALID_JSONThe body is not JSON.
400INVALID_BODYA field is missing or invalid; details lists them.
400INVALID_QUERYA query parameter is missing or invalid; details lists them.
401INVALID_API_KEYThe API key is missing, unknown or revoked.
402MTU_QUOTA_REACHEDA new end user would exceed the limit of tracked users (your plan's quota on Free, 150% of it on a paid plan) on an endpoint other than search and save: brains, documents, corrections, archive. Nothing was stored. Search and save answer 200 without memory instead, with the response header x-crystalbrain-quota: exceeded.
402AI_CREDIT_EXHAUSTEDAn image needs this month's AI credit to be read, and it is used up. Nothing was stored.
403BRAIN_CLOSEDThe brain you named is not open for this user in the mode the call needs: reading for a search, writing for a save or an edit (brain settings in the dashboard).
404NOT_FOUNDNo user, brain, memory or contradiction with this name or ID. A save to an unknown brain creates it, unless the user's settings forbid new brains.
409INVALID_STATEThe action does not apply: contradiction already closed, memory archived or of another user, memories in different brains, not a merge, or a memory changed in the meantime.
409USER_ARCHIVEDThis user is archived in CrystalBrain.
409NOT_A_USERThis name is a group of users, not a user.
409NOT_A_GROUPThis name is a user, not a group of users.
409USER_DELETION_PENDINGThis user is scheduled for permanent deletion: refused until it is deleted, unless the deletion is cancelled (POST /api/v1/user/restore).
429RATE_LIMITEDToo many requests for this key this minute. Retry after the Retry-After header's seconds; the RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset headers give the limit and its window.
503EMBEDDING_UNAVAILABLEThe embedding service is busy. Retry in a moment.
500INTERNAL_ERRORUnexpected error.

Rate limits

Requests per API key and per minute, by plan. Beyond the limit a call answers 429 with the code RATE_LIMITED and a Retry-After header giving the seconds to wait.

PlanRequests per minute per key
Free60
Starter300
Pro600