Documentation Index
Fetch the complete documentation index at: https://docs.artosai.com/llms.txt
Use this file to discover all available pages before exploring further.
Document Details API
The Document Details API manages document-specific section and rule details, including nested extraction rules generated during document production.
Update Document Details
Full replacement (PUT) of a document’s section and rule details. All existing sections are deleted and replaced.
PUT /api/v1/document-mrt/{mrt_id}
Path Parameters
| Parameter | Type | Required | Description |
|---|
mrt_id | string | Yes | UUID of the document details record |
Request Body
{
"docx_url": "org-id/output/output.docx",
"endpoint_analysis": "Analysis results",
"output_name": "CSR_Final.docx",
"connector_data_id": "connector-uuid",
"rule_type_to_table_like_status": {
"extraction": "table",
"summary": "text"
},
"sections": [
{
"order_index": 0,
"level": 1,
"section_id": "section-1",
"title": "Executive Summary",
"synopsis": "Overview",
"template_instructions": "Summarize findings",
"template_text": "Template content",
"additional_details": {
"custom_field": "custom_value"
},
"relevant_chunk_ids": ["chunk-1", "chunk-2"],
"relevant_chunk_names": ["Finding 1", "Finding 2"],
"rules": [
{
"confidence_score": 0.95,
"rule_type": "extraction",
"rule_mode": "auto",
"description": "Extract safety data",
"explanation": "Extracted from protocol",
"generated_content": "Generated summary text",
"rule_parameters": {
"include_tables": true
}
}
]
}
],
"auto_increment_regeneration": false
}
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
curl -X PUT "https://api.artosai.com/api/v1/document-mrt/mrt-uuid" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"sections": [
{
"order_index": 0,
"level": 1,
"section_id": "section-1",
"title": "Executive Summary",
"template_instructions": "Summarize",
"rules": [
{
"rule_type": "extraction",
"description": "Extract key findings",
"confidence_score": 0.92
}
]
}
]
}'
Python Example
import requests
url = "https://api.artosai.com/api/v1/document-mrt/mrt-uuid"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
}
payload = {
"sections": [
{
"order_index": 0,
"level": 1,
"section_id": "section-1",
"title": "Executive Summary",
"rules": [
{
"rule_type": "extraction",
"confidence_score": 0.92
}
]
}
],
"auto_increment_regeneration": True
}
response = requests.put(url, headers=headers, json=payload)
result = response.json()
print(f"Updated document details")
Response
{
"outline": {
"mrt_id": "mrt-uuid-123",
"document_id": "doc-uuid-456",
"docx_url": "org-uuid/output/CSR_Final.docx",
"endpoint_analysis": "Analysis completed successfully",
"output_name": "CSR_Final.docx",
"regeneration_count": 0,
"last_regenerated": null,
"connector_data_id": "project-2024-001",
"rule_type_to_table_like_status": {
"CopyPasteRule": true,
"SummaryRule": false
},
"sections": [
{
"mrt_section_id": "sect-uuid-1",
"mrt_id": "mrt-uuid-123",
"order_index": 0,
"level": 1,
"section_id": "1.0",
"title": "Executive Summary",
"synopsis": "High-level summary of study findings",
"template_instructions": "Summarize in 2-3 paragraphs",
"template_text": "This section provides...",
"additional_details": { "custom_key": "custom_value" },
"relevant_chunk_ids": ["chunk-uuid-1", "chunk-uuid-2"],
"relevant_chunk_names": ["Safety Finding 1", "Efficacy Result 2"],
"rules": [
{
"rule_id": "rule-uuid-1",
"mrt_section_id": "sect-uuid-1",
"rule_type": "CopyPasteRule",
"rule_mode": "auto",
"confidence_score": 0.95,
"description": "Extract safety findings",
"explanation": "Extracted from Protocol v2, section 3.1",
"generated_content": "The study demonstrated a favorable safety profile...",
"rule_parameters": { "include_tables": true }
}
]
}
]
}
}
Status Codes
- 200 OK: Document details updated successfully
- 400 Bad Request: Invalid structure
- 401 Unauthorized: Missing or invalid Bearer token
- 403 Forbidden: User not authorized
- 404 Not Found: Document details or parent document not found
- 422 Unprocessable Entity: Request validation error
- 500 Internal Server Error: Database error
Get Document Details by Document ID
Retrieve the document details for a specific document.
GET /api/v1/document-mrt/by-document/{document_id}
Path Parameters
| Parameter | Type | Required | Description |
|---|
document_id | string | Yes | UUID of parent document |
Request Example
curl -X GET "https://api.artosai.com/api/v1/document-mrt/by-document/document-uuid" \
-H "Authorization: Bearer YOUR_TOKEN"
Response
{
"outline": {
"mrt_id": "mrt-uuid-123",
"document_id": "doc-uuid-456",
"docx_url": "org-uuid/output/CSR_Final.docx",
"endpoint_analysis": "Analysis completed successfully",
"output_name": "CSR_Final.docx",
"regeneration_count": 2,
"last_regenerated": "2024-01-25T13:00:00Z",
"connector_data_id": "project-2024-001",
"rule_type_to_table_like_status": {
"CopyPasteRule": true
},
"sections": [
{
"mrt_section_id": "sect-uuid-1",
"mrt_id": "mrt-uuid-123",
"order_index": 0,
"level": 1,
"section_id": "1.0",
"title": "Executive Summary",
"synopsis": "High-level summary of study findings",
"template_instructions": "Summarize in 2-3 paragraphs",
"template_text": "This section provides...",
"additional_details": {},
"relevant_chunk_ids": ["chunk-uuid-1"],
"relevant_chunk_names": ["Safety Finding 1"],
"rules": [
{
"rule_id": "rule-uuid-1",
"mrt_section_id": "sect-uuid-1",
"rule_type": "CopyPasteRule",
"rule_mode": "auto",
"confidence_score": 0.95,
"description": "Extract safety findings",
"explanation": "Extracted from Protocol v2",
"generated_content": "The study demonstrated a favorable safety profile...",
"rule_parameters": {}
}
]
}
]
}
}
Status Codes
- 200 OK: Document details 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 details record 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
level parameter
- Rule Nesting: Each section can contain multiple nested rules
- Organization-Scoped: Returns only records belonging to the authenticated user’s organization
Typical Workflow
# 1. Get document
DOC=$(curl -X GET "https://api.artosai.com/api/v1/documents/document-uuid" \
-H "Authorization: Bearer $TOKEN")
# 2. Retrieve document details
DETAILS=$(curl -X GET "https://api.artosai.com/api/v1/document-mrt/by-document/document-uuid" \
-H "Authorization: Bearer $TOKEN")
# 3. Update document details with new sections
curl -X PUT "https://api.artosai.com/api/v1/document-mrt/mrt-uuid" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"sections": [...]
}'