Authentication
Memanto uses a server-side Moorcheh API key combined with per-agent session tokens to scope memory operations. API clients do not send anAuthorization header — the Moorcheh key is configured on the Memanto server (via MOORCHEH_API_KEY) and validated at startup.
Server (Moorcheh)
Memanto reads
MOORCHEH_API_KEY from its environment / configuration and authenticates on the server when calling Moorcheh.Memory Operations (Client)
Memory endpoints require a session token in the
X-Session-Token header. Tokens are obtained by activating an agent.Server-Side Moorcheh API Key
Memanto does not accept a Moorcheh API key from clients. The key is set once on the server and is used for every Moorcheh call Memanto makes:MOORCHEH_API_KEY is not configured or MOORCHEH_API_KEY is invalid.
Getting a Moorcheh API Key
- Go to https://console.moorcheh.ai/api-keys
- Create a new API key
- Configure it on the Memanto server (env var, secrets manager, etc.)
Session Token Authentication
When Session Tokens Are Required
Memory operations require anX-Session-Token header obtained from agent activation:
POST /api/v2/agents/{agent_id}/rememberPOST /api/v2/agents/{agent_id}/batch-rememberPOST /api/v2/agents/{agent_id}/upload-filePOST /api/v2/agents/{agent_id}/recallPOST /api/v2/agents/{agent_id}/recall/as-ofPOST /api/v2/agents/{agent_id}/recall/changed-sincePOST /api/v2/agents/{agent_id}/recall/recentPOST /api/v2/agents/{agent_id}/answerGET /api/v2/agents/{agent_id}/conflictsPOST /api/v2/agents/{agent_id}/conflicts/resolvePOST /api/v2/agents/{agent_id}/deactivate
agent_id in the path; otherwise the request is rejected.
Endpoints That Do Not Require a Session Token
These endpoints only need the server to be running (no client-side credentials):POST /api/v2/agents— Create agentGET /api/v2/agents— List agentsGET /api/v2/agents/{agent_id}— Get agent detailsDELETE /api/v2/agents/{agent_id}— Delete agentPOST /api/v2/agents/{agent_id}/activate— Activate (returns the token)GET /api/v2/status— Inspect the active session
Getting a Session Token
- Activate an agent:
- Response contains a session token:
- Use the token in subsequent requests:
Example Request with Session Token
In Python
Session Token Details
Token Format
Session tokens are JWT (JSON Web Tokens):Token Expiration
- Duration: configured by the server via
SESSION_DEFAULT_DURATION_HOURS(typically 6 hours). - Auto-renewal: Memanto auto-renews sessions that are near expiry on the next memory request.
- Renewal: activate a new session with
POST /api/v2/agents/{agent_id}/activate.
Decode Token (Python)
Common Errors
Missing Session Token
X-Session-Token.
Invalid Session Token
Session Expired
POST /api/v2/agents/{agent_id}/activate.
Session / Agent Mismatch
If the session token was issued for a different agent than the one in the URL path, the server returns500 with:
agent_id.
Best Practices
DO
- Store
MOORCHEH_API_KEYas a server-side secret (env var, Secrets Manager, etc.) - Keep session tokens in memory on the client (don’t persist long-term)
- Rotate the Moorcheh key periodically
- Treat session tokens as sensitive — they grant memory access for an agent
DON’T
- Commit
MOORCHEH_API_KEYto source control - Send the Moorcheh key from clients (Memanto does not read it from request headers)
- Reuse a session token across different agents
- Log session tokens to files or telemetry
Security
API Key Management
Development:Session Token Security
- Tokens are JWT — treat as sensitive
- Don’t log tokens
- Don’t expose in client-side code that ships to end users
- Short-lived (configurable, default ~6 hours)
- Unique per activation
Next Steps
- Activate Agent to obtain a session token
- Get Current Session to inspect the active session
- Remember to start storing memories