Templates API
Manage PDF templates — list, create, update, and delete template configurations.
List Templates
GET/api/templates
Returns all templates accessible to the authenticated user (owned + shared via organizations).
Response: 200 OK
[
{
"publicId": "tpl_01j5abc123",
"name": "Notice to End Tenancy (N4)",
"thumbPath": "file_123_thumb.jpg",
"columns": "tenant_name, address, amount",
"flags": "S",
"createdAt": "2026-01-15T10:30:00",
"updatedAt": "2026-03-20T14:25:00"
}
]
Get Template Metadata
GET/api/templates/metadata
Returns lightweight metadata for all accessible templates (useful for dropdowns and selectors).
Get Template by ID
GET/api/templates/{publicId}
Returns the full template configuration including field mappings JSON.
Response: 200 OK
{
"publicId": "tpl_01j5abc123",
"name": "Notice to End Tenancy (N4)",
"pdfPath": "file_123.pdf",
"thumbPath": "file_123_thumb.jpg",
"columns": "tenant_name, address, amount",
"json": "{\"TemplateTitle\":\"...\",\"FieldMappings\":{...}}",
"flags": "S",
"createdAt": "2026-01-15T10:30:00"
}
Create Template
POST/api/templates
Create a new template by uploading a PDF file and providing configuration.
Content-Type: multipart/form-data
| Field | Type | Required | Description |
|---|---|---|---|
file | File | ✅ | The PDF template file |
name | string | ✅ | Template name |
json | string | ❌ | Field mappings JSON (can be set later) |
columns | string | ❌ | Comma-separated column headers |
namingPattern | string | ❌ | Filename pattern for generated documents |
Response: 200 OK — Returns the created template object.
Update Template
PUT/api/templates/{publicId}
Update an existing template's configuration.
Content-Type: multipart/form-data
| Field | Type | Required | Description |
|---|---|---|---|
file | File | ❌ | New PDF file (replaces existing) |
name | string | ❌ | Updated name |
json | string | ❌ | Updated field mappings JSON |
columns | string | ❌ | Updated columns |
Delete Template
DELETE/api/templates/{publicId}
Permanently delete a template and its associated PDF file.
Response: 200 OK
Deletion is permanent. Any workflows referencing this template will fail on their next execution.
Stamp Template
POST/api/formstamper/stamp
Generate filled PDFs by stamping a template with data.
Content-Type: multipart/form-data
| Field | Type | Required | Description |
|---|---|---|---|
templateId | string | ✅ | Public ID of the template |
file | File | ✅ | Excel or CSV data file |
namingPattern | string | ❌ | Override the default naming pattern |
Response: 200 OK — Returns a ZIP file containing all stamped PDFs.
curl -X POST https://api.formstamper.com/api/formstamper/stamp \
-H "Authorization: Bearer eyJ..." \
-F "templateId=tpl_01j5abc123" \
-F "file=@tenants.xlsx" \
-o output.zip