Create and inspect templates
A file upload stores a file; template creation turns a compatible file into a reusable template. This is separate from POST /api/v1/generate, which renders an existing template.
For a DOCX template:
- Upload the DOCX using
/api/v1/files/uploadand keep its returnedpublic_id. - Create the template:
curl --fail-with-body --request POST \
"$INKIT_BASE_URL/api/v1/documents/templates/create" \
--header "X-Inkit-API-Token: $INKIT_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"source": "docx",
"name": "Example template",
"file_public_id": "file_REPLACEWITHYOURUPLOADID",
"data": {"file_name": "example.docx"}
}'Alternatively, send a multipart file directly to the template creation endpoint. Supply exactly one of file and file_public_id. In multipart requests, encode data as a JSON string.
The accepted template sources are pdf, docx, html, and pptx. Source-specific data requirements are:
| Source | Required data fields |
|---|---|
| DOCX / PPTX | file_name |
| HTML | file_name, positive width and height, and unit |
file_name and merge_params (an array; use an empty array when no merge blocks are needed) |
PDF merge blocks require a name, coordinates, page number, font size, and RGB text color. Signature blocks and participant configuration have additional source-specific validation and account feature requirements. Start with an existing configured template when integrating digital signatures.
List templates with GET /api/v1/documents/templates. Retrieve the latest version through /{public_id}/retrieve, or a specific version through /{public_id}/{version}/retrieve. Set exclude_file=true to omit encoded file content. Public API authentication cannot retrieve internal templates.
GET /api/v1/documents/templates/merge-variables?ids=tmpl_REPLACE accepts one to five comma-separated template IDs and returns items plus has_unsupported_ui_merge_vars. Conflicting variable definitions can return 409.
Duplicate a template with POST /api/v1/documents/templates/{public_id}/duplicate and {"name":"Copy name"}. Delete through DELETE /api/v1/documents/templates/{public_id}/delete. Template permissions, account limits, and existing usage apply.
Updated 10 days ago