> ## Documentation Index
> Fetch the complete documentation index at: https://docs.maximem.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Maximem Synap is a managed memory layer for AI agents: it ingests conversations and documents, extracts structured memory, and returns scoped context to the agent at retrieval time.
> The Python and JavaScript/TypeScript SDKs are the supported way to use Synap. Write integration code with SDK calls, not raw HTTP requests.
> Start with the Quickstart: https://docs.maximem.ai/getting-started/quickstart.md. Every SDK method is documented in the SDK reference: https://docs.maximem.ai/sdk-reference/overview.md.
> For requests about adding Vity memory to OpenClaw, Hermes, an MCP client, or a browser, start with the Vity Quickstart: https://docs.maximem.ai/vity/quickstart.md.

# Ingestion

> Send conversations, documents, and other data into Synap.

## Overview

Ingestion is how you feed data into Synap's memory system. Every conversation, document, email, or transcript you send through `sdk.memories.create()` enters the ingestion pipeline where it is categorized, chunked, entities are extracted and resolved, and the result is persisted across Synap's vector and graph storage engines.

Ingestion is **asynchronous**. When you call `create()`, Synap immediately returns an `ingestion_id` that you can use to poll the processing status. This design allows high-throughput workloads without blocking your application.

## Creating a Memory

Use `sdk.memories.create()` to send a single document into the ingestion pipeline.

```python Python theme={null}
from datetime import datetime

response = await sdk.memories.create(
    document="User: What's the status of Project Atlas?\nAssistant: Project Atlas is on track for Q2 launch...",
    document_type="ai-chat-conversation",
    user_id="user_12345",
    customer_id="cust_67890",
    mode="long-range",
    metadata={"session_id": "sess_abc", "agent_version": "2.1.0"}
)

print(f"Ingestion ID: {response.ingestion_id}")
print(f"Status: {response.status}")
```

```javascript JavaScript theme={null}

const response = await sdk.memories.create({
  document: "User: What's the status of Project Atlas?\nAssistant: Project Atlas is on track for Q2 launch...",
  document_type: 'ai-chat-conversation',
  user_id: 'user_12345',
  customer_id: 'cust_67890',
  mode: 'long-range',
  metadata: {'session_id': 'sess_abc', 'agent_version': '2.1.0'},
});

console.log(`Ingestion ID: ${response.ingestion_id}`);
console.log(`Status: ${response.status}`);
```

```typescript TypeScript theme={null}

const response = await sdk.memories.create({
  document: "User: What's the status of Project Atlas?\nAssistant: Project Atlas is on track for Q2 launch...",
  document_type: 'ai-chat-conversation',
  user_id: 'user_12345',
  customer_id: 'cust_67890',
  mode: 'long-range',
  metadata: {'session_id': 'sess_abc', 'agent_version': '2.1.0'},
});

console.log(`Ingestion ID: ${response.ingestion_id}`);
console.log(`Status: ${response.status}`);
```

**Key parameters for the example above:**

