curl --request POST \
--url https://api.artosai.com/api/v1/documents/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"document_type": "CSR",
"file_paths": [
"org-id/documents/protocol.pdf",
"org-id/documents/study-report.pdf"
],
"connector_data_id": "project-2024-001",
"workspace_name": "Q1 CSR Documents",
"template_id": "template-uuid-123",
"output_name": "CSR_Final"
}
'import requests
url = "https://api.artosai.com/api/v1/documents/generate"
payload = {
"document_type": "CSR",
"file_paths": ["org-id/documents/protocol.pdf", "org-id/documents/study-report.pdf"],
"connector_data_id": "project-2024-001",
"workspace_name": "Q1 CSR Documents",
"template_id": "template-uuid-123",
"output_name": "CSR_Final"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
document_type: 'CSR',
file_paths: ['org-id/documents/protocol.pdf', 'org-id/documents/study-report.pdf'],
connector_data_id: 'project-2024-001',
workspace_name: 'Q1 CSR Documents',
template_id: 'template-uuid-123',
output_name: 'CSR_Final'
})
};
fetch('https://api.artosai.com/api/v1/documents/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.artosai.com/api/v1/documents/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'document_type' => 'CSR',
'file_paths' => [
'org-id/documents/protocol.pdf',
'org-id/documents/study-report.pdf'
],
'connector_data_id' => 'project-2024-001',
'workspace_name' => 'Q1 CSR Documents',
'template_id' => 'template-uuid-123',
'output_name' => 'CSR_Final'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.artosai.com/api/v1/documents/generate"
payload := strings.NewReader("{\n \"document_type\": \"CSR\",\n \"file_paths\": [\n \"org-id/documents/protocol.pdf\",\n \"org-id/documents/study-report.pdf\"\n ],\n \"connector_data_id\": \"project-2024-001\",\n \"workspace_name\": \"Q1 CSR Documents\",\n \"template_id\": \"template-uuid-123\",\n \"output_name\": \"CSR_Final\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.artosai.com/api/v1/documents/generate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"document_type\": \"CSR\",\n \"file_paths\": [\n \"org-id/documents/protocol.pdf\",\n \"org-id/documents/study-report.pdf\"\n ],\n \"connector_data_id\": \"project-2024-001\",\n \"workspace_name\": \"Q1 CSR Documents\",\n \"template_id\": \"template-uuid-123\",\n \"output_name\": \"CSR_Final\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.artosai.com/api/v1/documents/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"document_type\": \"CSR\",\n \"file_paths\": [\n \"org-id/documents/protocol.pdf\",\n \"org-id/documents/study-report.pdf\"\n ],\n \"connector_data_id\": \"project-2024-001\",\n \"workspace_name\": \"Q1 CSR Documents\",\n \"template_id\": \"template-uuid-123\",\n \"output_name\": \"CSR_Final\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Request to generate document has been accepted and is being processed in the background.",
"task_id": "document-uuid-456"
}Generate Document
Extract content from source documents, ingest, and orchestrate document generation using a template. Request is immediately queued as a background task and returns 202 Accepted. Poll /api/v1/documents/status/{document_id} for progress.
Field aliases (both forms accepted):
connector_data_id=document_set_keytemplate_id=generic_mrt_idworkspace_name=document_set_name
curl --request POST \
--url https://api.artosai.com/api/v1/documents/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"document_type": "CSR",
"file_paths": [
"org-id/documents/protocol.pdf",
"org-id/documents/study-report.pdf"
],
"connector_data_id": "project-2024-001",
"workspace_name": "Q1 CSR Documents",
"template_id": "template-uuid-123",
"output_name": "CSR_Final"
}
'import requests
url = "https://api.artosai.com/api/v1/documents/generate"
payload = {
"document_type": "CSR",
"file_paths": ["org-id/documents/protocol.pdf", "org-id/documents/study-report.pdf"],
"connector_data_id": "project-2024-001",
"workspace_name": "Q1 CSR Documents",
"template_id": "template-uuid-123",
"output_name": "CSR_Final"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
document_type: 'CSR',
file_paths: ['org-id/documents/protocol.pdf', 'org-id/documents/study-report.pdf'],
connector_data_id: 'project-2024-001',
workspace_name: 'Q1 CSR Documents',
template_id: 'template-uuid-123',
output_name: 'CSR_Final'
})
};
fetch('https://api.artosai.com/api/v1/documents/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.artosai.com/api/v1/documents/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'document_type' => 'CSR',
'file_paths' => [
'org-id/documents/protocol.pdf',
'org-id/documents/study-report.pdf'
],
'connector_data_id' => 'project-2024-001',
'workspace_name' => 'Q1 CSR Documents',
'template_id' => 'template-uuid-123',
'output_name' => 'CSR_Final'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.artosai.com/api/v1/documents/generate"
payload := strings.NewReader("{\n \"document_type\": \"CSR\",\n \"file_paths\": [\n \"org-id/documents/protocol.pdf\",\n \"org-id/documents/study-report.pdf\"\n ],\n \"connector_data_id\": \"project-2024-001\",\n \"workspace_name\": \"Q1 CSR Documents\",\n \"template_id\": \"template-uuid-123\",\n \"output_name\": \"CSR_Final\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.artosai.com/api/v1/documents/generate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"document_type\": \"CSR\",\n \"file_paths\": [\n \"org-id/documents/protocol.pdf\",\n \"org-id/documents/study-report.pdf\"\n ],\n \"connector_data_id\": \"project-2024-001\",\n \"workspace_name\": \"Q1 CSR Documents\",\n \"template_id\": \"template-uuid-123\",\n \"output_name\": \"CSR_Final\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.artosai.com/api/v1/documents/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"document_type\": \"CSR\",\n \"file_paths\": [\n \"org-id/documents/protocol.pdf\",\n \"org-id/documents/study-report.pdf\"\n ],\n \"connector_data_id\": \"project-2024-001\",\n \"workspace_name\": \"Q1 CSR Documents\",\n \"template_id\": \"template-uuid-123\",\n \"output_name\": \"CSR_Final\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Request to generate document has been accepted and is being processed in the background.",
"task_id": "document-uuid-456"
}Authorizations
Okta access-token JWT sent as a Bearer token. The token identifies the user and scopes access to the user's organization.
Body
Field aliases: connector_data_id = document_set_key, template_id = generic_mrt_id, workspace_name = document_set_name. Both the alias and field name are accepted.
Type of document to generate (e.g., CSR, Protocol)
S3 object keys for source documents (e.g., org-id/documents/protocol.pdf)
Unique key for document set (field name: document_set_key)
Human-readable name for the document set (field name: document_set_name)
ID of the template to use (field name: generic_mrt_id)
Name for the generated output file (without .docx extension)
Specific section IDs to include (optional)
Full outline structure (optional)
Document-level instructions (optional)
Style guide ID from the style_guides table (optional)