Draft Envelopes
This document contains endpoints for creating, updating, and deleting draft envelopes, including headers, request bodies, responses, and practical examples.
Drafts allow an integration to prepare envelope XML, assign recipients, store metadata, and save the result before starting the document workflow.
The endpoints on this page create, update, and delete draft envelopes. To create and send an envelope immediately, use Send Envelope instead.
Business goals
Draft Envelope endpoints support integrations that need to prepare an envelope over multiple operations instead of sending it immediately. They support the following business goals:
Prepare envelopes before sending. Create an envelope and save it while its documents, recipients, fields, or metadata are still being prepared.
Update business data. Replace the envelope XML or metadata when information changes before the envelope is sent.
Separate preparation from delivery. Let one process create or update the envelope while another process validates and sends it.
Remove unused drafts. Delete one or multiple draft envelopes that should no longer be completed or sent.
Preserve a stable identifier. Save the returned envelope UUID and use it in subsequent update, delete, and send operations.
Endpoint summary
POST
/api/v1/envelope
Create a draft envelope without sending it
201 Created
PUT
/api/v1/envelope
Update an existing draft envelope without sending it
200 OK
DELETE
/api/v1/envelope
Delete one or multiple draft envelopes
200 OK
Draft envelope structure and headers
All three endpoints require an API token and the current mailbox UUID. The Mailbox header identifies the mailbox in which the draft is created, updated, or deleted.
Authorization: Bearer {token}
Content-Type: application/json
Mailbox: {mailboxUuid}The create and update endpoints use JSON request bodies containing envelope XML and optional metadata. The update request also supports previously saved document signature data.
uuid
UUID
Optional
Required
UUID assigned to or identifying the draft envelope
data
string
Required
Required
Envelope XML serialized as a JSON string
metadata
object
Optional
Optional
Custom string key-value pairs stored with the envelope
savedDocSignatures
array
Not used
Optional
Previously saved document signature data included in the update
When uuid is omitted from the create request, DocStudio generates an envelope UUID and returns it in the response. When the integration assigns the UUID itself, include it in the create request and continue using the same value in later operations.
The data field must contain valid envelope XML referencing an existing template and template version. Serialize the XML as a JSON string and escape it when required. Role IDs, recipient mailbox UUIDs, document IDs, and field names must correspond to the selected template version. See XML payloads for encoding guidance.
The metadata object stores business identifiers and other custom values separately from the envelope XML. Metadata can later be used to connect the envelope with records in a CRM, ERP, or another external system.
Practical example: Create, update, and delete a draft envelope
A CRM integration prepares a sales agreement but must wait for final customer information before sending it. The integration creates a draft, saves its UUID, updates the draft when the missing information becomes available, and deletes it if the agreement is cancelled.
Create the draft envelope
Create the draft with its initial envelope XML and metadata. The request saves the envelope in the mailbox specified by the Mailbox header without sending notifications or starting the recipient workflow.
A successful request returns 201 Created and the draft envelope UUID. Save this value because it identifies the draft in all subsequent operations.
If the integration needs to assign the UUID before creating the draft, include it in the request. DocStudio then uses the supplied value instead of generating a new one.
Update the draft envelope
Use PUT /api/v1/envelope after changing recipients, field values, the subject, the message, or other information stored in the envelope XML. Include the UUID returned by the create request and send the complete updated XML.
A successful update returns 200 OK. The operation saves the new draft state but does not send the envelope or notify its recipients.
Use the same Mailbox header that provides access to the draft. Include the draft UUID and the updated envelope data in the request. The request must contain the complete envelope state that needs to remain after the update.
Include saved document signatures
The update request can include savedDocSignatures when saved signature data must be retained with the draft. Use it when updating an envelope that already contains signatures saved before it is sent. Each entry identifies the document, signature field, signature source, encoded signature data, and optional certificate data.
The signatures array must contain at least one signature entry. Omit savedDocSignatures when the draft does not contain saved document signatures.
Delete draft envelopes
Delete drafts that should no longer be completed or sent. The request accepts an array, so the integration can delete one or multiple drafts in the same operation.
To delete multiple drafts, include each envelope UUID in the same array. All specified envelopes must be accessible through the mailbox context used in the request.
A successful request returns 200 OK. This endpoint is intended for draft envelopes that have not entered the recipient workflow.
Send the completed draft
When the draft is ready, send it through POST /api/v1/envelope/send. Include the saved envelope UUID and the final envelope XML so DocStudio can start the configured workflow.
A successful request returns 201 Created. The envelope is no longer only a draft because DocStudio starts the recipient workflow defined by its template and envelope XML.
Troubleshooting
The request XML is rejected
Verify that the XML references the selected template version and contains valid roles, recipients, documents, and fields
The draft is unavailable
Confirm that the Mailbox header grants access to the envelope UUID
An update lost expected values
Retrieve the current draft before using PUT, then submit the complete envelope state
Related topics
Last updated
Was this helpful?
