Skip to main content

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 .doc or .docx
  • Maximum size: 5,000 KiB (about 4.9 MiB)
  • Template name: at least 4 characters

Endpointsโ€‹

MethodPathDescription
GET/api/templateList your templates.
GET/api/template/{id}Get a template and its file metadata.
GET/api/template/download/{id}Download a template file.
POST/api/templateCreate a template.
PUT/api/template/{id}Update a template.
DELETE/api/template/{id}Delete a template.
POST/api/template/process/validateValidate 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
}
FieldDescription
idPublic template ID used by management and processing endpoints.
nameTemplate display name.
tagsOptional tags stored with the template.
templateObjectTemplate structure extracted by the service, when available.

List templatesโ€‹

GET /api/template

Query parametersโ€‹

ParameterDefaultDescription
qEmptySearch text.
p1Page number, starting at 1.
s100Number of templates per page.
sorts[0].sortByNoneProperty to sort by, such as Name.
sorts[0].sortDirection00 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.

FieldRequiredDescription
nameYesUnique template name with at least 4 characters.
templateYesLowercase .doc or .docx file, no larger than 5,000 KiB.
tagsNoTags 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.

FieldRequiredDescription
nameYesTemplate name with at least 4 characters.
tagsNoReplacement tags.
templateNoReplacement .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.

FieldRequiredDescription
fileYesLowercase .doc or .docx template file.
dataYesJSON 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.