Create, retrieve, and manage memories.
Create Memory
POST /api/memories
Request Body
| Field | Type | Required | Description |
|---|
content | string | Yes | Memory content (max 20,000 chars) |
title | string | No | Human-readable title |
scope | string | No | Scope key (e.g., engineering) |
source | string | No | Source identifier (e.g., GitHub, Slack) |
source_url | string | No | URL where this knowledge came from |
tags | string[] | No | Tags for categorization |
clearance_min | string | No | Minimum clearance level (default: Contractor) |
Headers
Authorization: Bearer crtx_YOUR_KEY_HERE
Content-Type: application/json
Response
{
"memory": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"title": "API Rate Limiting Policy",
"scope": "engineering",
"status": "active",
"created_at": "2025-01-15T10:30:00Z"
},
"conflict_candidates": [
{
"memory_id": "existing-uuid",
"score": 0.82
}
]
}
Error Responses
| Status | Description |
|---|
401 | Invalid or missing agent key |
403 | Scope denied for your role |
400 | Content exceeds 20,000 characters |
List Memories
GET /api/memories?limit=20
Query Parameters
| Parameter | Type | Default | Description |
|---|
limit | number | 20 | Number of memories (max 50) |
Response
{
"memories": [
{
"id": "uuid",
"title": "API Rate Limiting Policy",
"content": "All external API endpoints...",
"scope": "engineering",
"source": "GitHub",
"author": "John Doe",
"created_at": "2025-01-15T10:30:00Z"
}
]
}
Get Memory
GET /api/memories/[id]
Response
{
"memory": {
"id": "uuid",
"title": "API Rate Limiting Policy",
"content": "All external API endpoints must implement rate limiting...",
"scope": "engineering",
"source": "GitHub",
"source_url": "https://github.com/org/repo/pull/123",
"author": "John Doe",
"tags": ["api", "security"],
"clearance_min": "Contractor",
"status": "active",
"created_at": "2025-01-15T10:30:00Z"
}
}
Delete Memory (Redact)
POST /api/memories/[id]/redact
Redacts a memory — status becomes redacted, vector is removed, but the Postgres row is retained for provenance.
Only an admin (CEO) or the memory's author can redact a memory.
Response
{
"ok": true
}
Error Responses
| Status | Description |
|---|
403 | Not admin or author |
404 | Memory not found |