Endpoint
POST /generate/from-upload
Upload an existing document (PDF or image), detect its schema using vision AI, and generate verified photo variations.
Request
This endpoint uses multipart/form-data.
PDF or image file (PNG, JPG) to upload.
presets
string
default:"full_picture,folded_skewed,blurry"
Comma-separated list of preset names.
Response
Unique identifier for this generation run
Schema detected from the uploaded document.
Detected type: dispatch_guide, invoice, purchase_order, bill_of_lading, credit_note, other
Detected totals (subtotal, tax, total)
Detection confidence (0.0 - 1.0)
Flattened field_name -> value dict used for verification.
Array of verified photo results.
Whether all visible fields match
Number of generation attempts
Per-field verification results
Occlusion reasons per field
Example
curl -X POST http://localhost:8000/generate/from-upload \
-F "file=@/path/to/invoice.pdf" \
-F "presets=full_picture,blurry"
{
"run_id": "h8i9j0k1l2",
"detected_schema": {
"document_type": "dispatch_guide",
"header": {
"doc_number": "00098765",
"emitter_name": "ACME FOODS S.A."
},
"items": [
{"pos": 1, "description": "HARINA DE TRIGO", "qty": 40, "unit": "UN"}
],
"totals": {"subtotal": 500000, "tax": 95000, "total": 595000},
"confidence": 0.93
},
"ground_truth": {
"doc_number": "00098765",
"emitter_name": "ACME FOODS S.A.",
"item_1_description": "HARINA DE TRIGO",
"item_1_qty": "40",
"subtotal": "500000",
"total": "595000"
},
"photos": [
{
"image_path": "output/h8i9j0k1l2/photo_full_picture.png",
"verified": true,
"attempts": 1
}
]
}