Media Generation
Generate Document
Generate PDF, DOCX, PPTX, XLSX, or CSV documents from natural language.
POST
/
api
/
v1
/
documents
Generate Document
curl --request POST \
--url https://api.example.com/api/v1/documents \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"format": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/documents"
payload = {
"prompt": "<string>",
"format": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({prompt: '<string>', format: '<string>'})
};
fetch('https://api.example.com/api/v1/documents', 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.example.com/api/v1/documents",
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([
'prompt' => '<string>',
'format' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/api/v1/documents"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"format\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/api/v1/documents")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"format\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/documents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"format\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"created": "<string>",
"format": "<string>",
"title": "<string>",
"download_url": {},
"size_bytes": {},
"content": "<string>",
"usage": {
"cost_cents": 123
}
}Generate structured documents from a natural language prompt. Supports PDF, DOCX, PPTX, XLSX, and CSV formats.
Authentication
Requires a Bearer token. See Authentication.Request Body
Description of the document to generate.
Output format. One of:
pdf, docx, pptx, xlsx, csv.Request Examples
curl -X POST https://www.hitheo.ai/api/v1/documents \
-H "Authorization: Bearer $THEO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Create a Q1 2026 sales report with executive summary and charts",
"format": "pdf"
}'
const res = await theo.documents({
prompt: "Create a Q1 2026 sales report with executive summary and charts",
format: "pdf",
});
console.log(res.title); // "Q1 2026 Sales Report"
console.log(res.download_url); // Presigned download URL
console.log(res.content); // Document text content
Response
Unique document ID (prefixed
doc_).ISO 8601 timestamp.
The output format (e.g.,
"pdf").Auto-generated document title.
Presigned URL to download the document file. May be
null if file generation is still processing.File size in bytes.
Text content of the generated document.
Example Response
{
"id": "doc_abc123",
"created": "2026-04-10T12:00:00Z",
"format": "pdf",
"title": "Q1 2026 Sales Report",
"download_url": "https://artifacts.hitheo.ai/docs/abc123.pdf?token=...",
"size_bytes": 245760,
"content": "# Q1 2026 Sales Report\n\n## Executive Summary\n...",
"usage": { "cost_cents": 0.12 }
}
Errors
| Status | Code | Description |
|---|---|---|
| 400 | missing_prompt | prompt is required |
| 400 | invalid_format | Unsupported format. Supported: pdf, docx, pptx, xlsx, csv |
| 401 | invalid_api_key | Missing or invalid API key |
| 429 | rate_limit_exceeded | Too many requests |
Was this page helpful?
⌘I
Generate Document
curl --request POST \
--url https://api.example.com/api/v1/documents \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"format": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/documents"
payload = {
"prompt": "<string>",
"format": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({prompt: '<string>', format: '<string>'})
};
fetch('https://api.example.com/api/v1/documents', 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.example.com/api/v1/documents",
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([
'prompt' => '<string>',
'format' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/api/v1/documents"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"format\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/api/v1/documents")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"format\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/documents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"format\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"created": "<string>",
"format": "<string>",
"title": "<string>",
"download_url": {},
"size_bytes": {},
"content": "<string>",
"usage": {
"cost_cents": 123
}
}