Skip to main content
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>"
}
'
{
  "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

prompt
string
required
Description of the document to generate.
format
string
default:"pdf"
Output format. One of: pdf, docx, pptx, xlsx, csv.

Request Examples

curl -X POST https://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"
  }'

Response

id
string
Unique document ID (prefixed doc_).
created
string
ISO 8601 timestamp.
format
string
The output format (e.g., "pdf").
title
string
Auto-generated document title.
download_url
string | null
Presigned URL to download the document file. May be null if file generation is still processing.
size_bytes
integer | null
File size in bytes.
content
string
Text content of the generated document.
usage
object

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

StatusCodeDescription
400missing_promptprompt is required
400invalid_formatUnsupported format. Supported: pdf, docx, pptx, xlsx, csv
401invalid_api_keyMissing or invalid API key
429rate_limit_exceededToo many requests