> ## 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.

# data.delete

> Delete the data held for one user, one conversation or one customer. Memories stay restorable for the instance's deletion period unless you ask for a permanent delete.

```python Python theme={null}
result = await sdk.data.delete(
    scope="user",                 # "user" | "conversation" | "customer"
    user_id="user-123",
    customer_id=None,             # B2B: required
    conversation_id=None,
    dry_run=False,
    confirm="user-123",           # the id being deleted, required unless dry_run
    wait=True,
    instances=None,               # "all" or a list of instance ids; management key
    permanent=False,              # True: no restore period (management-level key)
)
```

```typescript TypeScript theme={null}
const result = await client.data.delete({
  scope: 'user',                  // 'user' | 'conversation' | 'customer'
  userId: 'user-123',
  customerId: undefined,          // B2B: required
  conversationId: undefined,
  dryRun: false,
  confirm: 'user-123',            // the id being deleted, required unless dryRun
  wait: true,
  instances: undefined,           // 'all' or a list of instance ids; management key
  permanent: false,               // true: no restore period (management-level key)
});
```

Deletes personal data for one scope, across memories, source text, search vectors, the graph, conversation turns and summaries, and the user profile. Any valid Synap API key of the instance that is allowed to delete can call it, not only the runtime key. A key deletes inside its own instance and client, unless you pass `instances` with a management key that is not bound to one instance.

