Authentication & Scopes
Every call carries a bearer. What the credentials are, what an access level grants, what reach and the profile tick add, and how a key ends.
Every request to https://api.app.membase.com carries one header:
Authorization: Bearer <credential>There is no API-wide key, no client secret and no signature. The credential itself says who the caller is, which Memories it may touch, and what it may do to them. Both kinds of credential are minted by the account’s owner and can be narrowed or revoked by them at any time; the change applies on the credential’s next call.
The credentials
Section titled “The credentials”| Developer key | Consent token | |
|---|---|---|
| Minted by | the owner, under Connect › Developer keys | the owner, approving an app on the OAuth consent screen |
| Held by | code the owner runs: a script, a server, an SDK, an AI running the skill | an AI app: Claude, ChatGPT, Cursor, Codex, Grok, Kimi… |
| Works at | the REST API (/v1) and the MCP endpoint (/mcp-http) |
the MCP endpoint only; on /v1 it answers 401 |
| Shape | mbk_<key id>_1<random>_<checksum>, 64 characters, opaque, shown once; the key’s page keeps a hint such as mbk_7f3a92d1…c91e |
opaque; the app stores it |
| Access | Read, Read & write or Full, chosen at creation and changeable in place | the same three, chosen at consent (Read & write by default) and changeable in place; Read only, when the app asked for read access alone |
| Reach | the Memories ticked on the key, or all, including new ones | the same, ticked at consent (all, including new ones by default) |
| Profile | when Your profile is ticked: read at Read, keep a statement at Read & write, forget one at Full | the same, ticked at consent (on by default) and changeable on the app’s page |
| Can confirm a removal | yes, with confirm=true |
never: at Full a removal is refused (a tool error saying it can only request a removal) and nothing changes; the person removes the item in the Membase app |
| Expires | never, 30 days, 90 days or a year | the same choice at consent (never by default); there is no refresh: after it expires, the app authorizes again and the owner re-approves |
Which one you need: if your code holds the credential, a developer key. If the user’s AI app holds it, consent through MCP, and your code never sees a token at all. The Connect your AI tab is the consent path; the rest of this page is mostly about keys.
A third credential exists but is not minted by the owner: buying a Memory on the Marketplace
gives the buyer one. It reaches that one Memory and holds only search (search_memories,
search_media): the passages that match a query, never the fact list, documents or the
seller’s profile, and never a write. Every search re-checks the purchase and takes one call of
the period’s allowance.
Access levels
Section titled “Access levels”A level is a set of operations. Each level adds to the one before it.
| Level | Grant | Operations |
|---|---|---|
| Read | read |
search_memories, list_memories, get_memory, list_documents, get_document, list_media, get_media, search_media; list_profile_facts with the profile tick |
| Read & write | suggest |
Read, plus add_memory, add_document; add_profile_fact with the profile tick |
| Full | manage |
Read & write, plus forget_memory, delete_document, delete_media, and forget_profile_fact with the profile tick, each only with confirm=true |
GET /v1/capabilities names the actions a credential holds (actions), the Memories it
reaches (memories) and the standing rules for using them (rules). It is not permission:
every call is still checked when made.
ask_memory is on no developer key or AI app, at any level, and no marketplace credential
holds it: from any of them the call is refused with 403 like any verb outside its grant. The
profile tools and ask_memory are explicit: a credential holds them only when its tool list
names them, never from its level alone. The API reference
lists each level’s ceiling from the tool table itself, which is why ask_memory appears under
Read there; a key never reaches it.
A call above the key’s level is refused with 403 and code: unauthorized, and the key’s
page counts it as a refused call. The level can be raised or lowered on the key’s page
without re-minting: the token stays the same and the next call has the new level. A Read
key raised to Read & write can write on its next call.
Reach is the list of Memories a credential may use. It is switched on the key’s or app’s page under Memories it can use, or on a Memory’s own page under Use in; both are the same switch. A key created with All your memories, including new ones reaches every Memory the account has now or later.
No request names a Memory. Searches and lists cover every Memory in reach and leave the
others out; an id from a Memory outside the reach reads exactly like one that does not exist:
404 · not_found. GET /v1/capabilities (over MCP, get_capabilities) never names a
Memory outside the reach, so a client cannot tell withheld from absent.
Writes land in the key’s write target: the Memory chosen under Writes go to on the
key’s page, or the only text Memory it reaches. Create key picks one when the key reaches
several. A key that reaches several text Memories and has none chosen (its target left its
reach, say) is refused on add_memory and add_document with 422 write_target_required,
and nothing is written somewhere by guess. To write, choose the Memory under Writes go to.
The profile tick
Section titled “The profile tick”The profile is a list of standing statements about the person (pf_…): their name, role,
lasting preferences. It is the account’s, not part of any Memory, so reach does not cover it.
A credential reaches it only when the owner ticked Your profile on the key or at
consent; without the tick no profile operation is offered at all.
What the tick grants follows the key’s level:
| Level | With the profile tick |
|---|---|
| Read | list_profile_facts |
| Read & write | also add_profile_fact |
| Full | also forget_profile_fact, with confirm=true |
An AI app with the tick holds the same profile tools as a key of its level. A key minted
before the profile became a list of facts holds only the read (list_profile_facts), granted
under its retired name get_profile, until the owner changes the key. The tick can be changed on the key’s or app’s
page at any time.
Destructive operations
Section titled “Destructive operations”forget_memory, delete_document, delete_media and forget_profile_fact need the Full
level, and even then they do not run on their own: a call without confirm=true changes nothing and answers
428 confirmation_required, naming the target by its public id:
{ "error": { "code": "confirmation_required", "message": "Pass confirm=true to forget this memory.", "details": { "id": "mem_…", "verb": "forget_memory", "content": "…", "how": "…" }, "retryable": false, "trace_id": "…" } }The how sentence is what to relay to the person. Pass confirm=true only after they
agreed; from a developer key that counts as the owner’s confirmation. An AI app’s confirm
never does: at Full its call always answers 428, and the how sentence asks the person
to confirm in the Membase app. A Read & write key or app gets 403 · unauthorized · tool 'delete_document' is not in this agent's capability profile.
Expiry, rotation, revocation
Section titled “Expiry, rotation, revocation”- Expiry is chosen at creation (never, 30 days, 90 days or a year in the app; any 1–3650 days through the API) and cannot be extended on an existing key; rotate instead. An expired key answers
403withcode: unauthorized, and its row moves to Expired. - Rotate… pre-fills a new key with the old key’s level, reach, profile tick and the same expiry duration counted from now, and asks what to do with the old one. By default the old one keeps working until you revoke it, so you can swap the value in your environment first. From the API you pass those fields yourself;
replaces: <old id>only records the lineage. - Revoke… ends a key at once. Every holder of the token fails on its next call. The key stays listed under Revoked for thirty days so you can see what it was.
- Revoke… on an AI app’s page ends that app’s access at once. Removing the connector inside the app may not tell Membase; revoke on Connect to be sure.
Revocation and permission changes apply to subsequent requests. They do not remove content already received or stored by an external client.
What a wrong credential looks like
Section titled “What a wrong credential looks like”| Answer | Meaning |
|---|---|
401 |
no bearer at all, or a consent token on a /v1 route: it is issued for the MCP endpoint and works only there (REST; the MCP endpoint differs, below) |
403 · unauthorized |
an unknown, expired or revoked token, or a verb above the level. The message says which. |
403 · unauthorized · This key's access level does not allow this. |
a write verb (add_memory, add_document, delete_document, forget_memory) from a Read key or app |
403 · unauthorized · not in this agent's capability profile |
a verb the level does not grant: delete_document or forget_memory from a Read & write key or app, list_profile_facts without the profile tick |
404 · not_found |
an id outside the reach, deleted, of the wrong type or not one of ours: all answer alike |
On the REST endpoints the status is 403 and not 401 for a bad token on purpose: the
request was authenticated as some caller (the key id is in the token) and that caller is
not allowed. Only a request with no bearer, or with a consent token, is 401.
The MCP endpoint (/mcp-http) follows the OAuth convention instead and answers 401 in
both cases, with a flat body rather than the {"error": {"code", …}} envelope:
- No bearer:
WWW-Authenticate: Bearer resource_metadata="https://api.app.membase.com/.well-known/oauth-protected-resource/mcp-http"and{"error": "unauthorized", "error_description": "…"}. - An invalid, expired or revoked bearer:
WWW-Authenticate: Bearer error="invalid_token", resource_metadata="…"and the RFC 6750 body{"error": "invalid_token", "error_description": "…"}.
Managing keys from code
Section titled “Managing keys from code”Keys are managed with the owner’s own session, the credential the Membase app holds after sign-in, and never with a developer key: a key cannot mint, widen or revoke another key. The screen for the same operations is Connect › Developer keys.
| Call | Does |
|---|---|
POST /v1/keys/create |
mint a key: name, profile (read, suggest or manage for Read, Read & write, Full), view_ids (its Memories) or all_views: true, profile_access, write_view_id (where its writes go), expires_in_days (1–3650; omit for never), replaces (the key it rotates out) |
POST /v1/keys/{id}/update |
change name, profile, profile_access or all_views; the next call reads the new grant |
POST /v1/access/{id}/update |
the same for a key or an AI app, plus view_ids and write_view_id |
POST /v1/access/{id}/memories/set |
change its Memory list |
GET /v1/keys/{id}/usage |
calls per day, refusals, per tool, the last twenty |
POST /v1/access/{id}/revoke |
revoke it, at once |
OAuth, for an app that connects over MCP
Section titled “OAuth, for an app that connects over MCP”The MCP server at https://api.app.membase.com/mcp-http advertises its authorization the
standard way, so any MCP client that speaks OAuth connects without a Membase-specific step:
- An unauthenticated request answers
401with aWWW-Authenticatepointing at the protected-resource metadata (/.well-known/oauth-protected-resource/mcp-http, RFC 9728). - The protected-resource metadata names the authorization server; the authorization-server metadata (
/.well-known/oauth-authorization-server, RFC 8414) names the registration endpoint (/oauth/register). The client registers itself dynamically (RFC 7591) and starts the authorization code flow with PKCE (S256). - The browser opens Membase’s consent screen, the same form as Create key: access level, the Memories the app may use, Your profile, where its writes go and when it expires. It starts at Read & write, every Memory, the profile on and no expiry. A client that asked only for the
readscope can be approved at Read only. The owner adjusts and approves. - The client receives a token good for exactly that.
tools/liston that token offers the tools of the approved level, as for a key. The token is not refreshed (grant_types_supportedisauthorization_codeonly): if it has an expiry, when that ends the app authorizes again and the owner re-approves.
A client that cannot do OAuth sends a developer key in the same Authorization header
instead, and gets the key’s level.
Keep the token out of the open
Section titled “Keep the token out of the open”- Read the key from the environment (
MEMBASE_API_KEY), never from source. - Log the hint from the key’s page, never the token.
- Do not put a key in a config file you commit or publish; the ready-made client configs Membase serves carry no header for that reason.
- One key per thing that holds it, named after it, so a revocation stops one thing.