Skip to main content

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

FieldTypeRequiredDescription
fileFileThe PDF template file
namestringTemplate name
jsonstringField mappings JSON (can be set later)
columnsstringComma-separated column headers
namingPatternstringFilename 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

FieldTypeRequiredDescription
fileFileNew PDF file (replaces existing)
namestringUpdated name
jsonstringUpdated field mappings JSON
columnsstringUpdated columns

Delete Template

DELETE /api/templates/{publicId}

Permanently delete a template and its associated PDF file.

Response: 200 OK

warning

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

FieldTypeRequiredDescription
templateIdstringPublic ID of the template
fileFileExcel or CSV data file
namingPatternstringOverride 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