Create and scope an API key
After this page you can configure a scoped API key for SPM endpoints such as https://api.spmos.ai/v1.
Prerequisite: Open the SPM Console to create a key.
1. Set the authorization header
Use the key with each request to an SPM endpoint:
Authorization: Bearer spm_live_...
Anthropic-dialect clients may use x-api-key instead, an alternative authentication header. Both headers work.
2. Choose scopes
Grant only what the integration needs:
| Scope | Allows |
|---|---|
gateway:invoke |
Call /v1/chat/completions, /v1/responses, or /v1/messages. A memory-only key gets 403. |
memory:write |
Save memory through MCP remember or automatic ingest |
memory:read |
Recall memory, read evidence, and query status |
memory:delete |
Delete sources and purge memory |
memory:partition |
Select an end-user partition |
receipt:read |
Query request receipts |
The data plane API uses memory:write, memory:read, and memory:delete for saving, reading, and purging. A deletion certificate also needs audit.
Read and write scopes set the Hosted Provider Proxy's default memory mode. x-spm-memory-mode, a header that can lower the default memory mode, may lower that mode but cannot raise it above the key's limit.
3. Protect each key
Give each agent its own API key. The key limits which memory actions it can use; it does not expose your console session or provider keys.
Create one key per agent or environment. Revoke and rotate a key if you suspect exposure. Never commit a key: a committed spm_live key remains usable until revoked. SPM does not log keys, and receipts contain no key material.
Console sign-in is separate. A leaked agent key cannot open the console, and a console session cannot retrieve provider secrets.
4. Configure Local Proxy
Local Proxy keeps the SPM key and provider key in protected local configuration. It gives the downstream harness a separate random local token. The provider key goes only to the configured upstream; the SPM key goes only to hosted memory endpoints.
Treat all three values as secrets. spm config masks them; spm config token intentionally prints the local harness token.
5. Partition end users
One application key can serve multiple users. Add memory:partition and send a stable opaque user_partition, a stable identifier for one end user, with MCP remember, recall, and read calls. MCP delete and status do not accept it. Use an internal user UUID when possible. See MCP server.
A non-empty partition needs memory:partition plus the normal read or write scope. No partition uses the tenant's default space; the tenant is your account's isolated default space. Keep the same partition for saving, recalling, and reading evidence; omitting it never searches across all users.
6. Read provenance
Memory evidence carries a signed provenance label; MCP tool reference lists the values. A credential issued before the claim reports unknown rather than guessing.
Verify
curl -fsS -o /dev/null -w '%{http_code}\n' https://api.spmos.ai/health
Expected: 200.