# Memory (/docs/api/gateway/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 [#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 [#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`.

```ts
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);
```

<OpenAPIPage document="./openapi/en/gateway.yaml" operations={[{path: '/v1/memory',method: 'get'},{path: '/v1/memory/search',method: 'get'},{path: '/v1/memory',method: 'post'},{path: '/v1/memory/{id}',method: 'delete'}]} />
