Document MRT API
The Document MRT API manages document-specific MRT (Machine-Readable Template) details including sections with nested extraction rules.Update Document MRT
Full replacement (PUT) of a Document MRT including sections and extraction rules. All existing sections are deleted and replaced.Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
mrt_id | string | Yes | UUID of Document MRT |
Request Body
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
sections | array | Yes | Sections with nested rules (at least one required) |
docx_url | string | No | S3 URL of DOCX file |
endpoint_analysis | string | No | Analysis text |
output_name | string | No | Output file name |
connector_data_id | string | No | Data connector ID |
rule_type_to_table_like_status | object | No | Rule type mappings |
auto_increment_regeneration | boolean | No | Auto-increment regeneration count |
Section Parameters
Each section must include:| Parameter | Type | Required | Description |
|---|---|---|---|
order_index | integer | Yes | Position in document |
level | integer | Yes | Nesting level |
section_id | string | No | Section identifier |
title | string | No | Section title |
synopsis | string | No | Brief summary |
template_instructions | string | No | Instructions |
template_text | string | No | Template text |
additional_details | object | No | JSONB metadata |
relevant_chunk_ids | array | No | Referenced chunk IDs |
relevant_chunk_names | array | No | Referenced chunk names |
rules | array | No | Nested extraction rules |
Rule Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
confidence_score | number | No | Confidence level (0-1) |
rule_type | string | No | Type of rule |
rule_mode | string | No | Rule operation mode |
description | string | No | Rule description |
explanation | string | No | Explanation of results |
generated_content | string | No | Generated content |
rule_parameters | object | No | Rule-specific parameters |
Request Example
Python Example
Response
Status Codes
- 200 OK: Document MRT updated successfully
- 400 Bad Request: Invalid MRT structure
- 401 Unauthorized: Missing or invalid Bearer token
- 403 Forbidden: User not authorized
- 404 Not Found: Document MRT or parent document not found
- 422 Unprocessable Entity: Request validation error
- 500 Internal Server Error: Database error
Get Document MRT by Document ID
Retrieve the Document MRT for a specific parent document.Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
document_id | string | Yes | UUID of parent document |
Request Example
Response
Status Codes
- 200 OK: Document MRT retrieved successfully
- 401 Unauthorized: Missing or invalid Bearer token
- 403 Forbidden: User not authorized (document belongs to different organization)
- 404 Not Found: Document not found or no MRT found for document
- 500 Internal Server Error: Database error
Features
- Auto-Sorted: Sections are automatically sorted by
order_index - Hierarchical: Supports multiple nesting levels via
levelparameter - Rule Nesting: Each section can contain multiple nested rules
- Organization-Scoped: Returns only MRTs belonging to authenticated user’s organization