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>.
Bring back a document you soft-deleted with documents.delete: its versions and the memories made from it are visible to reads again. A version that was still processing when it was deleted is processed again. A permanent delete cannot be restored.

Parameters

Address the document one way: pass either document_key or document_id, as in documents.get. A deleted document is no longer found by document_id, so keep the document_key that delete returned.
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.

Returns

string
The document’s address.
string
restored.
integer
How many versions were restored.
integer
How many memories made from the document are visible again.

Example

Raises

  • ContextNotFoundError: when the document does not exist, belongs to another instance, or was purged after its purge date.
  • DocumentIdInUseError: when a newer document now holds the same document_id in that scope, so this one cannot come back.
  • MissingScopeError: when the key is not allowed to restore documents. Playground keys cannot.
  • InvalidInputError: when you pass both or neither of document_key and document_id.

See also