supermemory/apps/docs/snippets/api-v5-memory-forgetting.mdx
sohamd22 4347970d16 docs(api): align v5 ingestion and document operations docs with the API (#1810)
Fixes v5 ingestion and document-operation docs.

- **Query params return `400`.** `dreaming`, `fileType` and `mimeType` were documented as query params; they are JSON body or multipart form fields.
- **Errors.** Out-of-balance quota is `402`, not `429`; `429` is only rate limiting. Added the `409` returned during a namespace merge.
- **Statuses.** There is no `processing` status. The real ones are queued, extracting, chunking, embedding, done and failed; treat anything else as in progress.
- **`group` on updates.** `group` is ingestion-side: it picks which existing memories serve as context while content is processed. Changing it only takes effect on re-ingestion, so it's sent with `content`/`file`. The "group-only PATCH" claims are removed from the migration doc.
- **Lists, deletes and forget:**
  - Valid `sort` values per type, a `limit` max of 100, and `include.forgotten`.
  - Deletes skip documents that are still processing.
  - Forget-matching has a 100-match cap and a 2000-character `query` limit.
- **Failed documents stay `failed`.** The docs said they're deleted after 2 minutes. They actually stay `failed`, and resending the same `id` reprocesses them.
- **Smaller fixes:**
  - Metadata allows `string[]`.
  - The batch response field is `count`.
  - `audio` is a valid `fileType`.
  - Chunk overlap is 200 characters.
  - URL extraction no longer claims Markdowner.
  - Search examples no longer index the response object as an array.

Checked against the current API and the published SDKs (TS 5.0.1, Python 5.0.0). Legacy v3/v4 docs are unchanged apart from factual fixes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-10-15 18:52:40 +00:00

89 lines
3 KiB
Text
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

v5 scopes forgetting to one namespace and returns the same result envelope for exact and semantic requests.
### Choose exact or semantic forgetting
| Intent | v5 operation |
| --- | --- |
| Forget reviewed memory IDs | `DELETE /ns/{namespace}/memories` |
| Find memories by meaning | `DELETE /ns/{namespace}/memories/semantic` |
### Forget exact IDs
```bash
DELETE /ns/user_1/memories
Content-Type: application/json
{"ids":["mem_1","mem_2"]}
```
Send 1–500 IDs. The response reports successful IDs in `matches` and missing, already forgotten, or out-of-namespace IDs in `errors`, so HTTP success does not imply every requested ID changed.
### Preview a semantic request
```bash
DELETE /ns/user_1/memories/semantic
Content-Type: application/json
{"query":"outdated home address","dryRun":true}
```
`dryRun: true` performs selection without changing memory state. `dryRun: false` forgets the memories selected when that request executes. `query` is 1–2000 characters, and each request selects at most 100 memories. After applying a batch, repeat the preview-and-apply workflow to find more; repeated previews alone do not paginate and may return the same matches.
### Avoid selection drift
```text
semantic request with dryRun: true
|
v
review matches[].id
|
v
exact DELETE with reviewed IDs
```
Use this workflow when a human or policy must approve the exact set. Re-running the semantic request with `dryRun: false` can select a different set if memories changed after preview.
### Read the normalized response
```json
{
"count": 1,
"matches": [{ "id": "mem_1", "memory": "Old address" }],
"errors": [{ "id": "mem_2", "error": "Memory not found" }]
}
```
`count` always equals `matches.length`. Semantic requests always return an empty `errors` array. Both dry-run and applied semantic requests use this shape; the payload alone does not replace your record of which mode was sent.
### With the SDK
<CodeGroup>
```ts Legacy
await client.memories.forget({ id: "mem_1" })
await client.memories.forgetMatching({ query: "outdated home address" })
```
```ts v5
const preview = await supermemory.memories.forgetMatching("user_1", {
query: "outdated home address",
dryRun: true,
})
await supermemory.memories.forget("user_1", {
ids: preview.matches.map((m) => m.id),
})
```
</CodeGroup>
`dryRun` is required on `forgetMatching`. Both calls return `{ count, matches, errors }`.
### Removed memory-write routes
Direct v4 memory creation and version updates (`client.memories.add`, `client.memories.updateMemory`) have no v5 replacement. Ingest source material through document routes and update the canonical document when facts change.
### Verification
- Exercise all-success, partial-success, duplicate, unknown, and cross-namespace ID sets.
- Confirm dry runs leave matched memories recallable.
- Apply reviewed IDs exactly and confirm normal recall excludes them.
- Persist the request mode alongside audit logs for semantic operations.