This guide walks you through creating and sending a signing envelope from scratch — uploading a document, assembling the envelope with a recipient and a signature field, sending it, and following it through to completion. By the end you'll have a sent envelope with a recipient waiting to sign.
The flow is always three calls, in this order:
POST /signatures/document/upload — put the file in Storage and get its storage id.POST /signatures/envelope/create — create a Draft envelope that references that id. Nothing is sent yet.POST /signatures/envelope/{envelopeId}/send — notify the recipients.Make sure you have:
Authorization bearer token and your API key — see Authentication if not.pdf or .docx file to use as the documentAn envelope cannot carry document content inline, so the document must be in Doctavian Storage first. Upload it as multipart/form-data with the file in the file part:
POST https://api.doctavian.com/v1/signatures/document/upload
Authorization: Bearer <token>
x-api-key: <api-key>
Content-Type: multipart/form-data
file: <nda-agreement.pdf>The response returns one entry per uploaded file. The id is the storage id you pass as urn in the next step (trimmed):
{
"result": {
"data": {
"files": [
{
"id": "af567f07-cafa-4d5c-830c-0f24af7555df",
"fileName": "nda-agreement.pdf"
}
]
}
}
}Use the storage id within 24 hours, and only once. Re-using it, or using it later, fails the create with
500FILE_NOT_EXISTS_IN_STORAGE; upload the file again. See Documents for why, and for accepted formats and size limits.
Call create with one document referenced by its storage id, one mandatory signer, one required signature field on the first page, and the envelope settings. For what each section of the body holds, see Anatomy of the create request.
POST https://api.doctavian.com/v1/signatures/envelope/create
Authorization: Bearer <token>
x-api-key: <api-key>
Content-Type: application/json
{
"documents": [
{
"referenceDocumentId": 1,
"name": "NDA Agreement",
"loadMethod": "Storage",
"urn": "af567f07-cafa-4d5c-830c-0f24af7555df",
"externalContext": { "contractId": "NDA-2026-0187" }
}
],
"recipients": [
{
"referenceSignerId": 1,
"name": "Jane Smith",
"email": "jane.smith@example.com",
"role": "signer",
"mandatory": true,
"externalContext": { "contactId": "C-88213" }
}
],
"fields": [
{
"type": "signature",
"name": "signature_jane",
"isRequired": true,
"referenceSignerId": 1,
"referenceDocumentId": 1,
"page": 1,
"positionX": 100,
"positionY": 600,
"width": 200,
"height": 60
}
],
"envelope": {
"subject": "Please sign: NDA Agreement",
"message": "Please review and sign the attached NDA at your earliest convenience.",
"senderName": "World Industries",
"senderEmail": "contracts@worldindustries.com",
"isSignOrder": false,
"expireInDays": 7,
"alertDaysBeforeExpiry": 2,
"firstReminderDays": 2,
"repeatingReminderDays": 2,
"notifyWhenOpened": true,
"notifyWhenSigned": true,
"locale": "en-GB",
"timeZone": "Europe/London",
"externalContext": { "crmDealId": "D-20931" }
}
}A few things to get right:
loadMethod: "Storage".type, a unique name, a referenceDocumentId, one owner and a placement — see Place Document Fields.referenceDocumentId, referenceSignerId and referenceSignGroupId as integers unique within the request.A successful call returns 201 with the new envelope in full, carrying a server-generated id for every object (trimmed here):
{
"result": {
"statusCode": 201,
"data": {
"envelope": {
"id": "61914d53-50ec-44a9-a64f-ed473f2c82cf",
"status": "Draft",
"externalContext": { "crmDealId": "D-20931" }
},
"documents": [
{
"id": "eff65b7a-3b81-4e41-8b2e-70ed15b645bf",
"name": "NDA Agreement",
"externalContext": { "contractId": "NDA-2026-0187" }
}
],
"recipients": [
{
"id": "d66078c4-96f1-4f60-8a96-f1fe00df25e6",
"name": "Jane Smith",
"externalContext": { "contactId": "C-88213" }
}
],
"fields": [
{
"id": "ff9f4c27-e0b1-41a9-ad2e-330ed25d8da6",
"name": "signature_jane",
"recipientId": "d66078c4-96f1-4f60-8a96-f1fe00df25e6",
"documentId": "eff65b7a-3b81-4e41-8b2e-70ed15b645bf"
}
]
}
}
}Save data.envelope.id — every later call to this envelope uses it. Map the other returned ids to what you sent by externalContext (documents and recipients) and name (fields and sign groups); the reference ids are not echoed. See Anatomy of the create request.
Validation failures return 400 with the specific problem in error.innerErrors[].code. See Error Handling, and the full create schema in the API Reference.
Until it is sent, the envelope is a Draft: nothing has gone to recipients. You can read it back with GET /signatures/envelope/{envelopeId}/get, change it with PUT /signatures/envelope/{envelopeId}/update, or discard it with DELETE /signatures/envelope/{envelopeId}/delete.
Update replaces the whole draft. Send the full create body again, with freshly uploaded storage ids for every document. See Revising a draft.
Send the draft to notify its recipients. To receive status callbacks, add an X-Client-Authorization header to this request — this is the call it goes on (see Step 5). The body is optional and carries only externalContext:
POST https://api.doctavian.com/v1/signatures/envelope/61914d53-50ec-44a9-a64f-ed473f2c82cf/send
Authorization: Bearer <token>
x-api-key: <api-key>
X-Client-Authorization: <client-header>
Content-Type: application/json
{}A 200 confirms the envelope has left Draft (trimmed):
{
"result": {
"statusCode": 200,
"data": {
"envelope": {
"id": "61914d53-50ec-44a9-a64f-ed473f2c82cf",
"status": "In Progress"
}
}
}
}Jane Smith now receives an email with a personalised link to the signing session. Who is emailed first depends on isSignOrder; see Envelope settings.
Send works only once, from
Draft, and only for the envelope's creator. Check the draft before you send: afterwards only the expiry can change. See After sending.
You have two options:
X-Client-Authorization header as described in Client Header and send it with the request in Step 4. Set up your endpoint with Receive Callbacks. For when callbacks arrive and what they carry, see Status callbacks.GET /signatures/envelope/{envelopeId}/get and read envelope.status and recipients[].status.When the envelope reaches Completed, download the signed document with GET /signatures/envelope/{envelopeId}/document/{documentId}/download (using documents[].id, not the storage id) and the audit trail PDF with GET /signatures/envelope/{envelopeId}/audit/download.
If get or a download returns 409 ENVELOPE_DOCUMENTS_PROCESSING, the final files are still being produced. Retry shortly.