The agrmnt API
On this page
Everything you can do in the app, you can do over HTTP: upload documents, add recipients, place fields, send, track, download sealed PDFs, and get webhooks. Base URL: https://agrmnt.io/api/v1
Quick start
Create an API key under Settings → Developers, then send a PDF for signature in a single request. Put text such as {{sig}} in your PDF and agrmnt places the field on top of it.
curl https://agrmnt.io/api/v1/envelopes \
-H "Authorization: Bearer $AGRMNT_API_KEY" \
-F file=@contract.pdf \
-F 'payload={
"title": "Consulting Agreement",
"message": "Hi Ada, please sign at your convenience.",
"recipients": [
{ "name": "Ada Lovelace", "email": "ada@example.com" },
{ "name": "Charles Babbage", "email": "charles@example.com", "role": "cc" }
],
"fields": [
{ "recipient": 0, "type": "signature", "anchor": { "text": "{{sig}}" } },
{ "recipient": 0, "type": "date", "anchor": { "text": "{{date}}" } }
],
"send": true
}'The same request with JSON and a base64 file, in Node:
import { readFile } from "node:fs/promises";
const res = await fetch("https://agrmnt.io/api/v1/envelopes", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.AGRMNT_API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
title: "Consulting Agreement",
files: [{ filename: "contract.pdf", base64: (await readFile("contract.pdf")).toString("base64") }],
recipients: [{ name: "Ada Lovelace", email: "ada@example.com" }],
fields: [{ recipient: 0, type: "signature", page: 1, x: 0.1, y: 0.8, width: 0.3, height: 0.06 }],
send: true,
}),
});
const envelope = await res.json(); // { id: "env_…", status: "sent", recipients: [...], ... }Authentication
API access is part of the Business and Enterprise plans. Create an account if you don't have one yet. A team owner or admin creates keys under Settings → Developers.
Send your API key as a bearer token: Authorization: Bearer agr_live_…. Keys belong to a team, act as the teammate who created them, and can be revoked at any time. Check a key with GET /me. Keep keys server-side — never ship them in a browser or mobile app.
Test mode
Build and test your integration with a test key (agr_test_…), created under Settings → Developers like a live key (agr_live_…). Test keys work on any plan, so you can build before your team subscribes. A test key uses the same endpoints and returns the same objects as a live key, but everything it creates is a test document ("livemode": false):
- Email goes only to your team. Messages to members of your team are sent, with
[TEST]in the subject. Messages to anyone else are recorded but not sent, and text messages are never sent. Open each signer's signing page withPOST /envelopes/:id/recipients/:rid/signing-url. - Signer codes are always
000000. Documents that ask signers to confirm their email or phone send nothing; enter000000. - Photo ID checks are simulated. Nothing reaches Stripe and no prepaid checks are used. The signer lands on a test page and picks the outcome: verified, verified with a different name on the ID, failed (expired ID, selfie mismatch, unverifiable ID), declined, or left unfinished (reported as abandoned after 30 minutes). The same
recipient.id_*webhooks fire, and the name check and signer alerts work as in live mode. - Finished documents are marked TEST DOCUMENT on every page, including the certificate, and sealed with agrmnt's own test key without a trusted timestamp. They aren't legally binding, don't verify at
/verify, stay out of the public seal log, and are erased 30 days after they finish. - Webhooks are separate. Events about test documents go only to endpoints created with a test key (or added in the app as a test endpoint), and every payload carries
livemode. - Test and live data don't mix. A test key sees only test documents and a live key only live ones; both can read and use your templates. Test keys can't change templates, contacts, forms or team settings, can't start bulk sends or records declarations, and can't use payment fields. Those calls answer
403 test_mode_unsupported. - Test documents never count toward your plan's usage. In the app they appear under Documents → Test.
POST /envelopes isn't idempotent, so if a request times out, check GET /envelopes before retrying to avoid sending twice.
Errors
Errors use conventional HTTP status codes and a consistent body:
{ "error": { "code": "bad_request", "message": "recipients[0]: a valid email is required" } }400bad request ·401invalid API key ·403forbidden ·404not found402not included in your plan (plan_limit), e.g. sending without a plan, or a feature your plan doesn't include409the action isn't allowed in the envelope's current state (e.g. editing a sent envelope)422the body doesn't match the expected shape (validation_error, with the failing paths inmessage) ·429rate limited ·5xxretry with backoff
Envelopes
An envelope is a document (one or more files merged into a single PDF) plus its recipients and fields. Lifecycle: draft → sent → completed, or declined / voided / expired.
Recipients
signer(default) fills in fields and signs. Needs at least onesignaturefield.approverreviews and approves.viewermust view and acknowledge.ccreceives the completed PDF.- Set
"sequential": trueandroutingOrderto sign in order; recipients sharing an order sign in parallel. - Identity verification: before seeing the document, every signer, approver and viewer confirms a one-time code sent to their
email. Enterprise accounts with SMS verification also require a mobilephone(international format, e.g.+14155550123) for those recipients. Results appear asemailVerifiedAt/phoneVerifiedAton each recipient and in the audit trail. accessCoderequires the recipient to enter a code you share separately.embedded: truestops invitation, reminder and completion emails (see embedded signing).requireIdCheck: trueasks the recipient to verify a driver's license, passport or ID card, with a matching selfie, before the document opens. It uses one of your team's prepaid photo ID checks (buy packs in Settings, Billing); sending returns402 id_checks_neededif the team doesn't have enough, and a check set aside but never used comes back. The result appears asidCheckon the recipient and on the certificate. If a check fails, the recipient can try again or still sign: you get an email and arecipient.id_check_failedwebhook, and the certificate records the failure. Webhooks also tell you when a check starts (recipient.id_check_started), passes (recipient.id_verified) or is left unfinished for 30 minutes (recipient.id_check_abandoned).- Proof of review: the time each recipient spends on each page is counted by agrmnt's server while the page is in view, and returned as
pageSecondson the recipient and printed on the certificate. SetreviewSecondson the envelope (1 to 300) to require at least that many seconds on every page before a recipient can finish.
Creating
POST /envelopes accepts multipart/form-data (one or more file parts, plus a JSON payload string) or application/json with files[].base64. Supported uploads: PDF, Word (.docx), PNG, JPEG, up to 4 MB per request in total. Word files are converted to PDF when you upload them; recipients sign the PDF, and the original file's SHA-256 is recorded in the audit trail. Base64 adds about a third to the request size, so prefer multipart for larger files. Pass "send": true to send immediately, or leave it as a draft and call POST /envelopes/:id/send later. Attach your own identifiers with metadata (string key/values) — they come back in every response and webhook.
Updating drafts
PATCH /envelopes/:id updates settings. If you include recipients or fields, that list replaces the existing one. Keep a recipient's id to preserve it. The response includes recipientIds in the order you sent them.
Website forms
On Business, people can sign right on a form on your own website, such as an application or an intake form. Create one under Website forms in the app: give it a name and your website's address, say who signs and which of your form's fields hold each person's name and email, and choose what they sign:
- A PDF of the answers. agrmnt makes a PDF of everything filled in (labeled as your page labels it), with each signature at the end. Passwords and hidden fields are left out; wrap anything else to leave out in
data-agrmnt-skip. - Your website's own PDF. The page sends agrmnt only the signers' names, emails and signatures, and gets a signing token. Your server sends the PDF it builds with the token, and gets it back signed and sealed.
- A template. The form's answers fill in one of your templates (set it up from the template's Form button). Anyone else in the template signs by email afterwards.
Then put a pad inside the form for each person, and load the script once:
<div data-agrmnt-signature="Owner 1"></div> <div data-agrmnt-signature="Owner 2"></div> <!-- an optional signer signs only when this is showing --> <script src="https://agrmnt.io/forms.js" data-agrmnt-form="frm_…" async></script>
When the visitor submits, each person's signature goes to agrmnt first, with their own consent, IP address, device and the page address. Your form then submits as usual, with agrmnt_document_id and agrmnt_verify_url added (or agrmnt_signing, the token, on a form that uses your PDF), and fires an agrmnt:signed event. The sealed PDF and certificate go to the signers, to you and to the form's copy addresses, and envelope.completed fires. People who sign on a form don't confirm an email code, and the certificate says so.
data-agrmnt-image-field="signature_png"on a pad also puts the signature (a PNG data URL) in that form field, for your own records.- For React and other frameworks, add
data-agrmnt-manualto the script tag and callawait agrmnt.sign(form)in your submit handler. It resolves withdocumentIdorsigningToken, andsignaturesby name. Pass{ pdf }(a Blob, ArrayBuffer or base64) to send a PDF made in the browser, which a PDF form accepts only with Accept a PDF made in the visitor's browser turned on. Otherwise your server sends it, as below. - If your site sends a Content-Security-Policy, add
https://agrmnt.iotoscript-srcandconnect-src. The pads need no inline styles. - A name can come from two fields, like
first_name last_name: put both, with a space between, as the name field. - Match your design with CSS variables on the pad or a parent:
--agrmnt-background,--agrmnt-text,--agrmnt-muted,--agrmnt-border,--agrmnt-accent,--agrmnt-on-accent,--agrmnt-pad,--agrmnt-ink,--agrmnt-radius. The signature is always saved in dark ink.
With your own PDF, send it with the token within the hour. Leave out placements to have the signatures added on a page at the end, or say where each goes, by position (fractions of the page from the top-left, or "units": "pt") or by anchor text in the PDF. Sending the same token again returns the same document, so retrying is safe.
curl -X POST https://agrmnt.io/api/v1/form-signings/fsg_…/document -H "Authorization: Bearer $AGRMNT_API_KEY" -H "Content-Type: application/json" -d '{
"pdf": "JVBERi0xLjcK…",
"placements": [
{ "signer": "Owner 1", "page": 1, "x": 0.08, "y": 0.80, "width": 0.38, "height": 0.06 },
{ "signer": "Owner 1", "type": "date", "anchor": { "text": "Date signed:" } }
]
}'
# → { "documentId": "env_…", "verifyUrl": "…", "sha256": "…", "pdf": "<signed, sealed PDF as base64>", "document": { … } }GET /forms lists your website forms, and POST /forms and PUT /forms/:id create and change them (name, mode of summary or pdf, origins, signers, notifyEmails).
Sealing without signatures
POST /seals takes the same upload as POST /envelopes and returns a finished document: every page stamped “Sealed by” your team with its ID, a certificate of sealing appended, and agrmnt's digital seal and independent timestamp applied. Use it for documents you issue rather than sign, such as term sheets, disclosures, invoices or letters. Anyone can check one at /verify or in Adobe Reader. It has sealOnly: true, fires envelope.completed, and counts as one document on your plan.
Fields & placement
Field types: signature, initials, date, name, email, company, title, text, number, checkbox, dropdown, attachment, formula, payment.
dateandemailare filled automatically when the recipient signs;nameis prefilled.dropdownrequiresoptions.text/numberaccept a prefilledvalue.checkboxis optional by default.- Assign fields with
recipientId, orrecipientas an index into yourrecipientsarray, an email, or a templateroleName.
Coordinates
By default x, y, width and height are fractions of the page (0–1) with the origin at the top-left, so they work at any page size. Use "units": "pt" for PDF points (1/72 inch). Width and height are optional and default to sensible sizes per type. Page sizes are returned in envelope.pages.
Anchor text
Instead of coordinates, give an anchor. agrmnt finds every occurrence of the text in the PDF and places the field with its bottom-left at the anchor's baseline. Tip: render anchors in white text so they're invisible.
{ "recipient": "ada@example.com", "type": "initials",
"anchor": { "text": "[initial-here]", "offsetX": 0, "offsetY": 0, "occurrence": "all" } }Templates
Templates store a document, recipient roles and field placement. Create them in the app or with POST /templates (same body as envelopes, recipients need a roleName). Then create envelopes from them, matching people to roles:
curl https://agrmnt.io/api/v1/envelopes -H "Authorization: Bearer $AGRMNT_API_KEY" -H "Content-Type: application/json" -d '{
"templateId": "tpl_…",
"recipients": [
{ "roleName": "Client", "name": "Ada Lovelace", "email": "ada@example.com" },
{ "roleName": "Company", "name": "You", "email": "you@yourco.com" }
],
"metadata": { "crmDealId": "8842" },
"send": true
}'A role saved with an email in the template, such as a copy (CC) recipient for your records, is included automatically when you leave it out of recipients. CC recipients get the sealed PDF once everyone has signed.
Public signing links
On Business, any template can have a public link. Whoever opens it enters their name and email, confirms the email with a code, and signs as the role you choose; every other role is filled from its saved details. Each response is an ordinary envelope (with metadata.publicLinkId), so webhooks fire as usual.
roleRecipientId is the id of a role in GET /templates/:id. Every other role needs a saved name and email, signers need a signature field, and with a signing order the link role must sign first; otherwise the request fails with a 400 that lists what to fix.
curl -X PUT https://agrmnt.io/api/v1/templates/tpl_…/public-link -H "Authorization: Bearer $AGRMNT_API_KEY" -H "Content-Type: application/json" \
-d '{ "roleRecipientId": "rcp_…", "enabled": true, "maxUses": 500 }'
# → { "url": "https://agrmnt.io/f/…", "uses": 0, … } GET reads it, DELETE removes it, POST …/public-link/reset issues a new URLEmbedded signing
Mark recipients "embedded": true so agrmnt doesn't send them invitation, reminder or completion emails, then request a URL when they're in your app. Show it in an iframe or redirect to it. With redirectUrl set, the signer is sent back with ?event=signing_complete.
curl -X POST https://agrmnt.io/api/v1/envelopes/env_…/recipients/rcp_…/signing-url -H "Authorization: Bearer $AGRMNT_API_KEY"
# { "recipientId": "rcp_…", "status": "sent", "url": "https://agrmnt.io/sign/…?embed=1" }Embedded signers still prove who they are: inside the page they ask for a one-time code, which is emailed to their address, before the document opens. Download the signed PDF for them from /documents/completed, since they don't get the completion email.
The embedded page posts messages to the parent window: { source: "agrmnt", event: "loaded" | "completed" | "declined" }. It can only be framed by the websites you list under Settings, Developers, Embedded signing (for example https://app.example.com), and only for recipients created with "embedded": true. Anywhere else it shows a link to open the document directly instead.
Documents & audit trail
Download PDFs from GET /envelopes/:id/documents/original, /completed (signed document with the certificate of completion appended, digitally sealed; each page carries the envelope ID and page number along the top unless your team turns that off) and /certificate. Add ?download=1 for an attachment disposition. The x-content-sha256 header carries the file's fingerprint; anyone can check a completed file at /verify. GET /envelopes/:id/audit returns every event with timestamps, IP addresses and user agents. GET /envelopes/:id/evidence returns a completed envelope's evidence package as a zip: the signed PDF, certificate, original, audit trail, the RFC 3161 timestamp tokens (.tst), each signer's independently timestamped signing record, an offline verifier script (verify-evidence.mjs), its seal log proofs and a README on checking each without agrmnt. GET /envelopes/:id/audit returns each event's seq, prevHash and hash. Signed PDFs carry long-term validation data (PAdES-LTA) when their seal was timestamped. If your team erases finished documents after a set time (Settings → Team → Privacy), download what you need before then: afterwards contentErasedAt is set and the original and signed PDFs return 410, while the certificate, audit trail and fingerprints remain.
Webhooks
Register endpoints in the app or with POST /webhooks. Subscribe to specific events or leave events empty for all:
envelope.sentenvelope.completedenvelope.declinedenvelope.voidedenvelope.expiredrecipient.sentrecipient.viewedrecipient.completedrecipient.declinedrecipient.reassignedrecipient.email_bouncedrecipient.id_check_startedrecipient.id_verifiedrecipient.id_check_failedrecipient.id_check_abandoned
POST /your/endpoint
agrmnt-event: envelope.completed
agrmnt-delivery: whd_…
agrmnt-signature: t=1760000000,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
{ "id": "whd_…", "event": "envelope.completed", "livemode": true, "createdAt": "…", "data": { "envelope": { "id": "env_…", "status": "completed", … } } }Verify the signature by computing an HMAC-SHA256 of `${t}.${rawBody}` with your endpoint secret and comparing it to v1. Reject timestamps older than a few minutes. Respond with any 2xx within 10 seconds; failures are retried with exponential backoff for about a day.
import crypto from "node:crypto";
export function verifyAgrmnt(rawBody, header, secret) {
const { t, v1 } = Object.fromEntries(header.split(",").map((p) => p.split("=")));
const expected = crypto.createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
const fresh = Math.abs(Date.now() / 1000 - Number(t)) < 300;
return fresh && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(v1));
}import hashlib, hmac, time
def verify_agrmnt(raw_body: bytes, header: str, secret: str) -> bool:
parts = dict(p.split("=", 1) for p in header.split(","))
expected = hmac.new(secret.encode(), f"{parts['t']}.".encode() + raw_body, hashlib.sha256).hexdigest()
return abs(time.time() - int(parts["t"])) < 300 and hmac.compare_digest(expected, parts["v1"])Endpoint reference
Machine-readable spec: /api/v1/openapi.json (OpenAPI 3.1 — import it into Postman, Insomnia or a code generator).
Envelopes
/envelopesstatus (comma separated), limit (≤100), page. Returns { "data": [...], "page": 1, "hasMore": false }./envelopestemplateId; optional send./envelopes/:id/envelopes/:id/envelopes/:id/envelopes/:id/send/envelopes/:id/void{ "reason": "…" }/envelopes/:id/remind/envelopes/:id/duplicate{ "as": "envelope" | "template" }/envelopes/:id/documents/envelopes/:id/documents/:typeoriginal · completed · certificate/envelopes/:id/audit/envelopes/:id/evidence/envelopes/:id/recipients/:rid/envelopes/:id/recipients/:rid/resend/envelopes/:id/recipients/:rid/signing-urlTemplates
/templates/templates/templates/:id/templates/:id/templates/:id/templates/:id/public-linknull), setup problems and recent responses./templates/:id/public-link{ "roleRecipientId": "rcp_…", "enabled": true, "maxUses": null }/templates/:id/public-link/reset/templates/:id/public-linkWebhooks
/webhooks/webhooks{ "url": "https://…", "events": [] } — response includes the signing secret./webhooks/:idurl, events or active./webhooks/:id/webhooks/:id/deliveries/webhooks/:id/testwebhook.test event.Account
/meQuestions or missing something? Email admin@agrmnt.io and we'll help.