REST API
Full HTTP API for managing memories programmatically. All endpoints require authentication via API key.
Base URL: https://cortex-mem.com/api
POST
/memories
Save a new memory.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| content | string | Yes | The memory content to save |
| tags | string[] | No | Categorization tags |
| agent_id | string | No | Agent identifier for scoping |
| importance | number | No | 0.0-1.0, higher values decay slower |
| session_id | string | No | Session identifier |
Example
POST /api/memories
Authorization: Bearer ctx_your_key
Content-Type: application/json
{
"content": "User prefers dark mode and Python",
"tags": ["preference"],
"agent_id": "my-agent",
"importance": 0.8
}GET
/memories/search
Search memories by semantic meaning.
Query Parameters
| Param | Required | Description |
|---|---|---|
| q | Yes | Natural language search query |
| limit | No | Max results (default 10) |
| tags | No | Comma-separated tags to filter by |
| agent_id | No | Filter by agent |
Example
GET /api/memories/search?q=user+preferences&limit=5 Authorization: Bearer ctx_your_key
PUT
/memories/:id
Update an existing memory.
Example
PUT /api/memories/mem_abc123
Authorization: Bearer ctx_your_key
Content-Type: application/json
{
"content": "User prefers dark mode, Python, and VS Code",
"tags": ["preference", "tools"]
}DELETE
/memories/:id
Permanently delete a memory.
Example
DELETE /api/memories/mem_abc123 Authorization: Bearer ctx_your_key
Response Format
All responses return JSON. A memory object looks like:
{
"id": "mem_abc123",
"content": "User prefers dark mode and Python",
"tags": ["preference"],
"agent_id": "my-agent",
"importance": 0.8,
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:30:00Z",
"score": 0.92
}