Skip to main content
These v4 endpoints operate on extracted memories (not raw documents). SDK support coming soon — use fetch or cURL for now.For document management (list, get, update, delete), see Document Operations. For ingesting raw content (text, files, URLs) through the processing pipeline, see Add Context.

Create Memories

Create memories directly without going through the document ingestion workflow. Memories are embedded and immediately searchable. This is useful for storing user preferences, traits, or any structured facts where you already know the exact memory content.
const response = await fetch("https://api.supermemory.ai/v4/memories", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    memories: [
      {
        content: "John prefers dark mode",
        isStatic: false,
        metadata: { source: "user_preference" }
      },
      {
        content: "John is from Seattle",
        isStatic: true
      }
    ],
    containerTag: "user_123"
  })
});

const data = await response.json();
// {
//   documentId: "abc123",
//   memories: [
//     { id: "mem_1", memory: "John prefers dark mode", isStatic: false, createdAt: "2025-..." },
//     { id: "mem_2", memory: "John is from Seattle", isStatic: true, createdAt: "2025-..." }
//   ]
// }

Parameters

ParameterTypeRequiredDescription
memoriesarrayyesArray of memory objects (1–100 items)
memories[].contentstringyesThe memory text (max 10,000 chars). Should be entity-centric, e.g. “John prefers dark mode”
memories[].isStaticbooleannotrue for permanent identity traits (name, hometown). Defaults to false
memories[].metadataobjectnoKey-value metadata (strings, numbers, booleans)
containerTagstringyesSpace / container tag these memories belong to

Response

{
  "documentId": "abc123",
  "memories": [
    {
      "id": "mem_1",
      "memory": "John prefers dark mode",
      "isStatic": false,
      "createdAt": "2025-01-15T10:30:00.000Z"
    }
  ]
}
FieldTypeDescription
documentIdstring | nullID of the lightweight source document created for traceability
memoriesarrayThe created memory entries
memories[].idstringUnique memory ID
memories[].memorystringThe memory content
memories[].isStaticbooleanWhether this is a permanent trait
memories[].createdAtstringISO 8601 timestamp
When to use this vs Add Context?Use Create Memories when you already know the exact facts to store (user preferences, traits, structured data). Use Add Context when you have raw content (conversations, documents, URLs) that Supermemory should process and extract memories from.

Forget Memory

Soft-delete a single memory — excluded from search results but preserved in the database. Identify it by id or by exact content, scoped to its containerTag.
await fetch("https://api.supermemory.ai/v4/memories", {
  method: "DELETE",
  headers: {
    "Authorization": `Bearer ${API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    // Identify by ID or by exact content
    id: "mem_abc123",
    // content: "John prefers dark mode",
    containerTag: "user_123",
    reason: "outdated information"
  })
});

Parameters

ParameterTypeRequiredDescription
idstring*Memory ID to forget
contentstring*Exact content match to forget (alternative to ID)
containerTagstringyesContainer tag / space the memory belongs to
reasonstringnoOptional reason recorded as forgetReason
* Either id or content must be provided. The memory will no longer appear in search results but remains in the database (isForgotten=true).

Forget Matching

Forget everything about a topic in one call. You give a prompt or a query; the service semantically searches the container’s memories, an LLM decides which ones are genuinely about your target, and those are soft-deleted. Use this for “forget everything about X” rather than deleting memories one by one.
This is a bulk, destructive operation. Always dryRun first to review what would be forgotten, then re-run with dryRun: false. The match is semantic, so a too-broad query can select more than you intend — threshold and maxForget bound the blast radius.
// 1) Preview
const preview = await fetch("https://api.supermemory.ai/v4/memories/forget-matching", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    query: "forget everything about Project Titan",
    containerTag: "user_123",
    dryRun: true
  })
}).then((r) => r.json());
// preview.candidates → [{ id, memory, score }, ...]

// 2) Apply
const result = await fetch("https://api.supermemory.ai/v4/memories/forget-matching", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    query: "forget everything about Project Titan",
    containerTag: "user_123",
    dryRun: false,
    reason: "project cancelled"
  })
}).then((r) => r.json());
// result.forgotten → [{ id, memory, score }, ...]
// result.forgetBatchId → tagged on every forgotten memory for traceability

Parameters

ParameterTypeRequiredDescription
querystringyesWhat to forget — a natural-language instruction (“forget everything about Project Titan”) or a bare topic (“Project Titan”)
containerTagstringyesContainer tag / space to scope the operation to
dryRunbooleannoWhen true, returns what would be forgotten without changing anything. Defaults to false
thresholdnumbernoSimilarity floor (0–1) for candidate memories. Lower casts a wider net. Defaults to 0.5
maxForgetnumbernoSafety cap on how many memories may be forgotten in one call (1–500). Defaults to 100
reasonstringnoReason recorded as forgetReason on each forgotten memory

Response

{
  "dryRun": false,
  "count": 3,
  "forgetBatchId": "VcuQoGRz4hA4ak5Xu6DRUN",
  "summary": "Forgot 3 memories about \"Project Titan\".",
  "forgotten": [
    { "id": "mem_1", "memory": "Project Titan ships in Q3", "score": 0.82 }
  ]
}
FieldTypeDescription
dryRunbooleanWhether this was a preview or a real forget
countnumberNumber of memories selected (dryRun) or forgotten (apply)
forgetBatchIdstring | nullID tagged on every memory forgotten in this call; null on dryRun
summarystringOne-line summary of the operation (e.g. Forgot 3 memories about "Project Titan".)
candidatesarrayOn dryRun: the memories that would be forgotten ({ id, memory, score })
forgottenarrayOn apply: the memories that were forgotten ({ id, memory, score })
Identity is server-owned: the LLM only ever references opaque handles for the memories a search returned, so it can never forget a memory outside the results it reviewed, and every operation is scoped to the containerTag you pass.

Update Memory (Versioned)

Update a memory by creating a new version. The original is preserved with isLatest=false.
await fetch("https://api.supermemory.ai/v4/memories", {
  method: "PATCH",
  headers: {
    "Authorization": `Bearer ${API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    // Identify by ID or content
    id: "mem_abc123",
    // content: "Original content to match",

    newContent: "Updated content goes here",
    metadata: {
      tags: ["updated"]
    }
  })
});

Parameters

ParameterTypeRequiredDescription
idstring*Memory ID to update
contentstring*Original content to match (alternative to ID)
newContentstringyesNew content for the memory
metadataobjectnoUpdated metadata
* Either id or content must be provided.

Next Steps