REST API overview
Base URLs, Bearer / X-API-Key authentication, the JSON response and error shapes, keyset pagination, and the map of every Brain HTTP endpoint.
Base URL
| Deployment | Base URL |
|---|---|
| Managed (cloud) | https://api.arc-labs.ai/v1 |
| Self-hosted | http://<your-host>:8080/v1 |
| Local dev | http://127.0.0.1:8080/v1 |
Every documented data-plane path is relative to one of these bases and lives under /v1. Health probes are the only exception: GET /health/live (static liveness) and GET /health/ready (readiness — 200 only once Brain is reachable) sit at the root, outside /v1, and are served by the self-host binary.
Authentication
Send your API key in either header — they are equivalent:
Authorization: Bearer <key>X-API-Key: <key>There is no key prefix to match on and no per-request scope headers. An API key is bound to a (namespace, agent) pair when it is created; the server resolves the caller's identity, namespace, and permissions from the key alone. A missing or blank credential returns 401 unauthorized. See Authentication for the full model.
Response shape
Successful responses return the resource JSON directly — there is no { data: … } envelope. For example, POST /v1/memories returns:
{
"memory_id": "20177564117...",
"was_deduplicated": false,
"salience": 0.62,
"kind": 0,
"created_at_unix_nanos": 1752969600000000000,
"auto_edges_added": 2
}List endpoints return a named collection field (items, entities, statements, relations, nodes/edges) alongside either a count or a next_cursor, depending on the resource.
Error shape
Every non-2xx response uses one envelope:
{
"error": {
"code": "not_found",
"message": "memory 42 not found"
}
}code is the stable, machine-readable handle — branch on it, never parse message. The edge maps Brain's internal error taxonomy to a small set of HTTP-layer codes (unauthorized, forbidden, bad_request, not_found, conflict, engine.unavailable, engine.error). The full catalog, the nine underlying categories, and retry semantics live at Errors.
Identifiers
Two id shapes appear in payloads:
- Memory ids are 128-bit values rendered as a decimal string (e.g.
"20177564117..."). They are used in/v1/memories,/v1/recall,/v1/links, andmemorynodes in/v1/graph. - Entity, statement, and relation ids are rendered as hyphenated UUID strings (e.g.
"0a1b2c3d-…").
All timestamps are unsigned unix-nanosecond integers (*_unix_nanos). 0 means "unset".
Pagination
Two list endpoints — GET /v1/memories and GET /v1/graph — use keyset (cursor) pagination. Each page carries an opaque hex next_cursor; pass it back as ?cursor=<value> to fetch the next page. next_cursor is omitted entirely when the enumeration is exhausted.
GET /v1/memories?limit=50
GET /v1/memories?limit=50&cursor=1a2b3c…Cursor strings are opaque — never decode or construct them. The typed-graph list endpoints (/v1/entities, /v1/statements, /v1/entities/{id}/relations) return a single bounded page with a count and no cursor; raise limit (clamped per endpoint) to widen the page.
Idempotency
Write verbs carry a request id on the wire, and Brain deduplicates replays with identical parameters inside a 24-hour window (a differing-parameter replay under the same id is a conflict). Over HTTP the edge generates this id per request; safe retries on a network error are handled by the SDKs' retry policy. See Errors for conflict semantics.
Endpoint map
| Page | Endpoints |
|---|---|
| Authentication | GET /v1/whoami, header contract, scope binding |
| Memories | POST /v1/memories, GET /v1/memories, DELETE /v1/memories, GET /v1/memories/{id}/inspect |
| Recall | POST /v1/recall |
| Graph | GET /v1/graph, POST /v1/links, DELETE /v1/links |
| Entities | POST/GET /v1/entities, POST /v1/entities/resolve, GET /v1/entities/{id}, POST /v1/entities/{id}/traverse, GET /v1/entities/{id}/relations, GET /v1/statements(/{id}), GET /v1/relations/{id} |
| Errors | Error envelope, category catalog, retry semantics |
| Rate limits | Managed-cloud quotas, 429/503 behavior |
| API keys | Control-plane — key lifecycle (dashboard) |
| Org | Control-plane — tenancy and members (dashboard) |
GET /v1/whoami returns the identity Brain resolved from your credential — use it as a connection and auth probe. GET /v1/capabilities, POST /v1/plan, and POST /v1/reason are available on the self-host edge; the managed gateway may omit them. This section documents the stable, cross-deployment surface.
Was this page helpful?
Graph queries
When to reach past recall into the typed graph — resolve an entity, read its relations, traverse from an anchor, and export the whole graph.
Authentication
Bearer and X-API-Key auth, how an API key binds a (namespace, agent) scope, cross-namespace isolation, and the whoami identity probe.