Template management
Use the Template Management API to manage the DOCX templates available to your account. After you upload a template, use its id with the Template Processing API to generate PDFs.
Before you beginโ
All requests use the following base URL:
https://api.pritset.com/api/template
Configure your authentication headers before calling an endpoint:
Authorization: YOUR_ACCESS_TOKEN
X-Secret: YOUR_SECRET
Template files must meet these requirements:
- File extension: lowercase
.docor.docx - Maximum size: 5,000 KiB (about 4.9 MiB)
- Template name: at least 4 characters
Endpointsโ
| Method | Path | Description |
|---|---|---|
GET | /api/template | List your templates. |
GET | /api/template/{id} | Get a template and its file metadata. |
GET | /api/template/download/{id} | Download a template file. |
POST | /api/template | Create a template. |
PUT | /api/template/{id} | Update a template. |
DELETE | /api/template/{id} | Delete a template. |
POST | /api/template/process/validate | Validate a template against sample JSON data. |
Template objectโ
Template metadata is returned as a JSON object:
{
"id": "a1b2c3d4e5f6",
"name": "Monthly invoice",
"tags": "invoice,monthly",
"templateObject": null
}
| Field | Description |
|---|---|
id | Public template ID used by management and processing endpoints. |
name | Template display name. |
tags | Optional tags stored with the template. |
templateObject | Template structure extracted by the service, when available. |
List templatesโ
GET /api/template
Query parametersโ
| Parameter | Default | Description |
|---|---|---|
q | Empty | Search text. |
p | 1 | Page number, starting at 1. |
s | 100 | Number of templates per page. |
sorts[0].sortBy | None | Property to sort by, such as Name. |
sorts[0].sortDirection | 0 | 0 for ascending or 1 for descending. |
curl --get "https://api.pritset.com/api/template" \
--header "Authorization: YOUR_ACCESS_TOKEN" \
--header "X-Secret: YOUR_SECRET" \
--data-urlencode "p=1" \
--data-urlencode "s=20"
The response contains the current page in data and the number of matching templates in total:
{
"data": [
{
"id": "a1b2c3d4e5f6",
"name": "Monthly invoice",
"tags": "invoice,monthly",
"templateObject": null
}
],
"total": 1
}
Get a templateโ
GET /api/template/{id}
curl "https://api.pritset.com/api/template/a1b2c3d4e5f6" \
--header "Authorization: YOUR_ACCESS_TOKEN" \
--header "X-Secret: YOUR_SECRET"
The response combines template metadata with information about the stored file:
{
"template": {
"id": "a1b2c3d4e5f6",
"name": "Monthly invoice",
"tags": "invoice,monthly",
"templateObject": null
},
"fileInfo": {
"contentType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"lastModified": "2026-07-15T09:30:00Z",
"objectName": "stored-template.docx",
"size": 24576
}
}
Download a templateโ
GET /api/template/download/{id}
The response body contains the original template file.
curl "https://api.pritset.com/api/template/download/a1b2c3d4e5f6" \
--header "Authorization: YOUR_ACCESS_TOKEN" \
--header "X-Secret: YOUR_SECRET" \
--output template.docx
Create a templateโ
POST /api/template
Send the request as multipart/form-data.
| Field | Required | Description |
|---|---|---|
name | Yes | Unique template name with at least 4 characters. |
template | Yes | Lowercase .doc or .docx file, no larger than 5,000 KiB. |
tags | No | Tags to store with the template. |
curl --request POST "https://api.pritset.com/api/template" \
--header "Authorization: YOUR_ACCESS_TOKEN" \
--header "X-Secret: YOUR_SECRET" \
--form "name=Monthly invoice" \
--form "tags=invoice,monthly" \
--form "template=@./invoice.docx"
A successful request returns the created template object.
Update a templateโ
PUT /api/template/{id}
Send the request as multipart/form-data. The name field is required even if you only want to change the tags or replace the file.
| Field | Required | Description |
|---|---|---|
name | Yes | Template name with at least 4 characters. |
tags | No | Replacement tags. |
template | No | Replacement .doc or .docx file. Omit it to keep the current file. |
curl --request PUT "https://api.pritset.com/api/template/a1b2c3d4e5f6" \
--header "Authorization: YOUR_ACCESS_TOKEN" \
--header "X-Secret: YOUR_SECRET" \
--form "name=Monthly invoice 2026" \
--form "tags=invoice,monthly,2026" \
--form "template=@./invoice-2026.docx"
A successful request returns the updated template object.
Delete a templateโ
DELETE /api/template/{id}
Deleting a template permanently removes its metadata and stored file.
curl --request DELETE "https://api.pritset.com/api/template/a1b2c3d4e5f6" \
--header "Authorization: YOUR_ACCESS_TOKEN" \
--header "X-Secret: YOUR_SECRET"
A successful request returns an empty response.
Validate a templateโ
POST /api/template/process/validate
Use this endpoint to check a template file against representative JSON before creating or updating a stored template.
| Field | Required | Description |
|---|---|---|
file | Yes | Lowercase .doc or .docx template file. |
data | Yes | JSON data to test against the template. |
curl --request POST "https://api.pritset.com/api/template/process/validate" \
--header "Authorization: YOUR_ACCESS_TOKEN" \
--header "X-Secret: YOUR_SECRET" \
--form "file=@./invoice.docx" \
--form 'data={"invoiceNumber":"INV-1024","total":"200.00"}'
The response is true when the template is valid. If validation fails, the API returns a validation error with details from the template engine.
Next stepโ
After creating a template, copy its id and use the Template Processing API to generate a PDF.