Before you begin
- A document you no longer need. The examples work on a draft agreement that was never sent.
Step 1: Move the document to the trash
A plain delete is the reversible one:Request
Response
Step 2: Read the trashed document
A document in the trash is still there to be read:Request
Response
trashed tells you the state, so your integration never has to remember what it threw away. Apart from restoring it or deleting it for good, reading is all the trash allows.
Step 3: Restore the document
Restoring takes the document out of the trash:Request
Response
Step 4: Delete the document for good
Setpermanent to remove the document instead of trashing it:
Request
Response
404. The same call works on a document that is already in the trash, so emptying something out of it takes one request, not a restore followed by a delete.
A permanent delete cannot be undone: the document does not reach the trash and there is nothing left to restore. Reach for it only when you are certain, and prefer the plain delete everywhere else.
Complete example
Emptying a draft into the trash and, once your own retention rules say so, removing it for good — as a Node.js script. Error handling is minimal for brevity — in production, inspect the error envelope of non-2xx responses.Next steps
- Keep a copy before you throw the original away — Copy a document and share a view link.
- Organize what you keep — Organize documents in folders.