Skip to content

API

API overview and authentication

The REST API at https://www.epiccontext.com/api/v1 is for scripts, CI and apps that read or write the brain without a person signing in. It authenticates with an organisation's API key, sent as a bearer token.

People and AI tools do not need the API: they use the book and the MCP connector, with their own sign-in. Use the API when code has to talk to the brain on its own: a pipeline that exports the context, a CI job that checks drift, an app that hands over what happened.

Base URL

https://www.epiccontext.com/api/v1

Use the www host. The bare domain redirects to it, and a redirect breaks requests from browsers (CORS preflights) and from some HTTP clients.

Authentication

Every request carries an API key as a bearer token:

curl -H "Authorization: Bearer eck_live_…" \
  "https://www.epiccontext.com/api/v1/projects/$PROJECT_ID/blocks"

Creating a key. An owner or admin opens Settings › Organisation › API keys, gives the key a name and chooses Create key. The full key is shown once; copy it then. Keys start with eck_live_.

What a key may do.

  • A key belongs to an organisation and works for its projects. A key can also be bound to one project, or to an app's profile; it is then refused everywhere else.
  • A key carries scopes: read for reading, write for writing, sync for apps that hand over episodes. Keys created in Settings carry all three.
  • A key works until it is revoked, unless it was given an expiry. Revoke it from the same page. A key is also revoked when the person who made it leaves the organisation or is removed from it, and when its project is deleted.
  • A key can never lock or unlock a block, or create an organisation.

Finding the project id. The .epicontext file on Your setup shows it, and over MCP list_projects lists it per project.

Responses and errors

Responses are plain JSON without a wrapper: a list is { "blocks": [...], "total": 12 }, one block is { "block": {...} }, an error is { "error": "..." }.

StatusWhen
400The request or the value is invalid; schema failures add issues, each with a field, a message and a severity
401No key, a malformed key, or a key that is invalid, revoked or expired
403The key lacks a scope (the body names required and available), is bound to another project, or the block is locked ("code": "BLOCK_LOCKED")
404The project or block does not exist, or the key cannot see it
409A version conflict (the block changed since the version you sent), a block with that key already exists, or the block is inherited from the organisation ("code": "ORG_BLOCK")

Writing safely

  • Give a reason. Every write accepts a reason, shown beside the change in the changes feed. Always send one: a write without it lands, with a warning that says the feed cannot tell why.
  • Send the version you read. PUT and PATCH accept expectedVersion; when someone changed the block since, you get a 409 instead of overwriting their work.
  • Expect locks. A locked block refuses every writer with a 403 and BLOCK_LOCKED. Report it; do not work around it.

Limits

The API does not publish a general rate limit. A few routes that can be abused (comments from the review widget, client registration) answer 429 with a Retry-After header when called too often. Respect it and retry later.

Other tokens

  • Widget tokens (ecw_…) are public tokens for the review widget. They only allow what the widget does.
  • Suite apps prove who they are with their own signed identity, not with an API key. A tool you build for the suite uses a manifest.

Next

Last updated: