Skip to content

Export

Everything memory holds for one app user, a page at a time - for a person who asks for a copy of theirs.

POST/v2/memory/exportReads memoryTry it in the Playground
Auth
read key
Cost
free; never refused

Hands back everything memory holds for one app user, in pages: each item you added, whole; what their connected apps delivered; the facts memory learned; and, on a key that writes, the earlier versions of items an edit replaced. Use it when a person asks for a copy of what you keep about them. To show a list in your app, use items or facts instead: they are shorter, and an item there is cut at 2,000 characters, where the export keeps it whole.

Call it with no cursor, then again with each page's next until next is null. Every entry comes back exactly once. Items and what connected apps delivered (event entries) come first, by when they happened; then items still queued; then facts, by when they were said; then versions. Something added while you page through is on a later page if it sorts after where you are.

What was forgotten or has expired is not in it. For an app user nothing was written for, it answers 200 with no entries, never 404.

Headers

Authorizationstringrequired

Bearer ax_…. A read key exports everything but the versions an edit replaced, and says so in withheld; a key that writes exports those too. See Versions and edits.

X-Alexein-Userstringrequired

The app user whose memory to export. See App users.

X-Request-Idstring

Your id for this request, echoed on the response.

Body

limitinteger

How many entries a page holds, 1 to 500. Default 200.

cursorstring

The next the previous page answered with, for the page after it. Leave it out for the first page.

Response

userstring
The app user, as X-Alexein-User named them.
exported_atstring
When this page was read, ISO 8601.
entriesobject[]

Each has a type:

  • item: an item as add was given it (id, kind, text, title, at, author, session, about, metadata, expires, each where set), with role, status (stored or queued) and added_at, when memory took it.
  • event: what a connected app delivered: provider, source, kind, place, title, text, url, people (each with role, name, handle, email where known, and self), occurred_at and added_at.
  • fact: what memory learned: ref, text led by its date, date it was said, and from and until when it held, where known.
  • version: an earlier version of an item, in the item's fields, with its version number, taken_at and replaced_at. Only on a key that writes.
nextstring | null

The cursor of the next page. null on the last page.

withheldstring[]

The entry types this key was not given: ["version"] on a read key, [] on a key that writes.

Errors

400bad request

X-Alexein-User is missing or not a usable id.

401unauthorized

The bearer is not a key this service issued.

403forbidden

The organisation has been closed in the console.

422invalid

A limit outside 1 to 500, or a cursor that is not a page's next (`cursor` is not the `next` of a page).

429too many requests

Past your organisation's rate limits. Retry after Retry-After seconds. See Limits.

503unavailable

The service is busy or briefly unavailable. Retry after Retry-After seconds, or with backoff when there is none.

Request
curl https://api.alexein.ai/v2/memory/export \
  -H "Authorization: Bearer $ALEXEIN_API_KEY" \
  -H "X-Alexein-User: user_42" \
  -H "Content-Type: application/json" \
  -d '{ "limit": 200 }'
200 OK, a read key
{
  "user": "user_42",
  "exported_at": "2026-10-21T16:40:09+00:00",
  "entries": [
    {
      "type": "item",
      "id": "pref-diet",
      "kind": "note",
      "text": "Alice is vegan and allergic to peanuts.",
      "at": "2026-10-02T12:00:00+00:00",
      "metadata": { "source": "crm" },
      "status": "stored",
      "added_at": "2026-10-09T08:41:17+00:00"
    },
    {
      "type": "fact",
      "ref": "mem_Qy7cT0vVbN3rLm8wKs2HdA5fZe9XgJ1uPo4iRt6yWq0BnM3cSx7kLv",
      "text": "[2026-10-02] Alice is vegan",
      "date": "2026-10-02T12:00:00+00:00",
      "from": "2026-10-02T12:00:00+00:00",
      "until": null
    }
  ],
  "next": "cur_8ZpX2mQ4vL7nR1tY5wK9sD3fH6jB0cG",
  "withheld": ["version"]
}
200 OK, an app user nothing was written for
{ "user": "bob", "exported_at": "2026-10-21T16:40:09+00:00", "entries": [], "next": null, "withheld": [] }