1. Get an API key
In your signing workspace, open the API keys and webhooks settings and create a key. There are two kinds:
- Live keys (
dms_live_…) send real agreements. They need the plan that includes the API; see pricing. - Test keys (
dms_test_…) work on every plan. Their agreements send no email, don't count toward your plan, are marked TEST and aren't legally binding, up to 50 a day. Use the signing links in the response to try them.
Send the key on every request as Authorization: Bearer <key>. The base URL is https://docmesign.com/api/v1.
2. Send an agreement
POST /envelopes creates an agreement from a PDF (document_url, a public https address, or document_base64; one of the two, up to 25 MB) and sends it. Set "send": false to keep it as a draft to finish in the app.
curl https://docmesign.com/api/v1/envelopes \
-H "Authorization: Bearer $DOCMESIGN_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: offer-2026-0142" \
-d '{
"title": "Offer letter - Priya Sharma",
"document_url": "https://example.com/offer.pdf",
"recipients": [
{
"name": "Priya Sharma",
"email": "priya@example.com",
"role": "signer",
"order": 1,
"fields": [
{ "type": "signature", "page": 2, "x": 72, "y": 640, "width": 180, "height": 40 },
{ "type": "date_signed", "page": 2, "x": 300, "y": 650, "width": 110, "height": 24 }
]
},
{ "name": "HR team", "email": "hr@example.com", "role": "cc" }
],
"custom_fields": { "Employee ID": "E-1042" }
}'- Recipients are
signerorcc, up to 20, inorder(1, 2, …). Each signer'sfieldsgo on 1-based pages, positioned in PDF points from the page's top-left corner. - Field types include
signature,initials,date_signed,full_name,text,checkbox,dropdown(withoptions),radio,email,company,title,numberandattachment. - Optional:
email_subject,email_messageand up to 10custom_fieldsof your own. - Send the same
Idempotency-Keyagain and you get the agreement already created instead of a second one (the response hasIdempotent-Replayed: true).
The response describes the agreement: its id, status, each recipient's status and signing_url, sha256_source, and your plan's usage. With a live key, list and create responses also carry X-DocMeSign-Plan, X-DocMeSign-Quota-Limit and X-DocMeSign-Quota-Remaining headers.
3. Check, download or void
GET /envelopes?status=sent&limit=25: your recent agreements (statusdraft,sent,completed,declinedorvoided; up to 100).GET /envelopes/{id}: one agreement and its recipients.GET /envelopes/{id}/download: redirects to a short-lived link to the signed PDF with its certificate, once everyone has signed. Add?version=originalfor the PDF as uploaded.POST /envelopes/{id}/voidwith{ "reason": "…" }: cancels a draft or an agreement still waiting for signatures (a reason is required once sent).GET /metering/usage: your plan, documents used and left this period.
The full description is an OpenAPI 3.1 file at /api/v1/openapi.json (no key needed), and it always lists what's live. More examples are on the developers page.
4. Receive webhooks
Add an https endpoint in the API keys and webhooks settings. We post JSON for these events: envelope.sent, envelope.viewed, envelope.otp_verified, envelope.signed, envelope.reviewed, envelope.completed, envelope.declined and envelope.voided. Each body has the event id, type, created_at, organization_id and data (with the agreement).
Check the X-DocMeSign-Signature header before trusting a request. It is sha256= followed by the HMAC-SHA256 of {timestamp}.{body} using your endpoint's secret, where the timestamp is the X-DocMeSign-Timestamp header.
import { createHmac, timingSafeEqual } from "node:crypto";
function isFromDocMeSign(rawBody, headers, secret) {
const timestamp = headers["x-docmesign-timestamp"];
const expected =
"sha256=" + createHmac("sha256", secret).update(timestamp + "." + rawBody).digest("hex");
const given = String(headers["x-docmesign-signature"] || "");
const fresh = Math.abs(Date.now() / 1000 - Number(timestamp)) < 300;
return fresh && given.length === expected.length &&
timingSafeEqual(Buffer.from(given), Buffer.from(expected));
}Reply with a 2xx status. If delivery fails we retry after 1, 5, 30, 120 and 360 minutes. A Slack or Microsoft Teams channel can get a short message instead of JSON.
Something out of date or unclear? Email dev-admin@docmesign.com. More answers in the FAQ and Help.