instances with a management key that is not bound to one instance.
Parameters
"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.Required on B2B for all three scopes. Not accepted on B2C, where the user is the whole identity (and
scope="customer" is refused).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.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.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.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
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
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.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.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.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
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 examplescope="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.
still_present_in.
data.status
still_present_in. It never contains the deleted content.
See also
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).