codai docs
API referenceGateway

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 is 503 memory_unavailable.
  • Environment (daemon) keys cannot call these routes.
  • A failure of the memory store answers 500 memory_error for 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);
GET
/v1/memory

Authorization

bearerAuth
headerAuthorizationBearer <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).

Query Parameters

tier?string

Only this memory tier.

Value in"semantic""episodic""procedural""graph"
limit?integer

Page size.

Range1 <= value <= 100
Default20
offset?integer

Records to skip.

Range0 <= value
Default0

Header Parameters

x-request-id?string

Client correlation id; echoed back as x-codai-trace-id and persisted on the usage row.

Lengthlength <= 128

Response Body

One page of memories and the total count.

application/json
  1. response
memories*array<>
total*integer

Total memories matching the filter.

Range0 <= value
Example Request
curl -X GET 'https://ai.codai.ro/v1/memory'
Example Response
{  "memories": [    {      "id": "string",      "tier": "semantic",      "content": "string",      "importance": 0,      "createdAt": "2019-08-24T14:15:22Z"    }  ],  "total": 0}
GET
/v1/memory/search

Authorization

bearerAuth
headerAuthorizationBearer <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).

Query Parameters

q*string

What to look for (natural language).

Length1 <= length <= 2000
limit?integer

Maximum number of results.

Range1 <= value <= 10
Default5

Header Parameters

x-request-id?string

Client correlation id; echoed back as x-codai-trace-id and persisted on the usage row.

Lengthlength <= 128

Response Body

Matching memories, most relevant first.

application/json
  1. response
memories*array<>
Example Request
curl -X GET 'https://ai.codai.ro/v1/memory/search?q=string'
Example Response
{  "memories": [    {      "id": "string",      "tier": "semantic",      "content": "string",      "relevance": 0    }  ]}
POST
/v1/memory

Authorization

bearerAuth
headerAuthorizationBearer <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).

Header Parameters

x-request-id?string

Client correlation id; echoed back as x-codai-trace-id and persisted on the usage row.

Lengthlength <= 128

Request Body

application/json
  1. body
content*string

The fact to remember, one clear sentence.

Length1 <= length <= 4000
importance?number

Importance from 0 to 1.

Range0 <= value <= 1
Default0.6

Response Body

Stored; the new memory id.

application/json
  1. response
id*string
Example Request
curl -X POST 'https://ai.codai.ro/v1/memory' \  -H 'Content-Type: application/json' \  -d '{  "content": "string"}'
Example Response
{  "id": "string"}
DELETE
/v1/memory/{id}

Authorization

bearerAuth
headerAuthorizationBearer <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).

Path Parameters

id*string

Memory id (from list or search).

Lengthlength <= 128

Header Parameters

x-request-id?string

Client correlation id; echoed back as x-codai-trace-id and persisted on the usage row.

Lengthlength <= 128

Response Body

Deleted.

application/json
  1. response
deleted*boolean
Example Request
curl -X DELETE 'https://ai.codai.ro/v1/memory/string'
Example Response
{  "deleted": true}

On this page