https://www.docusign.com/v2.1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}Adds or replaces a document in an existing draft or in-process envelope. An in-process envelope is one that has been sent but not yet completed or voided. **Note:** When adding or modifying documents for an in-process envelope, Docusign recommends locking the envelope prior to making any changes. To add a new document, set the `documentId` path parameter to a new document ID. To replace a document, set the `documentId` path parameter to the document ID of the existing document. The tabs of the original document will be applied to the new document. For example, a request in cURL looks like this: ``` $ curl --location --request PUT 'https://demo.docusign.net/restapi/v2.1/accounts/0cdb3ff3-xxxx-xxxx-xxxx-e43af011006d/envelopes/ea4cc25b-xxxx-xxxx-xxxx-a67a0a2a4f6c/documents/1' \ --header 'Authorization: Bearer eyJ...bqg' \ --header 'Content-Disposition: filename="newDocument"' \ --header 'Content-Type: application/pdf' \ --data-binary '@/location/of/document.pdf' ``` <ds-inlinemessage kind="warning"> If HTML document files contain <code><img></code> elements with the <code>src</code> attribute set to a path or URL, those images will not be displayed. Images in HTML files must be encoded in Base64 format, like this:<br/> <code><img src="data:image/gif;base64,R0lGODlh...IQAAOw==" alt="Base64 encoded image" width="150" height="150"/></code> </ds-inlinemessage>
The external account number (int) or account ID GUID.
The unique ID of the document within the envelope. Unlike other IDs in the eSignature API, you specify the `documentId` yourself. Typically the first document has the ID `1`, the second document `2`, and so on, but you can use any numbering scheme that fits within a 32-bit signed integer (1 through 2147483647). Tab objects have a `documentId` property that specifies the document on which to place the tab.
The envelope's GUID. Example: `93be49ab-xxxx-xxxx-xxxx-f752070d71ec`
{
"success": true,
"data": {
"id": "abc123",
"created_at": "2025-01-01T00:00:00Z"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters"
}
}1curl --request PUT \2 --url 'https://www.docusign.com/v2.1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}' \3 --header 'accept: application/json' \4 --header 'content-type: application/json'1{2 "success": true,3 "data": {4 "id": "abc123",5 "created_at": "2025-01-01T00:00:00Z"6 }7}https://www.docusign.com/v2.1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}Adds or replaces a document in an existing draft or in-process envelope. An in-process envelope is one that has been sent but not yet completed or voided. **Note:** When adding or modifying documents for an in-process envelope, Docusign recommends locking the envelope prior to making any changes. To add a new document, set the `documentId` path parameter to a new document ID. To replace a document, set the `documentId` path parameter to the document ID of the existing document. The tabs of the original document will be applied to the new document. For example, a request in cURL looks like this: ``` $ curl --location --request PUT 'https://demo.docusign.net/restapi/v2.1/accounts/0cdb3ff3-xxxx-xxxx-xxxx-e43af011006d/envelopes/ea4cc25b-xxxx-xxxx-xxxx-a67a0a2a4f6c/documents/1' \ --header 'Authorization: Bearer eyJ...bqg' \ --header 'Content-Disposition: filename="newDocument"' \ --header 'Content-Type: application/pdf' \ --data-binary '@/location/of/document.pdf' ``` <ds-inlinemessage kind="warning"> If HTML document files contain <code><img></code> elements with the <code>src</code> attribute set to a path or URL, those images will not be displayed. Images in HTML files must be encoded in Base64 format, like this:<br/> <code><img src="data:image/gif;base64,R0lGODlh...IQAAOw==" alt="Base64 encoded image" width="150" height="150"/></code> </ds-inlinemessage>
The external account number (int) or account ID GUID.
The unique ID of the document within the envelope. Unlike other IDs in the eSignature API, you specify the `documentId` yourself. Typically the first document has the ID `1`, the second document `2`, and so on, but you can use any numbering scheme that fits within a 32-bit signed integer (1 through 2147483647). Tab objects have a `documentId` property that specifies the document on which to place the tab.
The envelope's GUID. Example: `93be49ab-xxxx-xxxx-xxxx-f752070d71ec`
{
"success": true,
"data": {
"id": "abc123",
"created_at": "2025-01-01T00:00:00Z"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters"
}
}1curl --request PUT \2 --url 'https://www.docusign.com/v2.1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}' \3 --header 'accept: application/json' \4 --header 'content-type: application/json'1{2 "success": true,3 "data": {4 "id": "abc123",5 "created_at": "2025-01-01T00:00:00Z"6 }7}