Before you begin
- Documents to export. The examples export employment agreements filed under the
Contractcategory.
Step 1: Export a single document
The request body says what goes into the archive:Request
Response
Step 2: Queue an export of a selection
Every export other than the single-document one runs in the background, however much it ends up containing. This one takes the filters of a document search, plus the same archive options:Request
Response
202 means the work has been accepted. status is still queued, and fileId and finishedAt are null because nothing has been produced yet. Keep the id.
Step 3: Poll until the export is finished
Read the job until it reaches a terminal status:Request
Response
statuswalksqueued→processing→completed, or ends infailedwhen the archive could not be produced.fileIdappears once the export completed — that is the finished archive.isEmptyistruewhen the export finished with nothing to put in an archive — the documents it selected were gone by the time it ran. There is then no archive, andfileIdstaysnull.
Step 4: Download the archive
The result is an ordinary file, so it is downloaded like any other:Request
Response
404.
Two more exports work exactly the same way, differing only in what they gather: POST /folders/export takes a whole folder tree by its scope, or the folders you name in folderIds, while POST /me/export packs up your own documents together with their metadata. Both answer with the same job, polled and downloaded as above.
When the selection matches nothing, no job is created and the answer is
404. A scheduled export that finds nothing in its window is therefore an expected outcome, not a failure — treat that status as “nothing to export this time”.Idempotency-Key, so a retried request cannot start the same export twice — Retry requests safely covers that.
Complete example
Queueing an export, waiting for it, and saving the archive, as a Node.js script. Error handling is minimal for brevity — in production, inspect the error envelope of non-2xx responses.Next steps
- Choose exactly which documents an export covers — Search documents.
- Collect the evidence of a single document without an archive — Collect the evidence of a signed document.