Skip to content

E-signatures for developers

View as Markdown

The e-signature endpoints let your code and workflows send documents for signature and collect the sealed result. How signing looks to people, the sealed PDF and the verification page are in the E-signatures guide. Every endpoint is in the REST API reference.

Nothing you call signs. Keys, agents and workflows can create, send, remind, void and read envelopes. Signing and declining are done by each recipient in person: a member in the app, anyone else with the emailed link and a one-time code. The signing endpoints refuse requests that carry an API key (403 keys_cannot_sign).

Scope Allows
esign:read Envelopes the key’s creator may see (status, recipients, audit trail) and their sealed PDFs; templates; the seal status (e-signature admins).
esign:write Create, send, remind and void envelopes; create and change templates (e-signature admins).

A key acts as its creator. The creator must be able to read the record an envelope is about. They then see the envelopes they sent and the ones sent to them; e-signature admins (owners, admins and roles with esign.admin) see all of them. Legal holds are set by e-signature admins only, with the settings:write scope.

An envelope is about a record (subject) and its documents are PDFs attached to that record, or a template:

Terminal window
curl -X POST https://app.ligament.ai/api/esign/envelopes \
-H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' \
-H 'Idempotency-Key: offer-0042' \
-d '{
"subject": { "entity": "candidate", "id": "cmx1a2b3c" },
"title": "Offer letter: Jordan Example",
"documents": [{ "attachmentId": "att_9f8e7d" }],
"signingOrder": "sequential",
"recipients": [
{ "email": "jordan@example.com", "name": "Jordan Example", "order": 1 },
{ "userId": "user_hr_lead", "order": 2 },
{ "email": "payroll@example.com", "role": "cc", "order": 3 }
],
"fields": [
{ "recipient": 0, "kind": "signature", "page": 1, "x": 120, "y": 112, "w": 160, "h": 30 },
{ "recipient": 0, "kind": "date_signed", "page": 1, "x": 330, "y": 112, "w": 90, "h": 20 },
{ "recipient": 0, "kind": "text", "page": 1, "x": 56, "y": 230, "w": 200, "h": 16, "label": "Start date" },
{ "recipient": 1, "kind": "initials", "page": 1, "x": 480, "y": 112, "w": 50, "h": 24 }
],
"expiresInDays": 14,
"reminderEveryDays": 3
}'

It is sent straight away unless you pass "send": false (then POST /api/esign/envelopes/<id>/send). The same Idempotency-Key returns the same envelope.

Field Notes
recipients[].auth link_email_otp (the default for people outside the workspace), link_sms_otp (needs phone and the Twilio channel), link (they confirm their email instead of a code), session (members, the default when you pass userId).
recipients[].role signer (default) or cc (gets the sealed copy).
fields[] kind is signature, initials, date_signed, name, email, text or checkbox. Positions are PDF points from the bottom-left corner of the page. recipient is the recipient’s index or email.
template A template key instead of documents and fields. Each recipient then names its templateRole; template fields with prefill: "{{record.<field>}}" take the record’s value.
expiresInDays 1 to 30 (default 14).

Documents are checked before anything is sent: only PDFs up to 20 MB and 500 pages, not encrypted and not already signed. Scripts, embedded files and forms are removed from the sealed copy and listed in the audit trail.

Terminal window
curl https://app.ligament.ai/api/esign/envelopes/<id> -H "Authorization: Bearer $KEY" # status, recipients, seal
curl https://app.ligament.ai/api/esign/envelopes/<id>/audit -H "Authorization: Bearer $KEY" # the audit trail and its check
curl -o signed.pdf https://app.ligament.ai/api/esign/envelopes/<id>/sealed -H "Authorization: Bearer $KEY"

Statuses: draft, sent, completing (everyone signed, sealing), completed, declined, voided, expired. The audit response includes check (the hash chain against the envelope’s latest entry) and anchorCheck (against the copy sealed into the PDF).

POST /api/esign/envelopes/<id>/remind sends the signers whose turn it is a fresh link; POST /api/esign/envelopes/<id>/void with { "reason": "…" } withdraws it.

esign.send creates and sends the envelope once per step (a retry or replay returns the same one), and its output has the envelopeId. Wait for the esign.finished event with lookback: true: a quick signer can finish before the wait starts, and lookback makes the wait see that event. The workflow linter refuses an esign.finished wait without it.

{
"key": "offer-signing",
"name": "Offer signing",
"trigger": { "type": "manual" },
"nodes": [
{ "id": "offer", "kind": "action", "action": "esign.send", "params": {
"subject": { "entity": "candidate", "id": "{{trigger.input.candidateId}}" },
"template": "offer_letter",
"recipients": [{ "email": "{{trigger.input.email}}", "name": "{{trigger.input.name}}", "templateRole": "candidate" }] } },
{ "id": "signed", "kind": "wait", "for": { "event": "esign.finished", "match": { "envelopeId": "{{steps.offer.output.envelopeId}}" }, "lookback": true, "timeout": "15d" } },
{ "id": "outcome", "kind": "switch", "on": "{{steps.signed.output.status}}", "cases": [
{ "equals": "completed", "do": [{ "id": "accepted", "kind": "action", "action": "set", "params": { "name": "result", "value": "signed" } }] }
], "default": [{ "id": "not_signed", "kind": "action", "action": "set", "params": { "name": "result", "value": "{{steps.signed.output.status}}" } }] }
]
}

esign.finished carries { envelopeId, subjectEntity, subjectId, status } with status = completed, declined, voided or expired. esign.remind and esign.void take an envelopeId. There is no workflow action that signs.

The MCP server has esign_create_envelope, esign_send, esign_void, esign_remind, esign_status and esign_sealed_pdf (MCP tools). The CLI has ligament esign create | send | void | remind | status | list | download (CLI reference):

Terminal window
ligament esign create --entity candidate --record cmx1a2b3c --file att_9f8e7d \
--signer jordan@example.com:"Jordan Example" --signer hr.lead@example.com --sequential
ligament esign status <id>
ligament esign download <id> -o offer-signed.pdf

GET /api/esign/verify?id=<certificate id> answers the short facts (no names or fingerprints). POST /api/esign/verify with { "sha256": "<the file's sha256>" } answers the full certificate when a sealed PDF has that fingerprint, and { "found": false, "match": false } when none does. Both are public and rate-limited.

The audit trail inside the PDF (audit-trail.json, format ligament.esign.audit/v1) can be checked without calling Ligament: each event’s rowHash is the sha256 of the previous event’s rowHash, a newline and the event’s canonical JSON, and the last sealed event’s hash is the anchor printed on the certificate page.