Skip to content
LOCRAI
All guides
Guides · 02

Uploading a document

Start extraction with a multipart upload and follow the document's states.

To start an extraction, upload a file with a multipart request to the upload endpoint. LOCRAI recognizes the document type and queues processing securely.

POST /documents/uploadbash
curl -X POST https://app.locrai.com/api/v1/documents/upload \
  -H "Authorization: Bearer idp_live_xxxxxxxxxxxxxxxxxxxx" \
  -F "[email protected]"

The response is immediate (202 Accepted): processing continues in the background. Keep the id field, you'll need it to retrieve the data and to link webhooks. The document type is detected during processing, so document_type may still be null in this first response.

202 Accepted — il tipo viene riconosciuto dopo, può essere null quijson
{
  "data": {
    "id": "9b1f0e2c-1c2d-4f5a-8e9b-0a1b2c3d4e5f",
    "original_name": "fattura-2026-123.pdf",
    "status": "pending",
    "document_type": null,
    "file_url": "/api/v1/documents/9b1f0e2c.../file"
  }
}

Supported formats

PDF, JPG, JPEG, PNG, TIFF and XML (FatturaPA electronic invoice, interpreted as structured data). Maximum size 25 MB per file.

Document states

A document goes through a sequence of states. Most carry on by themselves up to extracted; only the cases below the threshold require human review.

  • pending — queued, just uploaded
  • processing — being processed
  • extracted — data ready, above the threshold
  • review_needed — human review required
  • approved — approved after review
  • failed — processing failed
To know when a document is ready without polling the API continuously, use webhooks: see the dedicated guide.
Open the guideRetrieving the extracted data

Ready to integrate LOCRAI?

Generate an API key from the dashboard and get started, or write to us: we'll help you connect LOCRAI to your systems, including custom connectors.

Contact us