You’ll use this when…
- Your services already talk to REST APIs and you want Mem0 to match that style.
- Teams on languages without the Mem0 SDK still need access to memories.
- You plan to explore or debug endpoints through the built-in OpenAPI page at
/docs.
Feature
- CRUD endpoints: Create, retrieve, search, update, delete, and reset memories by
user_id,agent_id, orrun_id. - API key authentication: Optionally secure all endpoints with a shared API key via the
X-API-Keyheader. - Status health check: Access base routes to confirm the server is online.
- OpenAPI explorer: Visit
/docsfor interactive testing and schema reference.
Configure it
Run with Docker Compose (development)
- Steps
- Create
server/.envwith your keys:
- Start the stack:
- Reach the API at
http://localhost:8888. Edits to the server or library auto-reload.
Run with Docker
- Pull image
- Build locally
- Create a
.envfile withOPENAI_API_KEY. - Run the container:
- Visit
http://localhost:8000.
Run directly (no Docker)
The REST server reads the same configuration you use locally, so you can point it at your preferred LLM, vector store, graph backend, and reranker without changing code.
Authentication
The server supports optional API key authentication. When theADMIN_API_KEY environment variable is set, every endpoint requires a valid X-API-Key header. The / redirect, /docs, and /openapi.json routes remain open so you can always reach the interactive API explorer.
ADMIN_API_KEY value | Behavior |
|---|---|
| Not set / empty | All endpoints are open (no auth) |
| Any non-empty string | Requests must include X-API-Key: <your-key> |
Enable authentication
Add the key to your.env file:
See it in action
Create and search memories via HTTP
Expect a JSON response containing the new memory IDs and events (
ADD, etc.).Explore with OpenAPI docs
- Navigate to
http://localhost:8000/docs. - Pick an endpoint (e.g.,
POST /search). - Fill in parameters and click Execute to try requests in-browser.
Endpoint reference
The OSS REST server exposes the following endpoints. None use the/v1/ prefix.
| Method | Path | Description |
|---|---|---|
POST | /configure | Set memory configuration |
POST | /memories | Create memories |
GET | /memories | Get all memories (filter by user_id, agent_id, or run_id) |
GET | /memories/{memory_id} | Get a specific memory |
PUT | /memories/{memory_id} | Update a memory |
DELETE | /memories/{memory_id} | Delete a specific memory |
DELETE | /memories | Delete all memories for an identifier |
GET | /memories/{memory_id}/history | Get memory history |
POST | /search | Search memories |
POST | /reset | Reset all memories |
Verify the feature is working
- Hit the root route and
/docsto confirm the server is reachable. - Run a full cycle:
POST /memories→GET /memories/{id}→DELETE /memories/{id}. - Watch server logs for import errors or provider misconfigurations during startup.
- Confirm environment variables (API keys, vector store credentials) load correctly when containers restart.
Best practices
- Enable authentication: Set
ADMIN_API_KEYto secure all endpoints, or use an API gateway for more advanced schemes. - Use HTTPS: Terminate TLS at your load balancer or reverse proxy.
- Monitor uptime: Track request rates, latency, and error codes per endpoint.
- Version configs: Keep environment files and Docker Compose definitions in source control.
- Limit exposure: Bind to private networks unless you explicitly need public access.
Configure OSS Components
Fine-tune LLMs, vector stores, and graph backends that power the REST server.
Automate Agent Integrations
See how services call the REST endpoints as part of an automation pipeline.