Memory
List, search, store and delete your persistent memories — the same store the MCP memory tools use.
Persistent memory holds the facts, preferences and decisions codai remembers about you across sessions and tools. These routes expose the same store as the MCP tools memory_list, memory_search, memory_store and memory_forget: a memory saved through one surface is visible on the other.
Scope and availability
- Memories belong to your account. A key minted for a third-party app sees only that app's memories.
- Memory needs a plan with persistent memory; without it every route answers
403 memory_not_enabled. When memory is not configured on the gateway the answer is503 memory_unavailable. - Environment (daemon) keys cannot call these routes.
- A failure of the memory store answers
500 memory_errorfor that request only; inference is never affected.
Cost
GET /v1/memory and DELETE /v1/memory/{id} do not call a model. Search and create embed the text once each and appear in your usage as memory:search and memory:create.
const { id } = await client.memory.create({ content: 'Invoices are issued in RON.' });
const { memories } = await client.memory.search({ q: 'currency for invoices' });
await client.memory.delete(id);bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
tier?stringOnly this memory tier.
"semantic""episodic""procedural""graph"limit?integerPage size.
1 <= value <= 10020offset?integerRecords to skip.
0 <= value0x-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128One page of memories and the total count.
application/json- response
memories*array<>total*integerTotal memories matching the filter.
0 <= valuecurl -X GET 'https://ai.codai.ro/v1/memory'{ "memories": [ { "id": "string", "tier": "semantic", "content": "string", "importance": 0, "createdAt": "2019-08-24T14:15:22Z" } ], "total": 0}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
q*stringWhat to look for (natural language).
1 <= length <= 2000limit?integerMaximum number of results.
1 <= value <= 105x-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Matching memories, most relevant first.
application/json- response
memories*array<>curl -X GET 'https://ai.codai.ro/v1/memory/search?q=string'{ "memories": [ { "id": "string", "tier": "semantic", "content": "string", "relevance": 0 } ]}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
x-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128application/json- body
content*stringThe fact to remember, one clear sentence.
1 <= length <= 4000importance?numberImportance from 0 to 1.
0 <= value <= 10.6Stored; the new memory id.
application/json- response
id*stringcurl -X POST 'https://ai.codai.ro/v1/memory' \ -H 'Content-Type: application/json' \ -d '{ "content": "string"}'{ "id": "string"}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
id*stringMemory id (from list or search).
length <= 128x-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Deleted.
application/json- response
deleted*booleancurl -X DELETE 'https://ai.codai.ro/v1/memory/string'{ "deleted": true}