> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atlaso.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Memory API

> Add, list and delete facts for an app user, or your own facts with a Me key.

Use an Atlaso key set to **Memory for each user of my app**. Operations are scoped
to its account and project (or the key itself, for a key with no project). Send
`x-atlaso-user` on every request, from your app's server: it is the only source of
the user ID. A `user` field in an add body is not read as the ID; if it names a
different user the request is refused with 400 `user_id_conflict`. Never put the
app key in a browser or on a device. Each key namespace keeps at most 10,000 users
by default; adding a fact for a new user past that returns 403
`app_user_limit_reached`. These operations explicitly
manage facts, independently of whether the key recalls them on chat calls.

At \$0.00 in Atlaso credit, the AI clean-up of saved messages waits, for Gateway
calls and Plugin messages alike. Saving, recall, Ambient Memory, Ask and own-key
model calls keep working. See [Credits and learning](https://docs.atlaso.ai/account/credits-and-learning.md).

The examples use `ATLASO_KEY` and `ATLASO_BASE_URL` as set up in the
[Quickstart](https://docs.atlaso.ai/gateway/quickstart.md).

With a key whose memory is for **Me**, the same routes read and change your own
memory instead. See [Your own memory](#your-own-memory).

## Add a fact

`POST /v1/memory/facts`

```bash theme={null}
curl --fail-with-body "$ATLASO_BASE_URL/memory/facts" \
  -H "Authorization: Bearer $ATLASO_KEY" \
  -H 'Content-Type: application/json' \
  -H 'x-atlaso-user: demo-user-42' \
  -d '{"text":"My demo project is named Lantern and its launch day is Tuesday."}'
```

Send non-empty `text` of at most 4,000 characters, without NUL characters. The
request body is limited to 64 KiB. Recognised passwords, API keys and tokens are
blacked out before saving. Other details, such as card or ID numbers, are saved
as typed. A fact that cannot be saved returns `fact_rejected`.

A successful response is HTTP 200. Illustrative values:

```json theme={null}
{
  "id": "11111111-1111-4111-8111-111111111111",
  "object": "memory.fact",
  "created": 1793923200,
  "text": "My demo project is named Lantern and its launch day is Tuesday.",
  "source": "api",
  "app_user": "0123456789ab"
}
```

Keep the returned `id` for deletion. `created` is Unix seconds; `app_user` is an
opaque label, not the original ID. `text` is the stored fact; it can differ from what you sent, as described above.
`source` is `api` (added through this API), `dashboard` (a correction saved with
**Edit** in Activity) or `learned`.

If an idempotent add or batch request is replayed after its fact was edited,
Atlaso returns `409 fact_replaced` with `error.replaced_by` set to the newest
live fact ID, or `null` if the replacement is gone. The response never returns
the superseded text. A replay after the fact was deleted, or after its app user
or all of the project's shared facts were deleted, also returns
`409 fact_replaced` with `replaced_by` `null` until the key's 24 hours end, and
saves nothing. Send a new key to add the fact again.

## List facts

`GET /v1/memory/facts`

```bash theme={null}
curl --fail-with-body "$ATLASO_BASE_URL/memory/facts?limit=20" \
  -H "Authorization: Bearer $ATLASO_KEY" \
  -H 'x-atlaso-user: demo-user-42'
```

Facts are newest first. `limit` defaults to 20 and accepts 1 through 100.
For the next page, send the previous page's `last_id` as `after`.
The HTTP 200 body has `object: "list"`, `data` (fact objects), `first_id`,
`last_id`, and `has_more`. An empty list is:

```json theme={null}
{"object":"list","data":[],"first_id":null,"last_id":null,"has_more":false}
```

If the `after` fact was deleted since the last page, or lies beyond this user's
newest 10,000 facts, the list returns 400
[`invalid_after`](https://docs.atlaso.ai/gateway/errors#invalid_after). Start again from the first page.

## Delete one fact

`DELETE /v1/memory/facts/{fact_id}`

Set `FACT_ID` to the actual ID returned by add or list:

```bash theme={null}
curl --fail-with-body -X DELETE "$ATLASO_BASE_URL/memory/facts/$FACT_ID" \
  -H "Authorization: Bearer $ATLASO_KEY" \
  -H 'x-atlaso-user: demo-user-42'
```

A successful response is HTTP 200. Illustrative values:

```json theme={null}
{
  "id": "11111111-1111-4111-8111-111111111111",
  "object": "memory.fact.deleted",
  "deleted": true,
  "counts": {"facts": 1, "embeddings": 1, "search_rows": 1, "learned_source_links": 0},
  "remaining": 0,
  "deleted_at": "2026-11-17T09:30:00.123456+00:00"
}
```

`deleted: false` means the fact was not in this user's store, including when
it was already deleted. It does not reveal another user's facts.

## Delete a user's memory

`DELETE /v1/memory/user`

```bash theme={null}
curl --fail-with-body -X DELETE "$ATLASO_BASE_URL/memory/user" \
  -H "Authorization: Bearer $ATLASO_KEY" \
  -H 'x-atlaso-user: demo-user-42'
```

This removes the user's memory in the key's project (or, for a key with no
project, the key's own users). For a key with a project it also removes any memory
the same key kept for that user before it had a project. It is not an account-wide
cross-project deletion.

A successful response is HTTP 200. Illustrative values:

```json theme={null}
{
  "object": "memory.app_user.deleted",
  "app_user": "0123456789ab",
  "deleted": true,
  "facts_deleted": 12,
  "counts": {"facts": 12, "embeddings": 12, "search_rows": 12, "learned_source_links": 0},
  "remaining": 0,
  "deleted_at": "2026-11-17T09:30:00.123456+00:00"
}
```

`deleted` says whether a store existed, and `facts_deleted` is the number of facts
removed. Deleting a user also removes this user's label from the past call records
that carry it (the calls made for this user through keys in this project, or
through this key when it has no project), so Activity no longer groups those calls
by that user or shows their memory history.

See the [Memory API errors](https://docs.atlaso.ai/gateway/errors.md#memory-api-errors).

## Delete receipts

Both delete replies include `counts` for `facts`, `embeddings`, `search_rows` and
`learned_source_links`, `remaining: 0`, and `deleted_at`. `deleted_at` is an
ISO 8601 timestamp in UTC (unlike `created` on a fact, which is Unix seconds);
show it in your user's local time. Counts cover everything deleted, including all
facts on a user delete. A reply is returned only after Atlaso has read the store
back and found nothing left.

If any step fails, the delete answers `503 delete_pending`, never a partial
success. `delete_pending` means a deletion for this user (or one of their facts)
has begun and not finished. Retry the same delete to finish it; retrying is safe.
Atlaso also retries unfinished deletes in the background. Until the deletion
finishes:

* the list and recall never include what is being deleted (for a user delete, all
  of that user's facts), and for a short time while a delete runs the list can be
  empty and recall can return nothing for that user;
* adds for that user answer `503 delete_pending`.

Automatic learning cannot restore **the same fact, worded the same way**. Atlaso
compares keyed fingerprints after folding case, whitespace and punctuation;
it does not match paraphrases. Only fingerprints are retained, never the deleted
fact's text. These fingerprints survive deleting the user's store. After a user
delete, only an explicit `POST /v1/memory/facts` can create a new store. Explicit
API adds may restore a deleted fact, but do not remove its learning protection.
Keys for an app's own users do not learn from calls.

For how deletes affect chat calls, see
[Off means off, delete means deleted](https://docs.atlaso.ai/gateway/memory.md#off-means-off-delete-means-deleted).

## Your own memory

A key whose **Memory for** is **Me** reaches your own memory on the same routes:
the memory your Atlaso tools use. It works when the key's memory is **Use only**
or **Use and learn**; with **Off** every route answers 403 `memory_off`. Send no
`x-atlaso-user` header: with one, the request is refused with 403
`memory_scope_owner` and nothing is read or written.

* **Add** (`POST /v1/memory/facts`) and **add many** (`POST /v1/memory/facts/batch`)
  save into the key's project, or into your personal memory when the key has no
  project. Idempotency keys, batch limits and rate limits are the same as above.
* **List** (`GET /v1/memory/facts`) and **search** (`POST /v1/memory/search`)
  cover the key's project and your personal facts, newest first. Facts of other
  projects and shared facts are not reachable: their ids answer 404
  `fact_not_found`.
* **Update** (`PATCH /v1/memory/facts/{id}`) saves the new wording with a new id
  and forgets the old wording everywhere.
* **Delete one fact** (`DELETE /v1/memory/facts/{id}`) forgets it everywhere: your
  Atlaso tools drop it on their next sync, recall and the dashboard stop showing
  it, and learning never saves the same wording again. An explicit add can save
  it again. A resent add whose fact was deleted answers 409 `fact_replaced` with
  `replaced_by: null`.
* **Delete everything** is not available to a key: `DELETE /v1/memory/user`
  answers 403 `owner_erase_dashboard_only` and deletes nothing. Use **Delete all
  memories** on the dashboard.

A fact object here has `id`, `object`, `created`, `text` and `source`, and no
`app_user`. `source` is `sdk` for a fact saved with the Atlaso SDK, `api` for any
other web request, and `plugin`, `learned` or `import` for facts saved another
way (your Atlaso tools, learning, or an uploaded file). Every save, edit and delete appears on the dashboard's
Activity and Memory pages: rows from the SDK show an "SDK" tag and direct web
requests show "API". A delete row shows the key and the time, never the
deleted text.

```bash theme={null}
curl --fail-with-body "$ATLASO_BASE_URL/memory/facts" \
  -H "Authorization: Bearer $ATLASO_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"text": "I prefer metric units."}'
```

With the SDK, use `atlaso.memory`: `add`, `add_many` (`addMany`), `list`,
`search`, `update` and `delete`. It has no erase. A delete whose cleanup has not
finished answers 503 `forget_pending`; the SDK returns it as a pending result
that `resume()` finishes. See
[Use it for yourself](https://docs.atlaso.ai/gateway/sdk.md#use-it-for-yourself).

A key set to **Each user of my app** that sends no `x-atlaso-user` header
answers 400 `memory_scope_per_user`: use `atlaso.for_user(id).memory` (Python) or
`atlaso.forUser(id).memory` (TypeScript).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.