API Overview
Authentication, base URL, and permission levels for the MemLib REST API
Base URL
https://mem.anishroy.com/api/v1All endpoints are prefixed with /v1.
Authentication
Every request requires an API key in the Authorization header:
Authorization: Bearer sk_your_api_keyAPI keys are created from the project dashboard and are scoped to a single project.
Permission Levels
Each API key has a permission level that controls which endpoints it can access:
| Level | Name | Operations |
|---|---|---|
| 1 | Read | list, recall, prepare, diff, events, health |
| 2 | Read & Write | All Read + store, batchStore |
| 3 | Admin | All Read & Write + delete, consolidate, migrate |
If a request uses an API key without the required permission, the API returns 403 Forbidden.
Request Format
- Content-Type:
application/jsonfor all POST/PUT requests - Query parameters for GET requests
- Path parameters for resource-specific endpoints (e.g.,
/memory/{memoryId})
Response Format
All responses return JSON. Successful responses return the resource data directly. Error responses follow this format:
{
"error": "Human-readable error message"
}Error Codes
| Status | Meaning |
|---|---|
200 | Success |
400 | Bad Request — invalid or missing fields |
401 | Unauthorized — invalid or missing API key |
403 | Forbidden — insufficient permission level |
404 | Not Found — resource doesn't exist |
500 | Internal Server Error |
Endpoints Summary
| Method | Path | Permission | Description |
|---|---|---|---|
POST | /memory | Read & Write | Store a memory |
POST | /memory/recall | Read | Semantic search |
POST | /memory/prepare | Read | Context synthesis |
POST | /memory/diff | Read | Memory changelog |
GET | /memory | Read | List memories |
POST | /memory/batch | Read & Write | Batch store |
DELETE | /memory/{memoryId} | Admin | Delete a memory |
GET | /memory/events | Read | Audit trail |
POST | /memory/consolidate | Admin | Consolidate old memories |
GET | /health | None (public) | Basic health check |
GET | /memory/health | Read | Memory service health check |