Skip to main content

Endpoint

POST /generate/dataset
Complete pipeline that generates a document from JSON, renders it to PDF/PNG, and then generates photo variations.

Request Body

header
object
required
Document header fields (same schema as POST /generate/document).
items
array
required
List of line items (same schema as POST /generate/document).
observations
string
default:""
Handwritten notes
template
string
default:"guia_despacho.html"
Template file name
presets
string[]
Photo preset names. If omitted, generates all 8 presets.
doc_description
string
default:""
Key fields to preserve in photos. Auto-generated from doc_number if empty.

Response

run_id
string
Unique identifier for this generation run
document
object
Generated document files.
photos
array
Array of photo generation results.

Example

curl -X POST http://localhost:8000/generate/dataset \
  -H "Content-Type: application/json" \
  -d '{
    "header": {
      "doc_number": "00054321",
      "date": "15/04/2026",
      "emitter_name": "ACME FOODS S.A.",
      "receiver_name": "DISTRIBUIDORA CENTRAL LTDA."
    },
    "items": [
      {"description": "HARINA DE TRIGO 25KG", "qty": 40, "unit": "UN", "unit_price": 12500, "total": 500000}
    ],
    "presets": ["full_picture", "blurry"]
  }'
Response
{
  "run_id": "c3d4e5f6g7",
  "document": {
    "html": "output/c3d4e5f6g7/guia_despacho_00054321.html",
    "png": "output/c3d4e5f6g7/guia_despacho_00054321.png",
    "pdf": "output/c3d4e5f6g7/guia_despacho_00054321.pdf"
  },
  "photos": [
    {"name": "full_picture", "path": "output/c3d4e5f6g7/photos/photo_full_picture.png", "ok": true},
    {"name": "blurry", "path": "output/c3d4e5f6g7/photos/photo_blurry.png", "ok": true}
  ]
}