cURL
Reemplaza YOUR_API_KEY y los IDs de ejemplo. La URL base de la API es https://ocr.789.com.mx/v1.
Health check (sin API Key)
curl -s "https://ocr.789.com.mx/health/live"
Crear documento
curl -X POST "https://ocr.789.com.mx/v1/documents" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-F "file=@/ruta/al/archivo.pdf" \
-F "profile=general_document" \
-F "output_formats[]=markdown" \
-F "output_formats[]=json"
Consultar documento
curl -s "https://ocr.789.com.mx/v1/documents/doc_01JXXXXXXXX" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Accept: application/json"
Listar documentos
curl -s "https://ocr.789.com.mx/v1/documents?status=completed&per_page=25&page=1" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Accept: application/json"
Cancelar documento
Solo mientras sigue en queued.
curl -X POST "https://ocr.789.com.mx/v1/documents/doc_01JXXXXXXXX/cancel" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Accept: application/json"
Resultado OCR
curl -s "https://ocr.789.com.mx/v1/documents/doc_01JXXXXXXXX/result?format=markdown&download=false" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Accept: application/json"
Crear extracción
curl -X POST "https://ocr.789.com.mx/v1/extractions" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"document_id": "doc_01JXXXXXXXX",
"custom_instruction": "Factura mexicana. Montos como número decimal sin símbolo de moneda.",
"response_schema": {
"type": "object",
"additionalProperties": false,
"required": ["supplier_name", "invoice_number", "total"],
"properties": {
"supplier_name": { "type": ["string", "null"] },
"invoice_number": { "type": ["string", "null"] },
"total": { "type": ["number", "null"], "description": "Total a pagar con impuestos." }
}
},
"input_result_type": "markdown"
}'
Consultar extracción
curl -s "https://ocr.789.com.mx/v1/extractions/ext_01JXXXXXXXX" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Accept: application/json"
Listar extracciones
curl -s "https://ocr.789.com.mx/v1/extractions?document_id=doc_01JXXXXXXXX" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Accept: application/json"
Resultado de extracción
curl -s "https://ocr.789.com.mx/v1/extractions/ext_01JXXXXXXXX/result" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Accept: application/json"
El JSON extraído está en data.result.
Consumo del proyecto
curl -s "https://ocr.789.com.mx/v1/usage?from=2026-06-01&to=2026-06-30" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Accept: application/json"