API documentation
Create contracts, send them for signing, download the signed PDF and get notified when something happens. A REST API in JSON.
Introduction
Base address of the API:
https://api.vetrysign.com.brAll calls use HTTPS and JSON. The API is available on paid plans; on the Free plan, use the panel. To enable the API on your account, talk to our team.
A document always follows the same path: you create the envelope (from a template or a PDF), the signers receive the link by e-mail, confirm their e-mail with a code and sign. When everyone has signed, Vetry Sign generates the final PDF with a certificate, e-mails a copy to everyone with a personal download link, and notifies your system by webhook.
Authentication
Create a key in the panel, under API keys. It starts with vsk_live_ and is shown only once, so store it in a secrets vault. Send the key on every call:
Authorization: Bearer vsk_live_YOUR_KEYEach key belongs to one company and only sees that company's data. Use one key per integrated system, and revoke any leaked key in the panel. Never put the key in code that runs in the browser or in the user's app.
Quick start
Create an envelope from a template and send the invitations to the signers right away:
curl -X POST https://api.vetrysign.com.br/v1/envelopes \
-H "Authorization: Bearer vsk_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Service agreement",
"templateId": "TEMPLATE_ID",
"variables": { "client": "Example Ltd", "amount": "$1,200.00" },
"signers": [
{ "name": "Maria Souza", "email": "[email protected]", "roleLabel": "Client" },
{ "name": "João Lima", "email": "[email protected]", "roleLabel": "Provider" }
],
"expiresInDays": 15,
"reminderEveryHours": 48,
"externalRef": "client-123",
"folderName": "Example Ltd",
"signingOrder": "SEQUENTIAL",
"requireInitials": true,
"sendNow": true
}'Response (201):
{
"id": "0f6c…",
"title": "Service agreement",
"status": "SENT",
"verificationCode": "VS-7RZ4-ZBEE",
"externalRef": "client-123",
"folderId": "ckx…",
"signingOrder": "SEQUENTIAL",
"requireInitials": true,
"reminderEveryHours": 48,
"signers": [
{ "id": "…", "name": "Maria Souza", "email": "[email protected]", "status": "NOTIFIED", "signOrder": 1 }
],
"notifications": [ { "signerId": "…", "ok": true } ]
}Keep the envelope id: you use it to query, download the PDF and match webhook notices. The externalRef field is free-form and holds your own customer or contract identifier.
To sign a PDF you already have, replace templateId and variables with pdfBase64 (Base64 file, up to 10 MB):
{
"title": "Contract addendum",
"pdfBase64": "JVBERi0xLjcK…",
"signers": [ { "name": "Maria Souza", "email": "[email protected]" } ],
"sendNow": true
}Envelopes
| Call | What it does |
|---|---|
POST /v1/envelopes | Creates an envelope. With sendNow: true it sends the invitations right away; otherwise it stays as a draft. |
GET /v1/envelopes | Lists envelopes. Filters: status, externalRef, folderId (or none) and limit (1 to 200). |
GET /v1/envelopes/:id | Shows an envelope with its signers and the status of each. |
POST /v1/envelopes/:id/send | Sends the invitations of a draft. |
POST /v1/envelopes/:id/resend | Resends the invitation. Pass signerId for a single signer. |
POST /v1/envelopes/:id/reminder | Turns the automatic reminder on, changes it or turns it off ({ "everyHours": 48 } or { "everyHours": null }). |
POST /v1/envelopes/:id/cancel | Cancels the envelope. Accepts reason. |
GET /v1/envelopes/:id/audit | Audit trail: each event with date, IP and device, chained by hash. |
POST /v1/documents/convert-docx | Converts a Word file to PDF (docxBase64, up to 8 MB) and returns the PDF. Nothing is stored: send the PDF afterwards as pdfBase64. |
Fields of POST /v1/envelopes
| Field | Description |
|---|---|
title | Document title (2 to 160 characters). Required. |
templateId + variables | Template and the values of its {{name}} variables. Use this or pdfBase64. |
pdfBase64 | A ready PDF, Base64-encoded, up to 10 MB. |
signers | 1 to 10 people. Each with name and email (all different) and, optionally, phone, document (tax ID, which the person must type when signing) and roleLabel. With notify: false the person gets no e-mail invitation (the panel uses this when the person creating the document signs on the spot). |
expiresInDays | Deadline to sign, 1 to 90 days. Default: 30. |
reminderEveryHours | Automatic e-mail reminder to whoever has not signed yet, every 6 to 720 hours. It is sent only in the daytime (8 am to 8 pm, Brasília time), up to 12 times per person and until the deadline. Without the field there are no reminders. |
externalRef | Your identifier (up to 120 characters). It comes back in webhooks and works as a list filter. |
folderId or folderName | Folder where the contract is filed. With folderName the folder is created if it does not exist yet. |
signingOrder | PARALLEL (default): everyone is invited at once. SEQUENTIAL: one at a time, in the order of the signers list; each person's invitation goes out only after the previous one signs. |
requireInitials | true asks each signer for their initials, stamped on every page of the final PDF. Default: false. |
metadata | Free-form data, up to 5 KB. |
sendNow | true sends the invitations immediately. Default: false. |
Statuses
Envelope: DRAFT, SENT, IN_PROGRESS (someone has already signed), COMPLETED (everyone signed), EXPIRED and CANCELLED.
Signer: PENDING (not invited yet; in one-at-a-time mode it means waiting for their turn), NOTIFIED (invitation sent), VIEWED, SIGNED and DECLINED. If a signer declines, the envelope is cancelled.
Signing order and initials
With signingOrder: "SEQUENTIAL", only the first person on the list is invited. When they sign, Vetry Sign invites the next one, and so on to the end. Resending (/resend) only applies to whoever's turn it is.
With requireInitials: true, the signing screen asks for each person's initials. They appear side by side at the bottom of every page of the document, and the certificate shows each signer's initials.
Templates
A template is text with variables in double braces, such as {{client}}. You can create it in the panel's visual editor, with the AI's help (plans with AI) or through the API. Every change creates a new version, and the envelope keeps the version it used.
| Call | What it does |
|---|---|
POST /v1/templates | Creates a template (name, bodyHtml). |
GET /v1/templates | Lists the active templates. |
GET /v1/templates/:id | Shows a template. |
PUT /v1/templates/:id | Creates a new version (the previous one is replaced). |
POST /v1/templates/:id/preview | Generates a PDF preview with the variables you send, without creating an envelope. |
Variable values are always treated as text: no HTML sent in them is executed.
Folders
Folders group contracts, for example one folder per customer.
| Call | What it does |
|---|---|
GET /v1/folders | Lists the folders with the total of contracts and how many are still open. |
POST /v1/folders | Creates a folder (name and, optionally, color). |
PATCH /v1/folders/:id | Renames it or changes its color. |
DELETE /v1/folders/:id | Archives the folder. The contracts stay stored, without a folder. |
POST /v1/envelopes/:id/move | Moves a contract into a folder (folderId) or out of it (null). |
Download the document
Use type=signed for the final PDF (document plus certificate page) or type=original for the file before signing. The response is the PDF itself.
curl -L https://api.vetrysign.com.br/v1/envelopes/ENVELOPE_ID/download?type=signed \
-H "Authorization: Bearer vsk_live_YOUR_KEY" \
-o signed-contract.pdfThe signed PDF only exists once the envelope reaches COMPLETED. The file's finalHash (SHA-256) comes in the envelope.completed webhook and in the envelope query, so you can check its integrity.
Webhooks
Vetry Sign notifies your system with an HTTPS POST call when something happens to an envelope. Register the address in the panel, under Webhooks, or through the API (POST /v1/webhooks). The whsec_… secret is shown only once.
Events
| Event | When |
|---|---|
envelope.sent | The envelope was sent to the signers |
signer.viewed | A signer opened the document for the first time |
signer.signed | A signer signed |
signer.declined | A signer declined (the envelope is cancelled) |
envelope.completed | Everyone signed and the final PDF was generated |
envelope.cancelled | The envelope was cancelled |
envelope.expired | The deadline passed without all signatures |
Each address chooses which events it receives. The panel's test button (or POST /v1/webhooks/:id/test) sends a ping event.
Request body
{
"id": "id-of-this-delivery",
"event": "envelope.completed",
"occurredAt": "2026-11-23T17:06:00.000Z",
"envelope": {
"id": "…", "title": "Contract", "status": "COMPLETED",
"externalRef": "client-123", "verificationCode": "VS-7RZ4-ZBEE"
},
"signer": { "id": "…", "name": "Maria", "email": "[email protected]", "status": "SIGNED", "signedAt": "…" },
"finalHash": "sha256 of the final PDF (only in envelope.completed)"
}Use the id to ignore repeated deliveries: the same event may arrive more than once.
Checking that the call comes from Vetry Sign
Every call carries the header X-VetrySign-Signature: t=<timestamp>,v1=<signature>. The signature is the HMAC-SHA256, in hexadecimal, of the text "<timestamp>.<exact body received>", using the webhook secret.
- Read the body as raw text, without reformatting the JSON.
- Recompute the signature and compare in constant time.
- Reject it if the
timestampis older than 5 minutes.
Node.js:
import { createHmac, timingSafeEqual } from 'node:crypto';
function valid(header, rawBody, secret) {
const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')));
if (Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) return false;
const expected = createHmac('sha256', secret).update(`${parts.t}.${rawBody}`).digest('hex');
const a = Buffer.from(expected), b = Buffer.from(parts.v1 ?? '');
return a.length === b.length && timingSafeEqual(a, b);
}C#:
static bool Valid(string header, string rawBody, string secret)
{
var parts = header.Split(',').Select(p => p.Split('=', 2)).ToDictionary(p => p[0], p => p[1]);
if (Math.Abs(DateTimeOffset.UtcNow.ToUnixTimeSeconds() - long.Parse(parts["t"])) > 300) return false;
using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(secret));
var expected = Convert.ToHexString(hmac.ComputeHash(Encoding.UTF8.GetBytes($"{parts["t"]}.{rawBody}"))).ToLowerInvariant();
return CryptographicOperations.FixedTimeEquals(Encoding.UTF8.GetBytes(expected), Encoding.UTF8.GetBytes(parts["v1"]));
}Delivery and retries
Reply with any 2xx status within 10 seconds. Otherwise Vetry Sign tries again after 1 min, 5 min, 30 min, 2 h, 6 h and 24 h (7 attempts in total) and then marks the delivery as failed. The history, with the last error of each delivery, is at GET /v1/webhooks/:id/deliveries.
The address must be https and public. Internal addresses, localhost and redirects are refused.
Errors and limits
Errors come back with the right HTTP status and a body with the code and a readable message:
{ "error": "PLAN_LIMIT_REACHED", "message": "Your plan limit (5 envelopes per month) has already been used." }| Status | Meaning |
|---|---|
400 | Invalid data (VALIDATION_ERROR, MISSING_VARIABLES, INVALID_PDF…). |
401 | Missing or invalid key. |
402 | Plan limit reached (PLAN_LIMIT_REACHED) or feature not in the plan (PLAN_FEATURE). |
403 | The key is not allowed to do this, or the API is not enabled on the plan. |
404 | Envelope, template or folder not found. |
429 | Too many calls in a short time. Wait a moment and try again. |
5xx | An error on our side. Try again; if it persists, tell the team. |
Current limits: up to 60 envelopes created per minute per company, 10 signers per envelope and PDFs up to 10 MB. The monthly total of envelopes depends on the plan.
Public verification
Every signed document has a verification code (like VS-7RZ4-ZBEE), printed on the certificate. Anyone can check the document at https://assina.vetrysign.com.br/verify/CODE: the page checks the file by its hash, shows who signed and when, and needs no login.
Ready to integrate? Create a free account and ask us to enable the API.