Skip to main content
REST One HTTPS request, or two when you address the document by document_id.
Added in Python SDK 0.9.0 and JavaScript and TypeScript SDK 0.9.0. In TypeScript, pass the document_key as a string, or an options object; every option is accepted in snake_case or camelCase (documentId or document_id). The result is returned as the server sends it, with snake_case fields, typed as Record<string, unknown>.
Delete a document with every version and every memory Synap made from it. By default the delete is soft: the document and its memories disappear from every read at once, and you can bring them back with documents.restore until the purge date, the end of the instance’s deletion period. After that they are removed for good. With permanent=True (permanent: true in TypeScript) they are removed at once, with no restore.

Parameters

Address the document one way: pass either document_key or document_id, as in documents.get.
string
The document’s address. Do not combine it with user_id, customer_id or scope.
string
The id you gave the document at creation, with the scope it was created in.
string
With document_id: the user the document was filed under.
string
With document_id: the customer the document was filed under. Not accepted on B2C.
dict[str, str]
With document_id: the deeper scope level the document was filed at.
boolean
default:"false"
Remove it now, with no restore period. Needs a management-level key. A key without it raises MissingScopeError.

Returns

string
The document’s address.
string
pending_purge for a soft delete (hidden now, restorable until purge_at), or deleted for a permanent one.
datetime | None
For a soft delete: when the document is removed for good. None (null in TypeScript) for a permanent delete.
integer
How many versions were deleted.
integer
Soft delete: how many memories made from the document are now hidden. A permanent delete returns memories_removed instead.
boolean
Soft delete: true when the document was already deleted, so nothing changed.

Example

A soft delete can be undone with documents.restore until purge_at. A permanent delete cannot be undone.

Raises

  • MissingScopeError: when the key is not allowed to delete documents, or permanent=True without a management-level key. Playground keys cannot delete documents.
  • ContextNotFoundError: when the document does not exist or belongs to another instance.
  • AmbiguousDocumentError: when a document_id names more than one document in the scope you gave.
  • InvalidInputError: when permanent is not a boolean, or you pass both or neither of document_key and document_id.

See also