Developer
E-signature API quick start: send your first envelope
You can send your first e-signature envelope with one curl command. Create an API key, POST a document and a recipient to /api/v1/envelopes with test mode on, sign the emailed link, then download the signed PDF. Test envelopes are free, so you can try the whole flow at no cost.
Step 1: Create a key and check it
Sign in, confirm your email address and open Developer in your account at /account/developer. Create a key and tick Test key if you want one that can only make test envelopes. Live keys start with dsk_ and test keys start with dsk_test_. Keep the key in an environment variable, then call /me to check that it works.
export DOCAISIGN_API_KEY="dsk_test_..."
curl https://docaisign.com/api/v1/me \
-H "Authorization: Bearer $DOCAISIGN_API_KEY" Step 2: Send a test envelope
This request fetches a PDF from a public https address and sends it to one signer. With withSignaturePage, DocAISign adds a final page with a signature box and a date box for each signer. Replace the sample URL and use your own email address.
curl -X POST https://docaisign.com/api/v1/envelopes \
-H "Authorization: Bearer $DOCAISIGN_API_KEY" \
-H "Content-Type: application/json" \
-H "X-Test-Mode: true" \
-d '{
"document": { "url": "https://example.com/lease.pdf" },
"recipients": [ { "name": "Ana Diaz", "email": "[email protected]" } ],
"withSignaturePage": true,
"subject": "Lease for signature"
}' - X-Test-Mode: true makes the envelope a free test, even with a live key.
- Every page is marked TEST - NOT LEGALLY BINDING, and the email subject starts with [TEST].
Step 3: Read the response
A successful request returns 201 with the envelope, its recipients and its fields. Save envelope.id, because every later call uses it. The fields array shows what DocAISign placed for each signer, which is a quick way to confirm that the signature page was added. If you pass "send": false, the envelope stays a draft until you call POST /api/v1/envelopes/{id}/send. This response is shortened:
{
"envelope": { "id": "ENVELOPE_ID", "status": "sent", "testMode": true },
"recipients": [
{ "slot": 1, "name": "Ana Diaz", "role": "signer", "status": "sent" }
],
"fields": [ { "recipient": 1, "type": "signature", "required": true } ]
} Step 4: Sign, track and download
Open the email and sign the document. Then read the envelope status. A recipient moves from sent to delivered when they open the link, and to completed when they finish. When envelope.status is completed, download the file.
curl https://docaisign.com/api/v1/envelopes/ENVELOPE_ID \
-H "Authorization: Bearer $DOCAISIGN_API_KEY"
curl -o signed.pdf \
https://docaisign.com/api/v1/envelopes/ENVELOPE_ID/documents/signed \
-H "Authorization: Bearer $DOCAISIGN_API_KEY" - signed: the finished PDF with its tamper seal.
- certificate: the certificate of completion on its own.
- combined: the signed PDF with the certificate added at the end.
- current: a copy in progress, while the envelope is still out.
- original: the document as it was uploaded.
Send a local file
To send a file from disk, pass its name and base64 content. PDF, DOCX, DOC, JPEG and PNG are accepted. Writing the body to a file avoids command-line length limits. On macOS, use base64 -i contract.pdf.
printf '{"document":{"name":"contract.pdf","base64":"%s"},
"recipients":[{"name":"Ana Diaz","email":"[email protected]"}],
"withSignaturePage":true,"testMode":true}' \
"$(base64 -w0 contract.pdf)" > body.json
curl -X POST https://docaisign.com/api/v1/envelopes \
-H "Authorization: Bearer $DOCAISIGN_API_KEY" \
-H "Content-Type: application/json" \
-d @body.json Place fields on your own pages
To put the signature where your document expects it, send a fields array instead of withSignaturePage. An anchor places a field at every occurrence of some text, with offsets in points. The recipient value is the signer's position in the list, starting at 1. You can also use page coordinates or text tags inside the document.
"fields": [
{ "recipient": 1, "type": "signature", "anchor": "Signature:",
"anchorXOffset": 60, "anchorYOffset": -10 },
{ "recipient": 1, "type": "date", "anchor": "Date:",
"anchorXOffset": 40, "anchorYOffset": -4 }
]
Fix common errors
Errors are JSON in the form {"error":"..."}. The status tells you where to look: 400 means fix the request, 401 means check the key, 404 means the envelope is not found or not yours, and 429 means slow down.
- No signature box: each signer needs a signature or initials field, or use withSignaturePage.
- Anchor not found: check the text, or set anchorIgnoreIfNotPresent to true.
- Email not confirmed: confirm your account address before sending.
- File rejected: keep documents to 20 MB and 100 pages, and use a public https address for url.
- Sending limit reached: daily limits apply to every account, so try again later.
Go live
Remove X-Test-Mode and testMode, or switch to a live key. Real envelopes use a send from your plan and go to real people, so check names and addresses carefully. Set expireDays and reminderDays to suit your process, and add metadata with your own record ID so you can match the envelope later. Next, replace status polling with a webhook, so your system hears about signatures as they happen.
Common questions
Do I need a paid plan to use the API?
No. The API is available on every plan, and test envelopes are free. Real envelopes use your plan's sends.
How many recipients can an envelope have?
Up to 20. Add sequential: true and a routingOrder on each recipient to sign in a set order.
Is there an OpenAPI specification?
Yes. It is published at https://docaisign.com/openapi.json, and the full reference is on the developers page.