Base URL
Todas las peticiones van a https://api.ocr.cargoffer.com. La referencia interactiva está en /.
POST/api/signup · POST/api/upload · POST/api/analyze/{job} · GET/api/jobs/{job} · GET/api/me
1 · Obtén tu API key
curl -X POST https://api.ocr.cargoffer.com/api/signup \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"email":"[email protected]","plan":"free"}'
Respuesta: {"user_id":…,"api_key":"ocr_…","plan":"free","pages_limit":1} — guarda la key, solo se muestra una vez.
2 · Sube un documento
El tipo de documento se detecta por el nombre del fichero: factura/invoice, cmr/carta_de_porte, dct/control_de_transporte, dua/customs, albaran/delivery, precio/prn_.
curl -X POST https://api.ocr.cargoffer.com/api/upload \ -H "Authorization: Bearer ocr_TU_KEY" \ -F "file=@factura_repsol.pdf"
Respuesta: {"job":"factura_abc123","doc_type":"invoice","recommended_model":"gemini-3-flash-preview"}
3 · Procesa y consulta el resultado
curl -X POST https://api.ocr.cargoffer.com/api/analyze/factura_abc123 \ -H "Authorization: Bearer ocr_TU_KEY" \ -F "model_id=auto" -F "use_marker=false" # Polling hasta que esté completo curl https://api.ocr.cargoffer.com/api/jobs/factura_abc123 \ -H "Authorization: Bearer ocr_TU_KEY"
Cuando status es completed, result contiene los campos estructurados del documento.