* `document`: the raw content to ingest (full transcript with speaker labels for conversations).
* `document_type`: tells the pipeline which extraction and chunking strategy to apply. See [Document Types](#document-types) below.
* `mode`: `long-range` (default) or `fast`. Both run the same pipeline today. See [Ingest Modes](#ingest-modes) below.
* `user_id` / `customer_id`: control the memory scope. The effective scope is derived from the combination you pass plus the instance's B2C vs B2B configuration; see [Memory Scopes](https://docs.maximem.ai/concepts/memory-scopes.md).
* `document_id`: an optional label of your own for the document, returned as `document_id`. It is not a duplicate check: Synap catches repeats by content, so the same content for the same user in the same instance within 7 days returns the first ingestion, whatever the id.

The call returns immediately with an `ingestion_id` (status `"queued"`) that you poll via `sdk.memories.status()`.

> [card] [Full parameter reference →](https://docs.maximem.ai/sdk-reference/memories/create.md)
>
> Every parameter, the complete response shape, and the errors raised by `memories.create()`.

## Document Types

The `document_type` parameter tells the ingestion pipeline which extraction and chunking strategies to apply.

| Document Type | Description | Optimized For |
| - | - | - |
| `ai-chat-conversation` | Multi-turn AI assistant conversations | Speaker turns, intent extraction, preference detection |
| `document` | General text documents | Paragraph chunking, topic extraction |
| `email` | Email messages and threads | Sender/recipient extraction, action items, thread context |
| `pdf` | PDF document content (text extracted) | Section-aware chunking, header/footer handling |
| `image` | Image descriptions or OCR text | Entity extraction from visual content descriptions |
| `audio` | Audio transcriptions | Speaker diarization awareness, temporal markers |
| `meeting-transcript` | Meeting transcription content | Multi-speaker extraction, action items, decisions |

> [!NOTE]
>
> For `image` and `audio` types, you provide the **text content** (description, transcript, or OCR output), not the raw binary file. Media processing and transcription should be handled upstream of Synap.

## Ingest Modes

`mode` accepts `long-range` (the default) or `fast`. The server accepts either value, but in the current release nothing downstream reads it: both run the same ingestion pipeline, so the choice does not change what is extracted or how long a write takes. You can leave it out.

> [!NOTE]
>
> Ingestion `mode` values (`fast` / `long-range`) are distinct from retrieval `mode` values (`fast` / `accurate`). The retrieval `mode` does change what a fetch does; see [Retrieval modes](https://docs.maximem.ai/concepts/retrieval-modes.md). Passing `"accurate"` to `memories.create()` or `"long-range"` to `context.fetch()` will be rejected. See also [Types and enums](https://docs.maximem.ai/sdk-reference/types-and-enums.md#ingestion-mode).

## Code Examples

### Ingesting a Conversation

```python Python theme={null}
response = await sdk.memories.create(
    document="""User: I'm planning a trip to Japan in April.
Assistant: Great choice! April is cherry blossom season in Japan. Would you like recommendations for Tokyo or Kyoto?
User: Both! I prefer boutique hotels over large chains, and I'm vegetarian.
Assistant: I'll keep your preference for boutique hotels and vegetarian dining in mind...""",
    document_type="ai-chat-conversation",
    user_id="user_12345",
    customer_id="cust_67890",
    mode="long-range"
)
```

```javascript JavaScript theme={null}
const response = await sdk.memories.create({
  document: `User: I'm planning a trip to Japan in April.
  Assistant: Great choice! April is cherry blossom season in Japan. Would you like recommendations for Tokyo or Kyoto?
  User: Both! I prefer boutique hotels over large chains, and I'm vegetarian.
  Assistant: I'll keep your preference for boutique hotels and vegetarian dining in mind...`,
  document_type: 'ai-chat-conversation',
  user_id: 'user_12345',
  customer_id: 'cust_67890',
  mode: 'long-range',
});
```

```typescript TypeScript theme={null}
const response = await sdk.memories.create({
  document: `User: I'm planning a trip to Japan in April.
  Assistant: Great choice! April is cherry blossom season in Japan. Would you like recommendations for Tokyo or Kyoto?
  User: Both! I prefer boutique hotels over large chains, and I'm vegetarian.
  Assistant: I'll keep your preference for boutique hotels and vegetarian dining in mind...`,
  document_type: 'ai-chat-conversation',
  user_id: 'user_12345',
  customer_id: 'cust_67890',
  mode: 'long-range',
});
```

### Ingesting a Document

```python Python theme={null}
response = await sdk.memories.create(
    document="Q3 2025 Engineering OKRs\n\n1. Ship Synap SDK v2.0...",
    document_type="document",
    user_id="user_12345",
    customer_id="cust_67890",
    document_created_at=datetime(2025, 7, 1),
    metadata={"source": "confluence", "page_id": "12345"}
)
```

```javascript JavaScript theme={null}
const response = await sdk.memories.create({
  document: "Q3 2025 Engineering OKRs\n\n1. Ship Synap SDK v2.0...",
  document_type: 'document',
  user_id: 'user_12345',
  customer_id: 'cust_67890',
  document_created_at: datetime(2025, 7, 1),
  metadata: {'source': 'confluence', 'page_id': '12345'},
});
```

```typescript TypeScript theme={null}
const response = await sdk.memories.create({
  document: "Q3 2025 Engineering OKRs\n\n1. Ship Synap SDK v2.0...",
  document_type: 'document',
  user_id: 'user_12345',
  customer_id: 'cust_67890',
  document_created_at: datetime(2025, 7, 1),
  metadata: {'source': 'confluence', 'page_id': '12345'},
});
```

### Ingesting with User and Customer Scoping

When both `user_id` and `customer_id` are provided, the memory is accessible at both scopes. This is useful when a user's conversation may contain information relevant to the broader organization.

```python Python theme={null}
response = await sdk.memories.create(
    document="User: Our team decided to switch from Jira to Linear...",
    document_type="ai-chat-conversation",
    user_id="user_alice",
    customer_id="cust_acme_corp",
    mode="long-range"
)

# This memory is now retrievable via:
# - sdk.user.context.fetch() for user_alice
# - sdk.customer.context.fetch() for cust_acme_corp
# - sdk.conversation.context.fetch() for the conversation
```

```javascript JavaScript theme={null}
const response = await sdk.memories.create({
  document: 'User: Our team decided to switch from Jira to Linear...',
  document_type: 'ai-chat-conversation',
  user_id: 'user_alice',
  customer_id: 'cust_acme_corp',
  mode: 'long-range',
});

// This memory is now retrievable via:
// - sdk.user.context.fetch() for user_alice
// - sdk.customer.context.fetch() for cust_acme_corp
// - sdk.conversation.context.fetch() for the conversation
```

```typescript TypeScript theme={null}
const response = await sdk.memories.create({
  document: 'User: Our team decided to switch from Jira to Linear...',
  document_type: 'ai-chat-conversation',
  user_id: 'user_alice',
  customer_id: 'cust_acme_corp',
  mode: 'long-range',
});

// This memory is now retrievable via:
// - sdk.user.context.fetch() for user_alice
// - sdk.customer.context.fetch() for cust_acme_corp
// - sdk.conversation.context.fetch() for the conversation
```

## Batch Ingestion

For bulk workloads, use `sdk.memories.batch_create()` to submit multiple documents in a single request.

```python Python theme={null}
from maximem_synap import CreateMemoryRequest

documents = [
    CreateMemoryRequest(
        document="User: Book me a flight to NYC next Tuesday...",
        document_type="ai-chat-conversation",
        user_id="user_12345",
        mode="long-range"
    ),
    CreateMemoryRequest(
        document="Meeting notes from sprint planning...",
        document_type="meeting-transcript",
        customer_id="cust_67890",
        mode="fast"
    ),
    CreateMemoryRequest(
        document="Support ticket: Login issues after password reset...",
        document_type="document",
        user_id="user_67890",
        customer_id="cust_67890",
        mode="long-range"
    ),
]

batch_response = await sdk.memories.batch_create(
    documents=documents,
    fail_fast=False
)

print(f"Submitted: {batch_response.total}")
print(f"Succeeded: {batch_response.succeeded}")
print(f"Failed: {batch_response.failed}")

for result in batch_response.results:
    print(f"  {result.ingestion_id}: {result.status}")
```

```javascript JavaScript theme={null}

let documents = [ { document: 'User: Book me a flight to NYC next Tuesday...', document_type: 'ai-chat-conversation', user_id: 'user_12345', mode: 'long-range' }, { document: 'Meeting notes from sprint planning...', document_type: 'meeting-transcript', customer_id: 'cust_67890', mode: 'fast' }, { document: 'Support ticket: Login issues after password reset...', document_type: 'document', user_id: 'user_67890', customer_id: 'cust_67890', mode: 'long-range' }, ];

const batch_response = await sdk.memories.batch_create({
  documents: documents,
  fail_fast: false,
});

console.log(`Submitted: ${batch_response.total}`);
console.log(`Succeeded: ${batch_response.succeeded}`);
console.log(`Failed: ${batch_response.failed}`);

for (const result of batch_response.results ?? []) {
  console.log(`  ${result.ingestion_id}: ${result.status}`);
}
```

```typescript TypeScript theme={null}

let documents = [ { document: 'User: Book me a flight to NYC next Tuesday...', document_type: 'ai-chat-conversation', user_id: 'user_12345', mode: 'long-range' }, { document: 'Meeting notes from sprint planning...', document_type: 'meeting-transcript', customer_id: 'cust_67890', mode: 'fast' }, { document: 'Support ticket: Login issues after password reset...', document_type: 'document', user_id: 'user_67890', customer_id: 'cust_67890', mode: 'long-range' }, ];

const batch_response = await sdk.memories.batch_create({
  documents: documents,
  fail_fast: false,
});

console.log(`Submitted: ${batch_response.total}`);
console.log(`Succeeded: ${batch_response.succeeded}`);
console.log(`Failed: ${batch_response.failed}`);

for (const result of batch_response.results ?? []) {
  console.log(`  ${result.ingestion_id}: ${result.status}`);
}
```

### The `fail_fast` Option

`batch_create()` takes a `fail_fast` flag (default `False`). With `False`, all documents are processed and invalid ones are rejected individually while valid ones proceed; with `True`, the entire batch aborts if any document fails validation and no documents are ingested.

> [card] [Full parameter reference →](https://docs.maximem.ai/sdk-reference/memories/batch-create.md)
>
> The `CreateMemoryRequest` fields, `fail_fast` semantics, and the `BatchCreateResponse` shape.

## Recording Conversation Messages

`sdk.memories.create()` ingests a fully-formed document. For live agents that need to stream messages turn-by-turn (so compaction and `get_context_for_prompt()` always see the latest history), use `sdk.conversation.record_message()` instead.

```python Python theme={null}
await sdk.conversation.record_message(
    conversation_id="b85f1c2a-9d3e-4f0a-8b6c-1a2b3c4d5e6f",  # must be a valid UUID
    role="user",                                              # "user" or "assistant"
    content="I'd like to upgrade my plan.",
    user_id="user_12345",
    customer_id="cust_67890",
)
```

```typescript TypeScript theme={null}
await sdk.conversation.record_message({
  conversation_id: 'b85f1c2a-9d3e-4f0a-8b6c-1a2b3c4d5e6f', // must be a valid UUID
  role: 'user', // 'user' or 'assistant'
  content: "I'd like to upgrade my plan.",
  user_id: 'user_12345',
  customer_id: 'cust_67890',
});
```

A few things to get right for the example above:

* `conversation_id` must be a valid UUID string (non-UUID values are rejected) and the same value should be reused across all turns of a single conversation.
* `role` must be either `"user"` or `"assistant"`.
* `content` is subject to the per-message size limit listed in [Performance & Limits](https://docs.maximem.ai/resources/performance-limits.md).

The call returns a dict with `message_id`, `conversation_id`, `session_id`, and `recorded_at`.

> [card] [Full parameter reference →](https://docs.maximem.ai/sdk-reference/conversation/record-message.md)
>
> Every parameter, scope rules for `customer_id`, the response shape, and the errors raised.

### Recording Messages in Batch

For backfills or buffered writes, `record_messages_batch` accepts a list of message dicts:

```python Python theme={null}
import uuid

# conversation_id must be a valid UUID string; reuse it across all turns
# of the same conversation.
conv_id = str(uuid.uuid4())

await sdk.conversation.record_messages_batch(
    messages=[
        {
            "conversation_id": conv_id,
            "role": "user",
            "content": "Hello!",
            "user_id": "user_12345",
            "customer_id": "cust_67890",
        },
        {
            "conversation_id": conv_id,
            "role": "assistant",
            "content": "Hi! How can I help?",
            "user_id": "user_12345",
            "customer_id": "cust_67890",
        },
    ]
)
```

```javascript JavaScript theme={null}
import { randomUUID } from 'node:crypto';

// conversation_id must be a valid UUID string; reuse it across all turns
// of the same conversation.
const conv_id = randomUUID();

await sdk.conversation.record_messages_batch([
        {
            'conversation_id': conv_id,
            'role': 'user',
            'content': 'Hello!',
            'user_id': 'user_12345',
            'customer_id': 'cust_67890',
        },
        {
            'conversation_id': conv_id,
            'role': 'assistant',
            'content': 'Hi! How can I help?',
            'user_id': 'user_12345',
            'customer_id': 'cust_67890',
        },
    ]);
```

```typescript TypeScript theme={null}
import { randomUUID } from 'node:crypto';

// conversation_id must be a valid UUID string; reuse it across all turns
// of the same conversation.
const conv_id = randomUUID();

await sdk.conversation.record_messages_batch([
        {
            'conversation_id': conv_id,
            'role': 'user',
            'content': 'Hello!',
            'user_id': 'user_12345',
            'customer_id': 'cust_67890',
        },
        {
            'conversation_id': conv_id,
            'role': 'assistant',
            'content': 'Hi! How can I help?',
            'user_id': 'user_12345',
            'customer_id': 'cust_67890',
        },
    ]);
```

Returns a dict with `total`, `succeeded`, `failed`, and a per-message `results[]` list.

> [!NOTE]
>
> Use **one path per conversation**. Recorded turns already become long-term memory: Synap extracts them in the background as the conversation grows and after it ends, through the same pipeline `memories.create()` uses. You do not call `memories.create()` for turns you recorded. See [Conversations and transcripts](https://docs.maximem.ai/capture/conversations.md) for which call fits which situation.

### Send each conversation once

Recording turns and ingesting the same content with `memories.create()` extracts it twice. Both calls consume credits (see [Pricing & Credits](https://docs.maximem.ai/resources/pricing.md), and `sdk.credits.estimate()` to size an operation before you run it), and the duplicate check only catches identical text, not the same conversation worded two ways.

* **Live agent:** record every turn with `record_message()`, `record_messages_batch()` or `instance.send_message()`. That alone gives you short-term context right away and long-term memory later. Do not also call `memories.create()` with the assembled conversation.
* **Finished conversation you never recorded** (a call handled elsewhere, a support chat closed in another system): push it once with `conversation.ingest_transcript()`.
* **Content that is not a recorded turn** (documents, emails, a chat export from another tool, backfills): use `memories.create()` or `memories.batch_create()`.

## One-Shot Transcript Ingest

For **async integrations** (where Synap does nothing during a session and everything happens at the end) `conversation.ingest_transcript()` collapses "stream turns + assemble + ingest + summarize" into a single call. It records the whole transcript, enqueues extraction, and fires a summary compaction, then returns immediately. Nothing sits on a hot path.

```python Python theme={null}
from maximem_synap import TranscriptTurn

resp = await sdk.conversation.ingest_transcript(
    conversation_id="call_01H8XZ",            # any client string, not validated as a UUID
    user_id="+919812345678",
    conversation_type="voice",
    transcript=[
        TranscriptTurn(role="assistant", content="Hi, is this a good time?"),
        TranscriptTurn(role="user", content="Yes, looking for a 3 BHK in Baner."),
    ],
    analysis={"disposition": "interested"},    # stored + used as extraction hints
)

await sdk.memories.wait_for_completion(resp.ingestion_id)
```

```javascript JavaScript theme={null}
import { TranscriptTurn } from '@maximem/synap-js-sdk';

const resp = await sdk.conversation.ingest_transcript({
  conversation_id: 'call_01H8XZ',  // any client string, not validated as a UUID
  user_id: '+919812345678',
  conversation_type: 'voice',
  transcript: [
  { role: 'assistant', content: 'Hi, is this a good time?' },
  { role: 'user', content: 'Yes, looking for a 3 BHK in Baner.' },
  ],
  analysis: {'disposition': 'interested'},  // stored + used as extraction hints
});

await sdk.memories.wait_for_completion(resp.ingestion_id);
```

```typescript TypeScript theme={null}
import { TranscriptTurn } from '@maximem/synap-js-sdk';

const resp = await sdk.conversation.ingest_transcript({
  conversation_id: 'call_01H8XZ',  // any client string, not validated as a UUID
  user_id: '+919812345678',
  conversation_type: 'voice',
  transcript: [
  { role: 'assistant', content: 'Hi, is this a good time?' },
  { role: 'user', content: 'Yes, looking for a 3 BHK in Baner.' },
  ],
  analysis: {'disposition': 'interested'},  // stored + used as extraction hints
});

await sdk.memories.wait_for_completion(resp.ingestion_id);
```

Key differences from `record_message`:

* **`conversation_id` is an arbitrary string**: no UUID validation. The server coerces it and echoes the original as `external_conversation_id`.
* **Idempotent on the same turns.** Re-pushing the same transcript returns `status="duplicate"` with the original `ingestion_id`. A different transcript under the same id (or an id whose turns you already recorded live) is accepted with `turns_recorded=0` and a warning: the stored turns stay as they are and the new text is extracted as one more document. Give every call its own `conversation_id`. See [Sending the same conversation\_id again](https://docs.maximem.ai/sdk-reference/conversation/ingest-transcript.md#sending-the-same-conversation_id-again).
* **`analysis` does double duty**: stored verbatim (surfaced at call-start fetch and in the dashboard) and injected into extraction as high-confidence hints.

Pair it with a call-start [`sdk.fetch(context_mode="conversation-summary")`](https://docs.maximem.ai/sdk/context-fetch#conversation-summary-mode-conversation-start). Full parameter reference: [conversation.ingest\_transcript](https://docs.maximem.ai/sdk-reference/conversation/ingest-transcript.md).

## Checking Ingestion Status

Ingestion is asynchronous. Use `sdk.memories.status()` to poll the processing state of a submitted document.

```python Python theme={null}
status = await sdk.memories.status(ingestion_id=response.ingestion_id)

print(f"Status: {status.status}")
print(f"Queued at: {status.queued_at}")
print(f"Started at: {status.started_at}")
print(f"Completed at: {status.completed_at}")

if status.status == "completed":
    print(f"Memory IDs: {status.memory_ids}")
    print(f"Memories created: {status.memories_created}")
elif status.status == "failed":
    print(f"Error: {status.error_message}")
```

```javascript JavaScript theme={null}
const status = await sdk.memories.status(response.ingestion_id);

console.log(`Status: ${status.status}`);
console.log(`Queued at: ${status.queued_at}`);
console.log(`Started at: ${status.started_at}`);
console.log(`Completed at: ${status.completed_at}`);

if (status.status == 'completed') {
  console.log(`Memory IDs: ${status.memory_ids}`);
  console.log(`Memories created: ${status.memories_created}`);
} else if (status.status == 'failed') {
  console.log(`Error: ${status.error_message}`);
}
```

```typescript TypeScript theme={null}
const status = await sdk.memories.status(response.ingestion_id);

console.log(`Status: ${status.status}`);
console.log(`Queued at: ${status.queued_at}`);
console.log(`Started at: ${status.started_at}`);
console.log(`Completed at: ${status.completed_at}`);

if (status.status == 'completed') {
  console.log(`Memory IDs: ${status.memory_ids}`);
  console.log(`Memories created: ${status.memories_created}`);
} else if (status.status == 'failed') {
  console.log(`Error: ${status.error_message}`);
}
```

### Ingestion Statuses

| Status | Description |
| - | - |
| `queued` | Document accepted and waiting for processing |
| `processing` | Actively being processed through the ingestion pipeline |
| `completed` | Successfully ingested. Memories are available for retrieval |
| `failed` | Processing failed. Check `error_message` for details |
| `partial_success` | Some extractions succeeded but others failed. Partial results are available |

> [!NOTE]
>
> The `partial_success` status typically occurs with large documents where some chunks process successfully while others encounter extraction errors. The successfully processed portions are still available for retrieval.

## Updating Memories

Update an existing memory using `sdk.memories.update()`. This is useful when the source document has been edited or when you want to append new information.

```python Python theme={null}
updated = await sdk.memories.update(
    memory_id=memory_id,
    document="Updated conversation transcript with additional turns...",
    merge_strategy="smart-merge",
    metadata={"updated_at": "2025-03-15", "reason": "new turns added"}
)
```

```javascript JavaScript theme={null}
const updated = await sdk.memories.update({
  memory_id: memory_id,
  document: 'Updated conversation transcript with additional turns...',
  merge_strategy: 'smart-merge',
  metadata: {'updated_at': '2025-03-15', 'reason': 'new turns added'},
});
```

```typescript TypeScript theme={null}
const updated = await sdk.memories.update({
  memory_id: memory_id,
  document: 'Updated conversation transcript with additional turns...',
  merge_strategy: 'smart-merge',
  metadata: {'updated_at': '2025-03-15', 'reason': 'new turns added'},
});
```

### Merge Strategies

> [accordion] replace
>
> Completely replaces the existing memory content with the new document. Previous extractions are discarded and re-extracted from the new content. Use when the document has been fully rewritten.

> [accordion] append
>
> Adds the new content to the end of the existing memory. Previous extractions are preserved, and new extractions are generated only from the appended content. Use when adding new turns to a conversation.

> [accordion] smart-merge
>
> Intelligently merges the new content with the existing memory. The pipeline detects overlapping sections, deduplicates extractions, and reconciles conflicting information by preferring the newer version. Use when the document has been partially edited.

## Deleting Memories

Remove a memory and all its associated extractions permanently.

```python Python theme={null}
await sdk.memories.delete(memory_id=memory_id)
```

```typescript TypeScript theme={null}
await sdk.memories.delete(memoryId: string)
```

> [!WARNING]
>
> Deletion is **permanent and irreversible**. All extractions, entity associations, and graph relationships derived from this memory are removed. This operation cannot be undone.

## Best Practices

> [accordion] Include speaker labels in conversations
>
> Always prefix conversation turns with speaker labels (`User:`, `Assistant:`, or actual names). The ingestion pipeline uses these labels to correctly attribute preferences, facts, and intents to the right participant.

> [accordion] Set user\_id and customer\_id consistently
>
> Use stable, deterministic identifiers for `user_id` and `customer_id`. These IDs form the basis of scoped retrieval. Inconsistent IDs fragment the user's memory across multiple scopes.

> [accordion] Retries are safe
>
> A `document_id` is your own label for a document; it does not stop duplicates. Synap catches a repeat by its content: the same content for the same user in the same instance within 7 days returns the first ingestion, so a retried request does not create a second memory.

> [accordion] Provide document\_created\_at for historical data
>
> When backfilling historical conversations or documents, set `document_created_at` to the original timestamp. This enables accurate temporal reasoning ("What did the user say last month?").

> [accordion] Batch when possible
>
> For bulk ingestion (backfills, migrations), use `batch_create()` with `fail_fast=False`. This reduces HTTP overhead and allows the pipeline to optimize scheduling.

## Next Steps

> [card] [Context Fetch](https://docs.maximem.ai/sdk/context-fetch.md)
>
> Query the memories you have ingested for contextual retrieval.

> [card] [Entity Resolution](https://docs.maximem.ai/concepts/entity-resolution.md)
>
> Understand how entities are automatically resolved during ingestion.

> [card] [Context Compaction](https://docs.maximem.ai/sdk/context-compaction.md)
>
> Compress long conversations to reduce token costs.

> [card] [SDK Configuration](https://docs.maximem.ai/sdk/configuration.md)
>
> Configure SDK behavior, timeouts, and retry policies.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.