supermemory/apps/docs/recall/memory-review.mdx
sohamd22 ca89d161cc docs(api): move v5 search and ingest options into the request body (#1808)
Fixes v5 search and recall docs that didn't match the API.

- **Options in the URL.** Search examples passed `searchMode`/`limit` as query params, and ingest examples passed `dreaming`/`taskType` the same way. v5 rejects every query param on these routes with `400`. They now go in the JSON body (quickstart, rules, super-rag, recall/search).
- **`include`, not `attach`.** Renamed the search option. Its `forgotten` flag also admits forgotten memories into the main results, not just related context.
- **Search response.** Added the required `isInference`. `metadata` is always an object, and `system.createdAt` is optional.
- **Search add-ons are billed.** `rewriteQuery` and `rerank` each bill one extra operation; the docs said "no extra cost".
- **Removed claims that don't match current behavior:**
  - inferred memories being down-weighted in search;
  - AST code chunking via `code-chunk` (super-rag now describes how chunking actually works);
  - a 64-character metadata key limit.
- **Smaller fixes:**
  - The namespace is the SDK's first argument; the docs called it a top-level key.
  - "No v5 Python SDK" was stale.
  - Memory review: `total` semantics, the internal review stamp, and the missing 403.

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

288 lines
9.2 KiB
Text

---
title: "Review inferred memories"
sidebarTitle: "Memory review"
description: "List low-confidence inferred memories, then approve, decline or undo them."
icon: "/icons/hugeicons/check-list.svg"
---
Supermemory's graph derives new facts from patterns across your existing memories
(see [graph memory](/concepts/graph-memory)). Because nobody stated these facts
directly, they are flagged as inferred (`isInference: true`) until someone confirms
them.
These two endpoints let you build a review flow on top of that queue: list the
inferred memories awaiting review, then approve, decline or undo a decision on each one.
<Info>
These endpoints are scoped to a single [namespace](/concepts/container-tags)
(what v3/v4 called a container tag). The review routes are still served under
`/v3/container-tags/{containerTag}`; pass your namespace as the `containerTag`
path parameter.
</Info>
## What review changes
Reviewing an inferred memory resolves it either way:
| Action | Result | Effect on search |
|--------|--------|------------------|
| **Approve** | `isInference` cleared | Stays in search, no longer flagged as inferred |
| **Decline** | `isForgotten` set | Removed from search entirely — a rejected guess is forgotten |
| **Undo** | back to unreviewed | Returns to the queue, flagged as inferred again |
A reviewed memory gets an internal review stamp in its metadata so it drops out of the
review queue (declined memories also leave search, since they're forgotten). **Undo**
clears that stamp — and un-forgets a declined memory — bringing it back.
---
## List inferred memories
Return the inferred memories for a namespace that are still awaiting review (the
review queue). Reviewed memories are excluded.
```
GET /v3/container-tags/{containerTag}/inferred
```
<Tabs>
<Tab title="fetch">
```typescript
const res = await fetch(
"https://api.supermemory.ai/v3/container-tags/user_123/inferred",
{ headers: { "Authorization": `Bearer ${API_KEY}` } }
);
const { memories, total } = await res.json();
```
</Tab>
<Tab title="cURL">
```bash
curl "https://api.supermemory.ai/v3/container-tags/user_123/inferred" \
-H "Authorization: Bearer $SUPERMEMORY_API_KEY"
```
</Tab>
</Tabs>
### Path parameters
| Parameter | Type | Description |
|-----------|------|-------------|
| `containerTag` | string | The namespace to read the review queue for |
### Response
```json
{
"memories": [
{
"id": "mem_abc123",
"memory": "Alex likely works on Stripe's core payments product",
"parentCount": 3,
"createdAt": "2025-01-15T10:30:00.000Z",
"updatedAt": "2025-01-15T10:30:00.000Z",
"metadata": { "source": "derive" }
}
],
"total": 1
}
```
| Field | Type | Description |
|-------|------|-------------|
| `memories[].id` | string | Memory entry ID — pass to the review endpoint |
| `memories[].memory` | string | The inferred memory text |
| `memories[].parentCount` | number | How many source memories this was derived from. Higher = stronger signal |
| `memories[].createdAt` | string | ISO 8601 timestamp |
| `memories[].updatedAt` | string | ISO 8601 timestamp |
| `memories[].metadata` | object \| null | Arbitrary metadata stored on the memory |
| `total` | number | Total unreviewed inferred memories in the queue; can exceed the number returned in `memories` |
<Note>
The queue returns up to **50** memories, ordered by `parentCount` descending (most
strongly supported first), then by `createdAt` descending. It excludes anything that
is forgotten, expired, or already reviewed. An unknown or empty namespace returns
`{ "memories": [], "total": 0 }`.
</Note>
---
## Review an inferred memory
Record a decision on a single inferred memory.
```
POST /v3/container-tags/{containerTag}/inferred/{memoryId}/review
```
<Tabs>
<Tab title="fetch">
```typescript
const res = await fetch(
"https://api.supermemory.ai/v3/container-tags/user_123/inferred/mem_abc123/review",
{
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({ action: "approve" })
}
);
const result = await res.json();
// { id: "mem_abc123", isInference: false, isForgotten: false, reviewStatus: "approved" }
```
</Tab>
<Tab title="cURL">
```bash
curl -X POST \
"https://api.supermemory.ai/v3/container-tags/user_123/inferred/mem_abc123/review" \
-H "Authorization: Bearer $SUPERMEMORY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"action": "approve"}'
```
</Tab>
</Tabs>
### Path parameters
| Parameter | Type | Description |
|-----------|------|-------------|
| `containerTag` | string | The namespace the memory belongs to |
| `memoryId` | string | The memory entry ID from the list endpoint |
### Body parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `action` | string | yes | One of `approve`, `decline`, or `undo` |
<Warning>
The reject action is named **`decline`**. There is no `reject` value.
</Warning>
**Action semantics:**
- **`approve`** — Promote the memory: clears `isInference`, so it's treated as a
confirmed fact. Stamps `reviewStatus: "approved"`.
- **`decline`** — Reject the suggestion: the memory is **forgotten**
(`isForgotten: true`) and stamped `reviewStatus: "declined"`, so it leaves both
search and the review queue.
- **`undo`** — Revert a prior `approve`/`decline` back to the unreviewed inferred
state: restores `isInference: true`, un-forgets the memory (`isForgotten: false`),
and clears the review stamp, so it returns to the queue.
### Response
```json
{
"id": "mem_abc123",
"isInference": false,
"isForgotten": false,
"reviewStatus": "approved"
}
```
| Field | Type | Description |
|-------|------|-------------|
| `id` | string | The reviewed memory ID |
| `isInference` | boolean | `false` after approve; `true` after decline or undo |
| `isForgotten` | boolean | `true` after decline (the memory is forgotten); `false` otherwise |
| `reviewStatus` | `"approved"` \| `"declined"` \| `null` | The new status; `null` after an undo |
### Errors
| Status | When |
|--------|------|
| `401` | Missing or invalid authentication |
| `403` | Your key can't access this namespace, or lacks write access to it |
| `404` | The namespace or memory was not found in your organization |
| `409` | The memory isn't reviewable for this action — it's not an inferred memory, or there's no prior review to undo |
---
## Building a review experience
The endpoints are designed for an optimistic, one-at-a-time review UI (swipe to keep /
decline, with undo). A typical client fetches the queue once, then pops each card off
locally as the user decides — `undo` re-adds it.
<Accordion title="React Query hooks (TypeScript)">
```typescript
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
const BASE = "https://api.supermemory.ai/v3";
const key = (tag: string) => ["inferred-memories", tag] as const;
export type InferredMemory = {
id: string;
memory: string;
parentCount: number;
createdAt: string;
updatedAt: string;
metadata: Record<string, unknown> | null;
};
export type ReviewAction = "approve" | "decline" | "undo";
export function useInferredMemories(namespace: string) {
return useQuery({
queryKey: key(namespace),
queryFn: async (): Promise<InferredMemory[]> => {
const res = await fetch(`${BASE}/container-tags/${namespace}/inferred`, {
headers: { Authorization: `Bearer ${API_KEY}` },
});
if (!res.ok) throw new Error("Failed to load review queue");
const data = await res.json();
return data.memories ?? [];
},
staleTime: 60_000,
});
}
export function useReviewInferredMemory(namespace: string) {
const queryClient = useQueryClient();
return useMutation({
mutationFn: async (vars: { memoryId: string; action: ReviewAction }) => {
const res = await fetch(
`${BASE}/container-tags/${namespace}/inferred/${vars.memoryId}/review`,
{
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ action: vars.action }),
},
);
if (!res.ok) throw new Error("Review failed");
return res.json();
},
onSuccess: (_data, { memoryId, action }) => {
// approve/decline remove the card; undo brings it back, so refetch.
if (action === "undo") {
queryClient.invalidateQueries({ queryKey: key(namespace) });
return;
}
queryClient.setQueryData<InferredMemory[]>(key(namespace), (prev) =>
prev?.filter((m) => m.id !== memoryId),
);
},
});
}
```
</Accordion>
<Note>
There is no separate "skip" action. A swipe-to-skip is purely client-side — don't send
a request and the memory simply stays in the queue for a later session.
</Note>
---
## Next steps
- [Graph Memory](/concepts/graph-memory) — How inferred (`derive`) memories are created
- [Memory Operations](/recall/memory-operations) — Forget memories
- [Search](/recall/search) — Results flag inferred memories with `isInference`