REST API overview
Base URLs, authentication, the response and error shapes, and a reference page for every one of Brain's 60 data-plane and broker routes — plus the two health probes.
Base URL
Point the base URL at your own deployment. brain-edge listens on
0.0.0.0:8080 by default (BRAIN_EDGE_LISTEN), so:
| Deployment | Base URL |
|---|---|
| Self-hosted | http://<your-host>:8080 — or whatever host and port you put in front of brain-edge |
| Local dev | http://127.0.0.1:8080 — a brain-edge on the default port |
There is no public managed host to point at
This reference does not name a hosted endpoint, because there is not one you
can resolve today. If you are on the managed tier, use the base URL your
onboarding gave you; otherwise run brain-edge yourself and use its
address.
Examples here read the base from BRAIN_BASE_URL rather than hardcoding a
host, so a snippet runs wherever your Brain is:
export BRAIN_BASE_URL=http://127.0.0.1:8080 # self-host default
export BRAIN_API_KEY=brain_…Unset, the samples fall back to http://127.0.0.1:8080 — the same default the
Python and TypeScript clients use when you omit the base URL, and what
BrainHttpClient::localhost gives you in Rust.
Every data-plane route lives under /v1, except the LLM broker's, which live
under /llm. Health probes sit outside both — see Health probes.
Authentication
Send your key as Authorization: Bearer <key>. The self-host edge also accepts
X-API-Key. The key carries the identity — there is no namespace, space or
scope header. See Authentication.
Response shape
Successful responses return the resource JSON directly. There is no
{ data: … } envelope:
{
"memory_id": "20177564117…",
"was_deduplicated": false,
"salience": 0.62,
"kind": 0,
"created_at_unix_nanos": 1752969600000000000,
"auto_edges_added": 2
}Field names are snake_case throughout, in both bodies and query strings. A
query parameter sent under the wrong name is not an error — it silently
takes the field's default, so a filter appears to be applied and is not.
Error shape
{
"error": { "code": "not_found", "message": "memory 42 not found" }
}code is the stable handle — branch on it, never parse message. All fifteen
codes, their statuses, and what is safe to retry are at
Errors.
Identifiers and time
- Memory ids are 128-bit values rendered as a decimal string.
- Entity, statement and relation ids are hyphenated UUID strings.
- All timestamps are unsigned unix-nanosecond integers (
*_unix_nanos), except the credential routes'created_at_unix_secs, which is seconds.0means unset.
64-bit values exceed what IEEE-754 doubles hold exactly, so a client that routes them through a stock JSON parser rounds them. The SDKs do not.
Pagination
Seven routes page with an opaque cursor; four bound their result another way, and two of those report a partial answer with a flag rather than a cursor. The distinction matters — see Pagination.
Idempotency
Write verbs carry a request id on the wire, and Brain deduplicates a replay
with identical parameters; a replay under the same id with different
parameters is a conflict. Over HTTP the edge generates this id per request.
Every route
Routes are grouped exactly as the SDK sections are, so /api/memory/encode
and /sdk-python/memory/encode are the same operation seen from the two
sides.
Transactions are wire-only
There is no HTTP transaction surface. Each route is its own unit. Grouping writes atomically requires the native wire protocol — see Transactions.
Health probes
Two more routes are served, outside /v1 and outside the table above. They
take no credential and return no body — only a status — so they are safe
to expose to an orchestrator that has no key.
| Method | Path | Returns |
|---|---|---|
GET | /health/live | 200 whenever the process is up. A static liveness signal; it does not touch Brain. |
GET | /health/ready | 200 once a TCP connection to Brain opens inside the probe budget, 503 otherwise. |
Use /health/ready as the gate on routing traffic: it answers 503 while the
database behind the edge is unreachable, which is exactly the window in which
a /v1 call would fail with engine.unavailable. /health/live stays 200
through that window, so restarting on it would be wrong.
They are on the binary, not the library router
brain-edge's reusable router — the one a host application merges — does
not register /health/*, so that host can own health itself without a
path collision. The brain-edge binary merges the two probes above on top
of it, and does so on either plane. So a stock self-hosted deployment serves
them; an embedding application may serve its own instead.
Shared pages
| Page | What it covers |
|---|---|
| Authentication | Headers, what a key binds, whoami |
| Errors | The envelope, all fifteen codes, retry rules |
| Pagination | Cursors, and the two kinds of incompleteness |
| Rate limits | Plan metering, back-pressure, body cap, timeout |
| API keys | The admin plane that mints data-plane keys |
Was this page helpful?