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
fileFile✅The PDF template file
namestring✅Template name
jsonstring❌Field mappings JSON (can be set later)
columnsstring❌Comma-separated column headers
namingPatternstring❌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

FieldTypeRequiredDescription
fileFile❌New PDF file (replaces existing)
namestring❌Updated name
jsonstring❌Updated field mappings JSON
columnsstring❌Updated 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
templateIdstring✅Public ID of the template
fileFile✅Excel or CSV data file
namingPatternstring❌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