Programmatically manage documents, envelopes, templates, and webhooks. 25 endpoints to integrate Agreements.ai into your workflow.
https://api.agreements.aiAll API paths are relative to this base URL. This is separate from the main website.
Create API keys in Settings → Developers tab. Include your key in the Authorization header:
Authorization: Bearer sk_your_api_key_hereFirebase ID tokens are also accepted as Bearer tokens for browser-based integrations.
Rate Limits
30 requests/min10 requests/min5 requests/min{ "id": "env_abc123", "status": "pending", ... }{
"data": [ ... ],
"total": 42,
"limit": 20,
"offset": 0
}{
"error": "Envelope not found",
"code": "NOT_FOUND"
}Create, manage, and track signing envelopes.
/v1/envelopes— List envelopesstatus, limit, offset/v1/envelopes— Create & send envelope/v1/envelopes/:id— Get envelope details/v1/envelopes/:id— Void envelope/v1/envelopes/:id/audit— Get audit trail/v1/envelopes/:id/document— Download document content/v1/envelopes/:id/remind— Send reminder to pending signers/v1/envelopes/:id/void— Void envelope with reason/v1/envelopes/:id/recipients— Update signers/v1/envelopes/:id/resend— Resend signing notificationManage your document library.
/v1/documents— List documentslimit, status, search/v1/documents— Create document/v1/documents/:id— Get document with content/v1/documents/:id— Update document/v1/documents/:id— Delete documentBrowse and use document templates.
/v1/templates— List templatescategory, search, limit/v1/templates/:id— Get template details/v1/templates/:id/use— Create document from templateManage webhook subscriptions for real-time event notifications.
/v1/webhooks— List webhooks/v1/webhooks— Create webhook/v1/webhooks/:id— Get webhook details/v1/webhooks/:id— Update webhook/v1/webhooks/:id— Delete webhook/v1/webhooks/:id/test— Send test eventRetrieve account information and usage.
/v1/account— Get plan, usage, and limitscurl -X POST https://api.agreements.ai/v1/envelopes \
-H "Authorization: Bearer sk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"documentId": "doc_abc123",
"signers": [
{ "id": "s1", "label": "Client", "name": "John Doe", "email": "[email protected]" }
],
"fields": [
{ "id": "f1", "type": "signature", "signerId": "s1", "label": "Client Signature" }
],
"options": {
"signingOrder": "parallel",
"message": "Please review and sign this agreement."
}
}'const res = await fetch('https://api.agreements.ai/v1/envelopes', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_your_api_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
documentId: 'doc_abc123',
signers: [{ id: 's1', label: 'Client', name: 'John Doe', email: '[email protected]' }],
fields: [{ id: 'f1', type: 'signature', signerId: 's1', label: 'Client Signature' }],
options: { signingOrder: 'parallel', message: 'Please review and sign.' },
}),
});
const envelope = await res.json();
console.log(envelope.id);import requests
resp = requests.post(
"https://api.agreements.ai/v1/envelopes",
headers={"Authorization": "Bearer sk_your_api_key"},
json={
"documentId": "doc_abc123",
"signers": [{"id": "s1", "label": "Client", "name": "John Doe", "email": "[email protected]"}],
"fields": [{"id": "f1", "type": "signature", "signerId": "s1", "label": "Client Signature"}],
"options": {"signingOrder": "parallel", "message": "Please review and sign."},
},
)
envelope = resp.json()
print(envelope["id"])curl "https://api.agreements.ai/v1/documents?limit=10&search=lease" \
-H "Authorization: Bearer sk_your_api_key"const res = await fetch('https://api.agreements.ai/v1/documents?limit=10&search=lease', {
headers: { 'Authorization': 'Bearer sk_your_api_key' },
});
const { data, total } = await res.json();
console.log(`Found ${total} documents`);resp = requests.get(
"https://api.agreements.ai/v1/documents",
headers={"Authorization": "Bearer sk_your_api_key"},
params={"limit": 10, "search": "lease"},
)
result = resp.json()
print(f"Found {result['total']} documents")curl -X POST https://api.agreements.ai/v1/templates/tpl_nda01/use \
-H "Authorization: Bearer sk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"variables": {
"company_name": "Acme Inc.",
"effective_date": "2026-03-01",
"party_name": "John Doe"
}
}'const res = await fetch('https://api.agreements.ai/v1/templates/tpl_nda01/use', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_your_api_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
variables: { company_name: 'Acme Inc.', effective_date: '2026-03-01', party_name: 'John Doe' },
}),
});
const doc = await res.json();
console.log(doc.id); // newly created document IDresp = requests.post(
"https://api.agreements.ai/v1/templates/tpl_nda01/use",
headers={"Authorization": "Bearer sk_your_api_key"},
json={"variables": {"company_name": "Acme Inc.", "effective_date": "2026-03-01", "party_name": "John Doe"}},
)
doc = resp.json()
print(doc["id"])curl -X POST https://api.agreements.ai/v1/webhooks \
-H "Authorization: Bearer sk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-server.com/webhook",
"events": ["signing.completed", "signing.declined"],
"secret": "whsec_your_secret_key"
}'const res = await fetch('https://api.agreements.ai/v1/webhooks', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_your_api_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: 'https://your-server.com/webhook',
events: ['signing.completed', 'signing.declined'],
secret: 'whsec_your_secret_key',
}),
});
const webhook = await res.json();
console.log(webhook.id);resp = requests.post(
"https://api.agreements.ai/v1/webhooks",
headers={"Authorization": "Bearer sk_your_api_key"},
json={
"url": "https://your-server.com/webhook",
"events": ["signing.completed", "signing.declined"],
"secret": "whsec_your_secret_key",
},
)
webhook = resp.json()
print(webhook["id"])Events you can subscribe to when creating or updating webhooks.
| Event | Description |
|---|---|
| signing.sent | Triggered when a document is sent for signing. |
| signing.completed | Triggered when all signers have completed signing. |
| signing.voided | Triggered when the sender voids a signing request. |
| signing.declined | Triggered when a signer declines to sign. |
| signing.opened | Triggered when a signer opens the signing link. |
| signing.reminder_sent | Triggered when a reminder email is sent to a signer. |
All webhook payloads follow this structure:
{
"event": "signing.completed",
"timestamp": "2026-02-10T12:00:00Z",
"data": {
"documentId": "abc123",
"documentTitle": "Employment Agreement",
"signers": [
{
"name": "John Doe",
"email": "[email protected]",
"status": "signed",
"signedAt": "2026-02-10T12:00:00Z"
}
],
"completedAt": "2026-02-10T12:00:00Z"
}
}Every webhook includes an X-Agreements-Signature header — an HMAC-SHA256 hex digest of the body signed with your secret. Always verify before processing.
const crypto = require('crypto');
function verifyWebhook(body, signature, secret) {
const expected = crypto
.createHmac('sha256', secret)
.update(body)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
);
}import hmac, hashlib
def verify_webhook(body: bytes, signature: str, secret: str) -> bool:
expected = hmac.new(secret.encode(), body, hashlib.sha256).hexdigest()
return hmac.compare_digest(signature, expected)Streamline your legal workflow with AI-powered contract analysis and creation. Upload, analyze, and create contracts in minutes.