Templates API
The Templates API manages Machine Readable Templates (MRTs) with nested sections and content extraction rules. Templates define the structure and content requirements for generated documents.List Templates
Retrieve all MRT templates accessible to the authenticated user.Request Example
Response
Status Codes
- 200 OK: Templates retrieved successfully
- 401 Unauthorized: Missing or invalid Bearer token
Get Single Template
Retrieve a specific MRT template with full details.Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
template_id | string | Yes | UUID of template |
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 MRT template with nested sections and extraction rules.Request Body
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
template_name | string | Yes | Template name |
document_type | string | Yes | Document type (e.g., CSR, IND, Protocol) |
sections | array | Yes | At least one section required |
template_s3_uri | string | No | S3 URI for template file |
template_file_name | string | No | Template file name |
document_description | string | No | Description |
tags | array | No | Categorization tags |
users | array | No | User IDs with access |
Section Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
order_index | integer | Yes | Position in template (0-based) |
level | integer | Yes | Nesting level (1=top-level) |
section_name | string | Yes | Section title |
synopsis | string | No | Brief summary |
template_instructions | string | No | Completion instructions |
template_text | string | No | Template text |
section_type | string | No | Section type |
section_mode | string | No | Operation mode |
is_repeating | boolean | No | Default: false |
expansion_type | string | No | For repeating sections |
rules | array | No | Extraction rules |
Request Example
Python Example
Response (201 Created)
Status Codes
- 201 Created: Template created successfully
- 400 Bad Request: Validation errors (missing fields, duplicate indices)
- 401 Unauthorized: Authentication failures
- 500 Internal Server Error: Database operation failures
Delete Template Section
Delete a section from an MRT template.Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
template_id | string | Yes | UUID of template |
section_id | string | Yes | UUID of section to delete |
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
cascade_children | boolean | No | true | Delete child sections |
Request Example
Response
Status Codes
- 200 OK: Section deleted successfully
- 400 Bad Request: Invalid parameters
- 403 Forbidden: Not authorized
- 404 Not Found: Template or section not found