# Memory API reference

Source: https://www.gryz.ai/docs/api/memory/
Updated: 2026-09-07

## Answer first [#answer-first]

Agent Memory is primarily written and read over MCP (`remember`, `recall`,
`forget`, `list_memories`). The REST routes under `/api/memory` are a
same-origin fallback for the Gryz dashboard. They require a logged-in session
(cookie auth), not a Bearer API key, and are gated by the `agent_memory`
feature flag. Denied callers get `404`.

Base URL: `https://www.gryz.ai`

## Plan limits [#plan-limits]

Every write (`remember`, `POST /api/memory/`, and JSONL import) is gated by
two independent quotas. Hitting either returns `403`:

| Plan     | Total memories (personal + project) | Distinct projects |
| -------- | ----------------------------------- | ----------------- |
| Free     | 50                                  | 1                 |
| Pro      | 500                                 | 3                 |
| Pro Plus | Unlimited                           | Unlimited         |

Personal-scope and project-scope memories share the same total-count quota:
it is not per-scope. The project-count quota is separate: it bounds how many
distinct `project_key` values you can have active memories under, not how
many memories exist within any one project.

## POST /api/memory/ [#post-apimemory]

Create a single memory. Mirrors the `remember` MCP tool and runs the same
gating, project-count quota, provenance, and trust classification through
`rememberMemory()`.

**Body (JSON):**

```json
{
  "scope": "project",
  "project_key": "github.com/acme/app",
  "body": "The team deploys on Fridays.",
  "valid_from": "2026-09-01T00:00:00Z",
  "salience": 2
}
```

* `scope`: `"personal"` or `"project"` (required)
* `project_key`: required when `scope` is `"project"`, must be omitted for
  `"personal"`
* `body`: the atomic fact, 1–4000 characters (required)
* `valid_from`: ISO timestamp the fact became true (optional, defaults to now)
* `salience`: importance weight `0`–`10` (optional, defaults to `1`)

**Responses:**

* `201`: `{ "memory": { ... } }` with the stored record and its provenance chain
* `403`: cross-origin request, account tier cannot use memory, the total
  memory-count quota for the plan is exceeded (`code: "memory_quota_exceeded"`),
  or the project-count quota is exceeded (`code: "project_quota_exceeded"`).
  See [Plan limits](#plan-limits) above
* `404`: `agent_memory` flag not enabled for the caller
* `422`: validation error

## GET /api/memory/ [#get-apimemory]

List the authenticated user's memories with provenance summary and scope.
Supports `limit`, `offset`, `scope`, and `project_key` query params.

## Error shape [#error-shape]

```json
{
  "error": "Human-readable message",
  "code": "OPTIONAL_CODE"
}
```

For assistant-driven workflows, use the [MCP memory tools](/docs/mcp/tools/)
instead. The REST routes are not exposed to API keys.

## Related reading [#related-reading]

* [Agent memory](/topics/agent-memory/)
* [The Four Kinds of Memory Your Agent Actually Needs](/gryzle/types-of-agent-memory/)
* [Agent memory that works across every model, and that you own](/gryzle/portable-agent-memory/)
