Templates API
The Templates API manages templates with nested sections and content extraction rules. Templates define the structure and content requirements for generated documents.List Templates
Retrieve all templates accessible to the authenticated user, sorted by creation date (newest first).Request Example
Response
Status Codes
- 200 OK: Templates retrieved successfully
- 401 Unauthorized: Missing or invalid Bearer token
Get Single Template
Retrieve a specific template with full details including sections, rules, users, and style information.Path Parameters
Request Example
Response
Status Codes
- 200 OK: Template retrieved successfully
- 400 Bad Request: Authentication failure
- 404 Not Found: Template not found
Create Template
Create a new template with nested sections and extraction rules.Request Body
Request Parameters
* Either
template_s3_uri or template_file_name must be provided.
Section Parameters
Request Example
Python Example
Response (201 Created)
Response Fields
Status Codes
- 201 Created: Template created successfully
- 400 Bad Request: Validation errors (missing fields, duplicate
order_index, missingtemplate_s3_uri/template_file_name) - 401 Unauthorized: Authentication failure
- 500 Internal Server Error: Database operation failure
Add Section to Template
Add a new section to an existing template.Path Parameters
Request Body
Request Parameters
Request Example
Response
Status Codes
- 200 OK: Section added successfully
- 400 Bad Request: Authentication errors
- 403 Forbidden: Unauthorized access
- 404 Not Found: Template not found
- 500 Internal Server Error: Database operation failure
Rename Template Section
Update the name of an existing template section.Path Parameters
Request Body
Request Parameters
Request Example
Response
Status Codes
- 200 OK: Section renamed successfully
- 400 Bad Request: Authentication errors
- 403 Forbidden: Unauthorized access
- 404 Not Found: Template or section not found
- 500 Internal Server Error: Database operation failure
Reorder Template Sections
Reorder and automatically renumber all sections in a template. After reordering, section names are renumbered to reflect the new hierarchy (e.g.,"1.", "1.1", "2.").
Path Parameters
Request Body
Request Parameters
Request Example
Response
Status Codes
- 200 OK: Sections reordered successfully
- 400 Bad Request: Authentication errors
- 403 Forbidden: Unauthorized access
- 404 Not Found: Template not found
- 500 Internal Server Error: Database operation failure
Update Rule Styles
Update the style names, fill color, and/or text color for a specific rule within a template section.Path Parameters
Request Body
Request Parameters
Request Example
Response
Status Codes
- 200 OK: Rule styles updated successfully
- 400 Bad Request: Authentication errors
- 403 Forbidden: Unauthorized access
- 404 Not Found: Template or rule not found
- 500 Internal Server Error: Database operation failure
Delete Template Section
Delete a section from an template. Associated rules are automatically deleted via CASCADE.Path Parameters
Query Parameters
Request Example
Response
Response Fields
Status Codes
- 200 OK: Section deleted successfully
- 400 Bad Request: Invalid parameters
- 403 Forbidden: Not authorized
- 404 Not Found: Template or section not found