Memories API

Create, retrieve, and manage memories.

Create Memory

POST /api/memories

Request Body

FieldTypeRequiredDescription
contentstringYesMemory content (max 20,000 chars)
titlestringNoHuman-readable title
scopestringNoScope key (e.g., engineering)
sourcestringNoSource identifier (e.g., GitHub, Slack)
source_urlstringNoURL where this knowledge came from
tagsstring[]NoTags for categorization
clearance_minstringNoMinimum 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

StatusDescription
401Invalid or missing agent key
403Scope denied for your role
400Content exceeds 20,000 characters

List Memories

GET /api/memories?limit=20

Query Parameters

ParameterTypeDefaultDescription
limitnumber20Number 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

StatusDescription
403Not admin or author
404Memory not found