DEVELOPERS
E-signatures from your code, your terminal or your AI agent
One API key works everywhere: the REST API, the MCP server for AI agents and the docaisign command line tool.
Try everything in test mode for free.
Get an API key OpenAPI spec llms.txt
Step-by-step guides: Test mode · AI agents (MCP) · Webhooks · Embedded signing · Text tags · Bulk send
Quick start
Send a PDF to two people. With no fields, DocAISign adds a signature page with a signature and a date box for each signer.
curl -X POST https://docaisign.com/api/v1/envelopes \
-H "Authorization: Bearer dsk_…" -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]"},
{"name":"Ben Lee","email":"[email protected]"}],
"withSignaturePage":true,"subject":"Lease for signature"}'
The answer is the envelope with each recipient's status. Follow it with GET /api/v1/envelopes/{id} or a webhook,
then download GET /api/v1/envelopes/{id}/documents/signed.
Test mode
Test envelopes are free and work like real ones, but every page is marked TEST - NOT LEGALLY BINDING, the certificate says so, emails start with [TEST], and they are left out of reports. Three ways to turn it on:
- a test key (
dsk_test_…, tick “Test key” when you create it): every envelope it makes is a test, and it can't change real envelopes; - the header
X-Test-Mode: true(it wins over the body); "testMode": truein the request body.
AI agents (MCP)
DocAISign is an MCP server, so Claude, ChatGPT, Cursor and other agents can send documents,
check who has signed and fetch the signed PDF. Endpoint: https://docaisign.com/mcp (Streamable HTTP). Connect by signing in (OAuth), or with your API key as a Bearer token.
Connect by signing in (no API key)
In an app that supports remote MCP servers (custom connectors in Claude and ChatGPT, Cursor, VS Code, Claude Code), add a server with the address https://docaisign.com/mcp.
The app opens DocAISign in your browser, you sign in and choose Allow, and the app is connected. No key to copy.
claude mcp add --transport http docaisign https://docaisign.com/mcp
This is OAuth 2.1 with PKCE and dynamic client registration, as the MCP authorization spec describes; metadata is at
https://docaisign.com/.well-known/oauth-protected-resource. Access lasts an hour and is renewed by the app; a connection not used for 90 days ends.
See and disconnect apps under Developer → Connected AI apps. A signed-in connection sends real envelopes;
pass test_mode to a tool, or use a test key, while trying things out.
Claude Code with an API key
claude mcp add --transport http docaisign https://docaisign.com/mcp --header "Authorization: Bearer dsk_…"
Claude Desktop, Cursor and other local (stdio) clients
{
"mcpServers": {
"docaisign": {
"command": "npx",
"args": ["-y", "https://docaisign.com/cli/docaisign-cli-1.3.0.tgz", "mcp"],
"env": { "DOCAISIGN_API_KEY": "dsk_…" }
}
}
}
Tools
send_document | Upload a PDF, DOCX, DOC, JPEG or PNG (url or base64) and send it; adds a signature page when no fields are given |
send_template · bulk_send | Send from a template, to one person or up to 100 |
list_envelopes · get_envelope | Find envelopes and see who has signed, with field values |
download_document | Signed PDF, certificate of completion, combined, in-progress or original copy |
remind · update_recipient · void_envelope · get_signing_url · get_edit_url | Follow up, or open a draft's editor in your app |
list_templates · get_template · get_account | Templates, their field labels, and your plan |
Use a test key while you try an agent out. Agents are told to confirm names and email addresses with you before sending.
Command line (CLI)
No dependencies, Node.js 18 or later.
npm install -g https://docaisign.com/cli/docaisign-cli-1.3.0.tgz docaisign login docaisign send lease.pdf --to "Ana Diaz <[email protected]>" --to "Ben Lee <[email protected]>" --order docaisign wait ENVELOPE_ID && docaisign download ENVELOPE_ID docaisign template-send TEMPLATE_ID --to "Ana Diaz <[email protected]>" --value "Rent=1,850" docaisign bulk TEMPLATE_ID --csv people.csv --test
Also list, status, remind, void, correct, signing-url, templates, template-export, template-import, webhook;
--json for scripts. docaisign help lists everything.
API reference
Base URL https://docaisign.com/api/v1. JSON in and out. Authorization: Bearer dsk_…. The full schema is in openapi.json.
| Account | |
|---|---|
GET /me | Email, plan, whether the key is a test key |
| Envelopes | |
POST /envelopes | Create and send from a templateId or a document (base64 or url). Options: recipients, fields, withSignaturePage, subject, message, expireDays, reminderDays, sequential, metadata, fieldValues, sendAt, send: false (draft), testMode |
GET /envelopes?status=sent&limit=50 | List: draft, sent, completed, voided, expired |
GET /envelopes/{id} | Envelope, recipients and fields with their values |
POST /envelopes/{id}/send | Send a draft |
PUT /envelopes/{id}/recipients/{slot} | {"name","email"}. On a sent envelope the person gets a new link and the old one stops |
POST /envelopes/{id}/remind | {"slot":1}, or everyone whose turn it is |
POST /envelopes/{id}/extend | {"days":7} |
POST /envelopes/{id}/void | {"reason":"…"} |
DELETE /envelopes/{id} | Delete a draft, or the files of a finished envelope (void one that is out first) |
POST /envelopes/{id}/edit-url | Embedded sending: the editor for a draft, to show in an iframe: {"embedOrigin":"https://app.example.com"} |
POST /envelopes/{id}/signing-url | Embedded signing: {"slot":1, "returnUrl":"https://your.app/done"}; the signer comes back with ?event=signing_complete or decline |
GET /envelopes/{id}/documents/{kind} | signed, certificate, combined, current (in progress), original |
| Templates | |
GET /templates · GET /templates/{id} | Roles and fields (labels you can fill with fieldValues) |
POST /templates | Same body as an envelope plus name; recipients become roles |
GET /templates/{id}/export · POST /templates/import | Move a template between accounts as one JSON file (access codes are not exported) |
DELETE /templates/{id} | Delete a template |
| Bulk send | |
POST /bulk-sends | {"templateId", "rows":[{"name","email","values":{"Label":"value"}}]}, up to 100 rows; each row reports its own result |
GET /bulk-sends · GET /bulk-sends/{id} | Batches with completed / waiting counts, and their envelopes |
| Webhook | |
GET /webhook · PUT /webhook · DELETE /webhook | {"url","events":[…]}; the signing secret is returned once, when it is created |
Fields
recipient is the position in recipients (1 = first); 0 is you, the sender (give a value).
Types: signature, initials, date, name, email, company, title, text,
number, checkbox, radio, dropdown (options), attachment, stamp.
Place them three ways:
- Position:
page, andx,y,w,has fractions of the page from the top-left. - Anchor text:
"anchor":"Signature:"puts the field at every place that text appears; offsets and size in points. - Signature page:
"withSignaturePage": trueadds a page with a signature and a date box for each signer."autoSignaturePage": trueadds it only when there are no fields and no text tags. - Text tags: with
"textTags": true, tags you type in the document (PDF or Word) become fields and are covered in white.
Text tags
{{type:recipient}}, optionally followed by :Label, :required or :optional, and :options=A|B for dropdowns.
No spaces inside a tag: write _ for a space in a label. Recipient 0 is you; fill those fields with fieldValues by label.
Short forms: s signature, i initials, d date, t text, c checkbox, n name, e email.
Signature boxes sit on the tag's line; a box never runs into the next text on that line.
Tenant: {{signature:1}} Date: {{date:1}}
Initials: {{i:2}} Company: {{text:2:Company_name:optional}}
Plan: {{dropdown:1:Plan:options=Basic|Pro}} {{c:2:I_agree}} I agree
PO number: {{text:0:PO_number}} ← "fieldValues": {"PO number": "4411"}
The MCP tool send_document and the CLI send command read text tags by default and add a signature page only when a document has none.
{ "recipient": 1, "type": "signature", "page": 1, "x": 0.1, "y": 0.8, "w": 0.3, "h": 0.06 }
{ "recipient": 1, "type": "date", "anchor": "Date:", "anchorXOffset": 40, "anchorYOffset": -4 }
{ "recipient": 0, "type": "text", "page": 1, "x": 0.6, "y": 0.1, "w": 0.3, "h": 0.03, "value": "PO-4411" }
Webhooks
DocAISign POSTs JSON to your URL. Events: envelope-sent recipient-sent recipient-delivered recipient-completed recipient-declined envelope-completed envelope-declined envelope-voided envelope-expired recipient-corrected recipient-reassigned .
Each request has X-DocAISign-Event, X-DocAISign-Delivery and X-DocAISign-Signature: sha256=…, the HMAC-SHA256 of the raw body with your secret.
Failed deliveries are retried for about 11 hours.
// Node.js
const expected = 'sha256=' + crypto.createHmac('sha256', SECRET).update(rawBody).digest('hex');
const ok = crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(req.headers['x-docaisign-signature']));
Embedded signing
Show the signing page inside your own site. Ask for a link for one recipient and name the one website allowed to frame it:
POST /api/v1/envelopes/{id}/signing-url
{"slot": 1, "embedOrigin": "https://app.example.com"}
<iframe src="SIGNING_URL" style="width:100%;height:800px;border:0"></iframe>
<script>
addEventListener('message', e => {
if (e.origin !== 'https://docaisign.com' || e.data?.source !== 'docaisign') return;
console.log(e.data.event); // ready, signing_complete, decline, reassign
});
</script>
Every other website is blocked from framing the link. Recipients with an access code enter it inside the iframe, so give them the code yourself or show it in your app after they sign in. Confirm the result on your server with a webhook; browser events are only for updating your page.
Embedded sending
Let your users place fields and send from inside your app, without a DocAISign account. Create the envelope as a draft
("send": false), then ask for an editor link for the one website allowed to frame it:
POST /api/v1/envelopes/{id}/edit-url
{"embedOrigin": "https://app.example.com"}
→ {"url": "https://docaisign.com/d/…?embed=…&ep=…", "expiresAt": "…"}
<iframe src="EDIT_URL" style="width:100%;height:900px;border:0"></iframe>
<script>
addEventListener('message', e => {
if (e.origin !== 'https://docaisign.com' || e.data?.source !== 'docaisign') return;
console.log(e.data.event, e.data.envelopeId); // ready, sent, scheduled, signed
});
</script>
The link works for that one draft only and expires after 4 hours; ask for a new one each time you show the editor. It sends as the API key's account, so sends count against that account's plan. Test keys get links for test envelopes only.
Tamper-evident PDFs
Every completed signed PDF, certificate of completion and combined download carries a PDF digital signature (SHA-256).
Change one byte and PDF readers such as Adobe Acrobat show the signature as broken. The SHA-256 of the signed file is in the
certificate, in signedSha256, and can be checked at /verify.
Errors and limits
- Errors are
{"error":"…"}with 400 (fix the request), 401 (key), 404 (not yours or not found) or 429 (slow down). - Requests up to 36 MB; documents up to 20 MB, https and public addresses only.
- Up to 20 recipients per envelope and 100 rows per bulk send. Daily sending limits apply to every account.
- Real envelopes use your plan's sends (Pro and the 24-hour pass are unlimited). Test envelopes are free.