# Memories Explicit text memory. A non-null userId denotes private personal memory within an account; null denotes deliberately shared account memory. No sources or automatic extraction are recorded. | Method | Operation | Path | | --- | --- | --- | | **`POST`** | [Create a memory](#create-a-memory) | `/v0/memories` | | **`GET`** | [List or search memories](#list-or-search-memories) | `/v0/memories` | | **`GET`** | [Get a memory](#get-a-memory) | `/v0/memories/:id` | | **`POST`** | [Correct a memory](#correct-a-memory) | `/v0/memories/:id` | | **`POST`** | [Archive a memory](#archive-a-memory) | `/v0/memories/:id/archive` | ## Create a memory Save personal memory by default, or explicitly author a shared account note. **`POST`** `/v0/memories` - **API key permission:** Read/write ### Parameters - `accountId` — required account UUID. - `requestId` — required retry identity, 1–200 characters; reuse the same ID and input for retries. - `content` — required text, 1–2,000 characters after trimming. - `key` — optional case-sensitive key, 1–120 characters, unique per account/user audience, including archived records. - `userId` — omit for the authenticated human; explicitly pass null for shared account memory. Other values are rejected. ### Request ~~~sh curl -X POST \ "https://api.interfold.dev/v0/memories" \ -H "Authorization: Bearer $INTERFOLD_API_KEY" \ -H "Content-Type: application/json" \ --data '{ "accountId": "", "requestId": "", "content": "Short updates with evidence links.", "key": "preferences/project-updates" }' ~~~ ### Response ~~~json { "memory": { "id": "", "accountId": "", "userId": "", "key": "preferences/project-updates", "content": "Short updates with evidence links.", "revision": 1, "createdAt": "2026-11-01T15:00:00.000Z", "updatedAt": "2026-11-01T15:00:00.000Z", "archivedAt": null }, "appliedRevision": 1, "replayed": false } ~~~ ### Behavior and errors - Browser users and user-bound CLI session keys can access their own personal memory. Manual account keys can access shared memory only and must explicitly pass userId=null to create it. READ keys cannot mutate memory. - Identical requests by the same principal within the account apply once. Reusing requestId with different input returns MEMORY_REQUEST_CONFLICT (409). Replay returns the current record and the originally appliedRevision. - MEMORY_KEY_CONFLICT (409) means the key is reserved in this audience. Read and correct by revision; creation never upserts. Private chat information and personal memory must not be promoted into shared notes. See [Errors](/api-reference/errors) for the standard error envelope and [Authentication](/api-reference/authentication) for API key handling. --- ## List or search memories List only authorized personal and account memory. Archived records are excluded by default. **`GET`** `/v0/memories` - **API key permission:** Read-only or Read/write ### Parameters - `accountId` — required account UUID. - `scope` — optional user or account; omit to include both authorized audiences. Personal records always belong to the caller. - `key` — optional exact key filter. - `q` — optional lexical query, 1–256 characters, over content and key. PostgreSQL simple-language full-text matching has no embeddings or synonym expansion. - `includeArchived` — true or false, default false. - `limit` — 1–100, default 20. `offset` — nonnegative integer, default 0. ### Request ~~~sh curl \ "https://api.interfold.dev/v0/memories" \ -H "Authorization: Bearer $INTERFOLD_API_KEY" ~~~ ### Response ~~~json { "memories": [{ "id": "", "accountId": "", "userId": "", "key": "preferences/project-updates", "content": "Short updates with evidence links.", "revision": 1, "createdAt": "2026-11-01T15:00:00.000Z", "updatedAt": "2026-11-01T15:00:00.000Z", "archivedAt": null }], "pagination": { "hasMore": false, "nextOffset": null } } ~~~ ### Behavior and errors - Search ranks matches first; ties and unfiltered lists sort by updatedAt descending, then ID descending. Manual keys cannot select scope=user. See [Errors](/api-reference/errors) for the standard error envelope and [Authentication](/api-reference/authentication) for API key handling. --- ## Get a memory Inspect a memory including archive state. The record supplies its account; no accountId parameter is needed. **`GET`** `/v0/memories/:id` - **API key permission:** Read-only or Read/write ### Request ~~~sh curl \ "https://api.interfold.dev/v0/memories/:id" \ -H "Authorization: Bearer $INTERFOLD_API_KEY" ~~~ ### Response ~~~json { "id": "", "accountId": "", "userId": "", "key": "preferences/project-updates", "content": "Short updates with evidence links.", "revision": 1, "createdAt": "2026-11-01T15:00:00.000Z", "updatedAt": "2026-11-01T15:00:00.000Z", "archivedAt": null } ~~~ ### Behavior and errors - Missing and inaccessible records return MEMORY_NOT_FOUND (404). Account membership, including ADMIN status, never grants access to another human's personal memory. See [Errors](/api-reference/errors) for the standard error envelope and [Authentication](/api-reference/authentication) for API key handling. --- ## Correct a memory Change content or key using a fresh revision. Account and user ownership cannot change. **`POST`** `/v0/memories/:id` - **API key permission:** Read/write ### Request ~~~sh curl -X POST \ "https://api.interfold.dev/v0/memories/:id" \ -H "Authorization: Bearer $INTERFOLD_API_KEY" \ -H "Content-Type: application/json" \ --data '{ "requestId": "", "expectedRevision": 1, "content": "Short updates with evidence links and blockers." }' ~~~ ### Response ~~~json { "memory": { "id": "", "accountId": "", "userId": "", "key": "preferences/project-updates", "content": "Short updates with evidence links and blockers.", "revision": 2, "createdAt": "2026-11-01T15:00:00.000Z", "updatedAt": "2026-11-01T15:00:00.000Z", "archivedAt": null }, "appliedRevision": 2, "replayed": false } ~~~ ### Behavior and errors - requestId and expectedRevision are required. Supply content, key, or both; key=null clears the key. Accepted corrections increment revision and retain an internal snapshot. - MEMORY_REVISION_CONFLICT (409) requires a reload and reconsidered edit. MEMORY_INACTIVE (409) means the record was archived. Stale approved writes cannot overwrite newer corrections. See [Errors](/api-reference/errors) for the standard error envelope and [Authentication](/api-reference/authentication) for API key handling. --- ## Archive a memory Stop future recall, increment the revision, and retain internal history and the reserved key. **`POST`** `/v0/memories/:id/archive` - **API key permission:** Read/write ### Request ~~~sh curl -X POST \ "https://api.interfold.dev/v0/memories/:id/archive" \ -H "Authorization: Bearer $INTERFOLD_API_KEY" \ -H "Content-Type: application/json" \ --data '{ "requestId": "", "expectedRevision": 2 }' ~~~ ### Response ~~~json { "memory": { "id": "", "accountId": "", "userId": "", "key": "preferences/project-updates", "content": "Short updates with evidence links and blockers.", "revision": 3, "createdAt": "2026-11-01T15:00:00.000Z", "updatedAt": "2026-11-01T15:00:00.000Z", "archivedAt": "2026-11-01T15:00:00.000Z" }, "appliedRevision": 3, "replayed": false } ~~~ ### Behavior and errors - Archive is not erasure: earlier chat content and snapshots remain. Retry the same request identity safely. New mutations of archived records return MEMORY_INACTIVE; this slice has no restore or permanent-delete operation. See [Errors](/api-reference/errors) for the standard error envelope and [Authentication](/api-reference/authentication) for API key handling. ## Shared behavior All operations use the [API authentication](/api-reference/authentication), [error](/api-reference/errors), and [rate-limit](/api-reference/rate-limits) contracts. List operations use [standard pagination](/api-reference/pagination) unless the operation says otherwise.