Skip to main content

Envelope Documents

Documents are the PDF files attached to an envelope. An envelope can contain one or more documents, each with its own set of fields placed on its pages.


Properties

PropertyTypeDescription
idstringUnique identifier for the document. Required when placing fields.
namestringDisplay name shown to recipients during signing.
ordernumberDisplay order when multiple documents are present. Zero-based.
pagesarrayOne entry per PDF page. The array length gives the total page count.
contextobjectArbitrary metadata attached to this document.
statusstringCompletion status of this document. See below.

Document status

StatusDescription
completedAll required fields on this document have been submitted.
declinedA recipient declined to sign this document.
voidedThe parent envelope was voided.

Uploading documents

Documents are uploaded individually via a multipart/form-data request after the envelope is created.

POST /api/v1/key/envelopes/{envelopeId}/documents
Content-Type: multipart/form-data
FieldTypeRequiredConstraints
documentfilePDF only. Maximum size: 48 MB.
namestringMax 140 characters. Defaults to the uploaded filename.
ordernumberDisplay position. Starts at 0.
contextobjectArbitrary metadata.
info

Each upload is a separate request. To add three documents to an envelope, make three POST requests to this endpoint.


Working with pages

The pages array returned after upload contains one entry per page in the PDF. Use the array length to determine valid page indexes when placing fields.

{
"document": {
"id": "doc_02jy...",
"name": "Service Agreement.pdf",
"order": 0,
"pages": [{}, {}, {}],
"context": {}
}
}

In this example, pages.length === 3 means valid page indexes are 0, 1, and 2.


Updating and removing documents

Documents can be renamed or removed while the envelope is in draft status.

Rename a document

PATCH /api/v1/key/envelopes/{envelopeId}/documents/{documentId}
Content-Type: application/json

{ "name": "Updated Agreement.pdf" }

Remove a document

DELETE /api/v1/key/envelopes/{envelopeId}/documents/{documentId}
caution

Removing a document also removes all fields placed on that document.