Templates API
Manage reusable contract templates with variables.
https://apisign.io/apiA template is markdown content with {{variables}} plus optional field definitions that say what each variable is and who fills it in. Create contracts from it with template_id on /contract/create.
Create Template
Template Variables
Write variables as {{name}}. Names are matched case-insensitively.
When you create a contract, each variable is resolved to a field:
- If the template's field definitions contain an entry with that name, its
typeandcompletedByare used. - Otherwise the variable is signer-completed, and its type is guessed from its name. The name is split into words at
_,-,., spaces and camelCase boundaries, words are matched whole, and the first rule that matches wins:
| Name | Inferred type | Examples |
|---|---|---|
timestamp, or a signing word (sign, signed, signature, sig) next to date/time, or signed_at/signed_on | timestamp | sign_date, date_signed, signature_date, signed_at |
The word signature or sig (but not signature_requirements, signature_authority and similar) | signature | signature, tenant_signature, sig |
The word initials, or initial as the last word | initials | buyer_initials, initial_2 |
signer followed by name or full_name | signer_name | signer_name, tenant_signer_name |
The word email | email | client_email |
The word phone, mobile, tel or telephone | phone | client_phone |
The word date | date | start_date |
| Anything else | text | full_name, assignee_address, design_fee |
Because words are matched whole, {{assignee_address}} and {{consignor_email}} are not signatures. A plain {{full_name}} is a text box the signer types into; use {{signer_name}} for the signer's name filled in automatically.
Get Template
List Templates
Update Template
Archive Template
Upload Template
Field Definitions
Send field definitions to /template/update as an array. They are stored, and returned by /template/get, wrapped in an object: { "fields": [...] }.
{
"fields": [
{
"name": "company_name",
"type": "text",
"completedBy": "creator"
},
{
"name": "client_signature",
"type": "signature",
"completedBy": "signer"
},
{
"name": "effective_date",
"type": "date",
"completedBy": "creator"
}
]
}
Each definition has name (the variable name without braces), type, an optional completedBy (defaults to signer), and an optional label, the prompt shown for a text field.
Field Types
| Type | Description |
|---|---|
signature | Signature capture |
initials | Initials capture |
signer_name | Filled with the signer's name |
timestamp | Filled with the time of signing |
text | Plain text input |
email | Email input |
phone | Phone number input |
date | Date picker |
Completed By
| Value | Description |
|---|---|
creator | Filled from variables when creating the contract. Contract creation fails if any creator field has no value. |
signer | Filled by the signer during signing |