> [!WARNING]
>
> **Memories are soft-deleted by default.** They are hidden from every read at once and stay restorable with [`data.restore`](https://docs.maximem.ai/sdk-reference/data/restore) until `purge_after`, the end of the instance's deletion period (0 to 30 days, 30 by default). Then they are purged for good. Conversations, their turns and summaries, the profile and source text are removed at once and do not come back with a restore. `permanent=True` removes the memories at once too and needs a management-level key. Run it with `dry_run=True` first to see the counts.

### Parameters

**scope** `string` *required*

`"user"`, `"conversation"` or `"customer"`. Deleting a whole client is not supported through this call. This is a plain string; it is not the rung-path dict that `memories.create` and the fetch methods take as `scope`, and a dict is rejected.

**user\_id** `string`

Required for `scope="user"` and `scope="conversation"`.

**customer\_id** `string`

Required on B2B for all three scopes. Not accepted on B2C, where the user is the whole identity (and `scope="customer"` is refused).

**conversation\_id** `string`

Required for `scope="conversation"`.

**dry\_run** `boolean` (default: false)

Count what would be removed and change nothing. No `confirm` needed.

**confirm** `string`

Required unless `dry_run`. Must equal the id of the scope being deleted: `user_id` for `"user"`, `customer_id` for `"customer"`, `conversation_id` for `"conversation"`. A mismatch is rejected before any request is sent.

**permanent** `boolean` (default: false)

Remove the memories now instead of after the deletion period. Needs a management-level key: one holding `delete:permanent`, `delete:*`, `management:*` or `*`. A runtime key gets a 403. There is no restore after a permanent delete.

**wait** `boolean` (default: true)

A large delete is done in capped steps. With `wait=True` the SDK repeats the call while the server says `continue` (at most 50 calls). With `False` it returns after one call and you call again with the same arguments. The same request twice is always safe.

**instances** `string | string[]`

Delete in several instances of your client in one call: `"all"` for every instance, or a list of instance ids. Leave it out to delete in this SDK's instance only.

Needs a management key that is not bound to one instance. A key bound to an instance (a runtime key) is refused with 403 if it names any other instance. An unknown instance, or one of another client, refuses the whole call before anything is deleted. At most 25 instances per call.

Each instance is deleted, and audited, as if you had called it there. One instance refusing (for example `scope="customer"` on a B2C instance) is reported for that instance and does not stop the others. The call counts once against the rate limit. Added in the SDK release that follows this change.

### What each scope removes

| Scope | Removes |
| - | - |
| `user` | The user's memories, protected values, source text, vectors, graph entries, conversations with their turns and summaries, profile, pending extractions, and the documents filed under that user. |
| `conversation` | That conversation's turns and summaries, and a user's file that was sent only in that conversation (see `conversation_id` on [`memories.create`](https://docs.maximem.ai/sdk-reference/memories/create)). **Memories learned from it are kept** (`memories_kept` is true). To remove what was learned, delete the user (`scope="user"`) or one memory (`memories.delete`). |
| `customer` | The customer's stored data, including every user under it, customer-shared memories and the customer's documents. What is kept is listed under [What it keeps](#what-it-keeps-and-what-it-needs). B2B only. |

**Documents.** Documents owned by the scope are hidden with the memories made from them, and come back with them when you restore the call's `deletion_id`. A user delete leaves customer-level and organization-wide documents in place and reports how many in `documents_kept_shared`; the user's own memories drawn from them are deleted. When documents are in scope, the result lists the document data awaiting purge under `pending_purge`.

Kept on every scope: billing and usage counters, a content-free audit record of the call, and data you cannot attribute to a person (for example request logs without ids, which expire on their own). The SDK also clears its own cached copies on the machine it runs on (`local_cleared`).

### Returns

**deletion\_id** `string`

Identifies the audit record. Pass it to `data.status`.

**status** `string`

`pending_purge` (the default: memories hidden and restorable until `purge_after`), `complete` (a permanent delete, or `scope="conversation"`, which keeps memories), `partial` (a store could not be cleared), `in_progress` (only with `wait=False`) or `dry_run`.

**purge\_after** `string`

With `pending_purge`: when the deleted memories are purged for good (ISO 8601, UTC). Restore them with `data.restore(deletion_id=result.deletion_id)` before then.

**counts** `object`

Rows or documents removed per store (for a dry run, what would be removed).

**still\_present\_in** `string[]`

Stores that could not be cleared. Empty when everything worked.

**fully\_removed** `boolean`

False when `still_present_in` is not empty, and false for a soft delete (`pending_purge`), because the memories are hidden, not yet gone. Do not tell an end user their data is gone unless this is true.

**found** `boolean`

False when nothing existed for that id. The call still succeeds.

**continue** `boolean`

True when the size cap stopped the call. In Python the field is `continue_`.

**Same user id in two instances.** Without `instances`, a delete only ever removes data in the instance your key belongs to. Three stores cannot be scoped by instance: the profile, graph entities, and protected values written without an instance. If the same user or customer also has data in another instance of your client, those stores are skipped, named in `still_present_in`, and `stores` says `skipped: shared_with_other_instance`; the status is `partial`. Delete from the other instance too, or contact support, to clear them.

Also returned: `scope`, `dry_run`, `stores`, `kept`, `note`, `memories_kept`, `audit` and `local_cleared`.

**With `instances`**, the result also carries `instances` (one result per instance, each with its `instance_id`; a refused instance has `status: "refused"` and `error`), `not_started` (instances the time budget did not reach; `continue` is true and the next call does them) and `deletion_ids` (one audit id per instance). The top-level `status`, `fully_removed`, `still_present_in` and `found` cover all of them, and `deletion_id` is null.

### Example

```python Python theme={null}
preview = await sdk.data.delete(scope="user", user_id="user-123", dry_run=True)
print(preview.counts)

result = await sdk.data.delete(scope="user", user_id="user-123", confirm="user-123")
if not result.fully_removed:
    print("Still present in:", result.still_present_in)
```

```typescript TypeScript theme={null}
const preview = await client.data.delete({ scope: 'user', userId: 'user-123', dryRun: true });
console.log(preview.counts);

const result = await client.data.delete({ scope: 'user', userId: 'user-123', confirm: 'user-123' });
if (!result.fully_removed) console.log('Still present in:', result.still_present_in);
```

### Notes

* Stop writing for that person first. Anything still queued for extraction can land after the delete; run the delete again afterwards, it only removes what is new.
* A conversation that is still streaming is recreated by its next turn as a new, shorter conversation. End the stream, delete, then use a new `conversation_id`.
* A deletion works even when the credit balance is empty.

### Raises

* `InvalidInputError`: bad arguments, caught before any request, or HTTP 400 (for example `scope="customer"` on B2C).
* `AuthenticationError`: HTTP 401, or 403 when the key is not allowed to delete or belongs to another instance.
* `ConflictError`: HTTP 409, when the id belongs to a different customer or the same delete is already running.
* `RateLimitError`: HTTP 429.

A store that fails to clear is not an exception; read `still_present_in`.

### data.status

```python Python theme={null}
record = await sdk.data.status(result.deletion_id)
```

```typescript TypeScript theme={null}
const record = await client.data.status(result.deletion_id);
```

Returns the audit record of a delete: status, counts and `still_present_in`. It never contains the deleted content.

### See also

* [memories.delete](https://docs.maximem.ai/sdk-reference/memories/delete.md)
* [memories.forget](https://docs.maximem.ai/sdk-reference/memories/forget.md)
* [Erasing a person](https://docs.maximem.ai/guides/erasure.md)

## What it keeps, and what it needs

**Kept on every scope:** billing and usage counters (ids and amounts, no content); an audit record of the request with no content and no raw ids; request logs that carry no user or customer id (they expire on your plan's retention); the identity mapping rows (your external id to our internal id), with names, descriptions and context on them blanked; client-wide knowledge and other customers' data.

**Which keys may call it.** `scope="user"` and `scope="conversation"` work with a normal runtime key (`sdk:default`). `scope="customer"` needs the `delete:data` scope. A runtime key gets it only when you ask for it at creation: tick **Allow deleting a whole customer's data** in the dashboard's Generate API Key dialog, or run `maximem-synap api-keys create --instance <id> --allow-customer-delete`. Management keys with `management:*` or `*` also qualify. Any other key is refused with 403. Onboarding keys and read-only keys cannot delete.

**Blast radius of a leaked runtime key.** Anyone holding a runtime key can delete any user or any conversation in that key's instance, and can learn whether an id exists through `dry_run`. `confirm` only protects against typos, because the caller types it. It cannot reach another instance, another client, or (without the opt-in scope) a whole customer. Treat runtime keys as secrets, rotate a leaked one at once, and read the audit record (`sdk.data.status`).

**Limits.** 10 delete calls per minute and 100 per hour per key, and 60 dry runs per minute per key. There is no client-wide counter, so one key cannot use up another key's allowance. Over the limit you get 429; with `wait=True` the SDK raises at that point and the progress already made stays on the server, so wait and repeat the same call.

**The same user id under two customers (B2B).** Send both `user_id` and `customer_id`: only that customer's rows are removed. The shared identity row (profile, names), protected values and graph entities are left alone and named in `still_present_in`.

**Complete means complete.** If the search index or graph is unreachable, a store cannot be scoped to your instance, or time ran out, the status is `partial` and `still_present_in` names it (`provider_unavailable`, `shared_with_other_instance`, `vector_unstamped_possible`, or `conversations` with `remaining`). `in_progress` or `continue: true` is returned by `wait=False`, or by `wait=True` after 50 calls; call again with the same arguments. A turn buffer or cache that could not be reached is reported as `skipped: redis_unavailable` and the status is `partial`.

**Shared source text.** A source chunk that another memory (of anyone in the customer) still rests on is kept, as the single-memory delete does. The response says how many (`counts.shared_source_chunks_kept`, and a `kept` line `shared_source_chunk`).

**Older rows with no customer.** On B2B, rows of a user id that carry no `customer_id` are deleted with the user only when no other customer holds the same user id. Otherwise they stay and `still_present_in` lists `legacy_unscoped_rows` (status `partial`).

**Writes during a delete.** The response carries `may_have_new_data`. It is true when something was written for the target after the delete started; `still_present_in` then lists `new_data_during_delete` and the status is `partial`. Stop writes, delete, then delete again.

**Conversation ids.** A conversation id is a global key. A delete only removes a conversation whose stored instance, user and customer match yours; another tenant that reused the same id cannot be separated from the first owner's row (known platform limit).


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