A template is the foundation of every signing workflow in DocuTrust. It combines a source document (PDF, DOCX, or HTML) with a field schema that defines what data signers need to provide and where it appears on the document.Documentation Index
Fetch the complete documentation index at: https://docs.spitshake.io/llms.txt
Use this file to discover all available pages before exploring further.
Template object
Every template returned by the API includes these fields:| Field | Type | Description |
|---|---|---|
id | string | Public template identifier (for example, tpl_7VQhP2tM9xA1kR8bN). |
name | string | Human-readable template name. |
slug | string | URL-safe unique identifier for public links. |
external_id | string or null | Your custom identifier for mapping to external systems. |
folder_name | string | The folder this template is organized under in the dashboard. |
source | string | How the template was created: builder, api, import, or clone. |
shared | boolean | Whether the template is visible to all users in the account or only its creator. |
field_count | integer | Total number of fields defined in the schema. |
submitter_count | integer | Number of submitter roles defined. |
schema | array | The field schema (see Field schema below). |
submitters | array | The submitter roles (see Submitter roles below). |
thumbnail_url | string or null | URL to the first-page thumbnail image, or null if not yet generated. |
created_at | string | ISO 8601 creation timestamp. |
updated_at | string | ISO 8601 last-modified timestamp. |
Submitter roles
Every template defines one or more submitter roles. Each role represents a party who will sign or fill fields in the document. When creating a submission, you map real people to these roles.| Field | Type | Description |
|---|---|---|
uuid | string | Unique identifier for this submitter role within the template. Used to assign fields to roles. |
name | string | Human-readable role name (e.g., “Client”, “Witness”, “Notary”). Submitters in a submission must specify a role matching this name. |
Field schema
Theschema array defines every fillable field in the template. Each field specifies its type, position on the document, which submitter role it belongs to, and optional defaults or constraints.
Field properties
| Field | Type | Description |
|---|---|---|
uuid | string | Unique identifier for this field within the template. |
name | string | Human-readable field label shown to the signer. |
type | string | The field type. See Field types below. |
submitter_uuid | string | UUID of the submitter role responsible for filling this field. |
required | boolean | Whether the signer must fill this field before completing the form. |
readonly | boolean | Whether the field is pre-filled and cannot be changed by the signer. |
key | string | Machine-readable key for pre-filling and reading values via the API. Must be unique within the template. |
default_value | string or null | The default value shown when the signer opens the form. For date fields, use "today" to auto-fill the current date. |
placeholder | string or null | Placeholder text shown when the field is empty. |
options | array or null | Available choices for select and radio field types. Null for all other types. |
areas | array | Positions where this field renders on the document. See Field areas. |
Field areas
Each field has one or more areas defining its visual position on the document pages.| Property | Type | Description |
|---|---|---|
page | integer | Zero-indexed page number (0 = first page). |
x | float | Horizontal position as a fraction of page width (0.0 = left edge, 1.0 = right edge). |
y | float | Vertical position as a fraction of page height (0.0 = top edge, 1.0 = bottom edge). |
w | float | Width as a fraction of page width. |
h | float | Height as a fraction of page height. |
attachment_uuid | string | UUID of the document attachment this area belongs to (for multi-document templates). |
Field types
DocuTrust supports 19 field types:| Type | Description | options used | Notes |
|---|---|---|---|
text | Single-line text input | No | General-purpose text entry. |
signature | Signature capture | No | Accepts drawn, typed, or uploaded signatures. |
initials | Initials capture | No | Smaller version of signature for initialing pages. |
date | Date picker | No | Use default_value: "today" for auto-fill. |
checkbox | Single checkbox | No | Boolean true/false. |
select | Dropdown select | Yes | Signer picks one option from the options array. |
radio | Radio button group | Yes | Signer picks one option from the options array. |
file | File upload | No | Signer uploads a file (e.g., ID scan, supporting document). |
image | Image capture/upload | No | Signer uploads or captures an image (e.g., photo ID). |
stamp | Stamp/seal placement | No | Signer places a stamp image (e.g., corporate seal). |
payment | Payment collection | No | Collects payment via integrated payment processor. |
phone_verification | SMS phone verification | No | Signer enters phone number, receives SMS OTP, and verifies. |
cells | Multi-cell text grid | No | Fixed-width cells for structured data (e.g., SSN, account numbers). |
number | Numeric input | No | Accepts only numeric values. |
multi_select | Multiple choice select | Yes | Signer picks one or more options from the options array. |
heading | Section heading | No | Display-only heading text (not fillable). |
paragraph | Paragraph text | No | Display-only paragraph text (not fillable). |
label | Field label | No | Display-only label (not fillable). |
html | Custom HTML content | No | Renders custom HTML on the signing form (not fillable). |
date_now | Current date (auto) | No | Auto-populates with the current date when the signer opens the form. Read-only — the signer cannot change the value. |
Field validation
Add validation rules to text fields to enforce specific input formats. Validation is checked when the signer submits their form — invalid values display an error message and prevent completion until corrected. There are two ways to add validation to a field:- Preset validation — Use the
validationproperty with a preset name for common patterns (SSN, email, phone, etc.). - Custom regex — Use the
patternproperty with any regular expression string for custom formats.
Example: field with preset validation
Example: field with custom regex pattern
Validation presets
DocuTrust includes 11 built-in validation presets. Use thevalidation property on a text field to apply one:
| Preset | Pattern | Description |
|---|---|---|
ssn | ^\d{3}-\d{2}-\d{4}$ | US Social Security Number (format: 123-45-6789). |
ein | ^\d{2}-\d{7}$ | US Employer Identification Number (format: 12-3456789). |
email | ^[^\s@]+@[^\s@]+\.[^\s@]+$ | Email address. |
url | ^https?://[^\s]+$ | URL starting with http:// or https://. |
zip | ^\d{5}(-\d{4})?$ | US ZIP code, 5 digits or ZIP+4 (format: 12345 or 12345-6789). |
zip_us | ^\d{5}$ | US ZIP code, 5 digits only (format: 12345). |
numeric | ^\d+$ | Digits only (no decimals, no separators). |
alpha | ^[a-zA-Z]+$ | Letters only (no spaces, numbers, or special characters). |
alphanumeric | ^[a-zA-Z0-9]+$ | Letters and digits only (no spaces or special characters). |
phone_us | ^\(?[2-9]\d{2}\)?[-.\s]?\d{3}[-.\s]?\d{4}$ | US phone number (formats: (555) 123-4567, 555-123-4567, 5551234567). |
phone_intl | ^\+[1-9]\d{6,14}$ | International phone number in E.164 format (format: +15551234567). |
When both
validation and pattern are set on a field, the pattern regex takes precedence. The validation preset is ignored in that case.Creating templates
From PDF
Upload one or more PDF files to create a template. DocuTrust extracts pages and creates a blank field schema that you can populate later.From DOCX
Upload a Word document. DocuTrust converts it to PDF internally while preserving layout and formatting.From HTML
Send raw HTML to create a template. This is useful for programmatically generating documents with dynamic layouts.Retrieving templates
Get a single template
List all templates
Filter by folder
Filter by external ID
Updating templates
Update a template’s name, schema, submitters, folder, or sharing settings with a PUT request.Fixing auto-mapping safely (API)
If AI smart setup assigned fields to the wrong submitter, use these endpoints instead of replacing the full schema:POST /api/templates/{id}/validate_assignments— dry-run validatorPOST /api/templates/{id}/remap_submitters— apply targeted remaps
1) Validate proposed remap
2) Preview remap (dry_run)
3) Apply remap
Validation checks returned by API
The validator returns structured issues such as:unknown_field_uuidunknown_submitter_uuidduplicate_field_assignmentsubmitter_without_fieldsrequired_submitter_missing_signature
Cloning templates
Create an independent copy of an existing template. The clone gets a new ID and slug but inherits the schema, submitters, and documents.The cloned template gets new submitter UUIDs. If you have code that references the original UUIDs, update it to use the new ones.
Merging templates
Combine two or more templates into a single document. This is useful for assembling contracts from modular sections (e.g., terms + addendum + signature page).AI field detection
DocuTrust can automatically analyze a template’s document and detect where fields should be placed. This is especially useful for complex PDFs with many signature lines, date fields, and text blanks.| Endpoint | Description |
|---|---|
POST /api/templates/{id}/ai/analyze | Analyze document structure without modifying the template. |
POST /api/templates/{id}/ai/smart_setup | Full auto-setup: detect fields, assign roles, and set keys. |
POST /api/templates/{id}/ai/assign_keys | Auto-assign machine-readable keys to existing fields. |
GET /api/templates/{id}/ai/status | Check the status of a running AI analysis job. |
Managing documents
Replace or add documents
Upload new documents to an existing template:Download a document PDF
Retrieve the original uploaded document:Thumbnails
Get a thumbnail image of the first page:Archiving templates
Archive a template to remove it from active use. Archived templates are not deleted — existing submissions remain intact — but no new submissions can be created from them.This uses the HTTP DELETE method but performs a soft archive, not a permanent deletion. The template can still be retrieved via the API using its ID.
Formula fields
Formula fields compute their value dynamically from other fields using arithmetic expressions. Use them for calculated totals, taxes, discounts, and other derived values.Formula syntax
Add aformula property to any number field in the template schema. The formula can reference other fields by name using {Field Name} syntax and supports standard arithmetic operators.
Supported operators
| Operator | Description | Example |
|---|---|---|
+ | Addition | {Price} + {Shipping} |
- | Subtraction | {Total} - {Discount} |
* | Multiplication | {Quantity} * {Unit Price} |
/ | Division | {Total} / {Installments} |
() | Grouping | ({Subtotal} + {Tax}) * {Discount Rate} |
Full example: invoice with tax
Formula evaluation uses safe arithmetic parsing — no arbitrary code execution. Only numeric values, field references, arithmetic operators, and parentheses are allowed. Division by zero returns
0.Dynamic payment pricing
Combine formula fields with thepayment field type to compute dynamic payment amounts based on signer input:
Conditional document display
Control which documents in a multi-document template are shown to the signer based on field values. Use thedocument_conditions property in the template preferences to define conditions.
Configuration
Setdocument_conditions in the template preferences via PUT /api/templates/:id:
Condition properties
| Property | Type | Description |
|---|---|---|
document_id | integer | The ID of the document attachment to conditionally show or hide. |
field_uuid | string | UUID of the field whose value is evaluated. |
operator | string | Comparison operator: "equals", "not_equals", "contains", "not_contains", "is_empty", "is_not_empty". |
value | string | The value to compare against. Not required for is_empty and is_not_empty operators. |
Full example
A template with three documents — a base agreement, a premium addendum, and an enterprise addendum — where the addenda are shown conditionally based on the plan selection:Payment Method field (or any select/radio field referenced by field_uuid), document 43 (the premium addendum) is displayed. When they select “Enterprise”, document 44 is shown instead. The base agreement document (without a condition) is always shown.
Conditions are evaluated in real time as the signer fills in fields. Documents appear or disappear dynamically without page reload.