by
Developers

Signatures from your own software

A small REST API sends documents for signature; signed webhooks tell you what happened. It is the same API the EspoCRM app uses.

Send a document

Create a key in Settings → API keys. A key belongs to one workspace and only sees its documents. Put [[dvellum:sign]] markers in your PDF and the fields are placed for you, or send the fields' positions yourself.

POST /packets
Create (and send) a document: PDF, people, optional fields, language, expiry, reminders
GET /packets/{id}
Status of the document and of each person
GET /packets/{id}/document
The sealed PDF once everyone has signed
GET /packets/{id}/audit
The audit trail, with a check that it is intact
POST /packets/{id}/void
Stop a document that is out for signature

A signature request is a packet. The same calls also work at /envelopes, with the answers they have always given.

# Send a PDF with markers to one signer
curl https://app.dvellum.com/api/v1/packets \
  -H "Authorization: Bearer PASTE_LIVE_KEY_HERE" \
  -F title="Service agreement" \
  -F document=@agreement.pdf \
  -F "recipients[0][key]=client" \
  -F "recipients[0][name]=Ana Pérez" \
  -F "recipients[0][email]=ana@example.com" \
  -F locale=es \
  -F remind_every_days=3 \
  -F send=true

Webhooks

Add one or more https addresses in Settings → Webhooks, each with the events it wants and what each message includes. Each event is a JSON POST signed with that webhook's secret (HMAC-SHA256, with a timestamp), so you can check it came from us; its id lets you skip repeats.

  • packet.sent · packet.completed · packet.declined
  • packet.voided · packet.expired
  • recipient.viewed · recipient.signed · recipient.bounced
# Check the signature (PHP)
$body = file_get_contents('php://input');
$header = $_SERVER['HTTP_X_DVELLUM_SIGNATURE'] ?? '';
preg_match('/t=(\d+)/', $header, $t);
preg_match_all('/v1=([0-9a-f]+)/', $header, $v1);  // two while a secret is being replaced
$expected = hash_hmac('sha256', ($t[1] ?? '').'.'.$body, $secret);
if (abs(time() - (int) ($t[1] ?? 0)) > 300
    || ! array_filter($v1[1], fn ($s) => hash_equals($expected, $s))) {
    http_response_code(401); exit;
}
$event = json_decode($body, true);  // id, type, data.object (the packet)