Upload individual files to a case, fetch their OCR and reclassify them when needed.
| Method | Path | Description |
|---|---|---|
POST | /v1/documents | Upload a document to a case |
GET | /v1/documents/{document_id} | Read metadata and OCR for a document |
GET | /v1/documents/{document_id}/extraction-data | Advanced extraction (validity, QR/barcodes, owner info) |
DELETE | /v1/documents/{document_id} | Soft-delete a document |
POST | /v1/documents/{document_id}/restore | Restore a soft-deleted document |
PATCH | /v1/documents/{document_id}/ocr | Inject OCR manually |
POST | /v1/documents/{document_id}/classify | Re-classify the document (manual or automatic) |
POST | /v1/documents/{document_id}/process | Trigger automatic OCR |
POST | /v1/documents/{document_id}/reclassify | Change the type and re-process |
/v1/documents — Upload a document#Uploads a file and attaches it to a case.
| Field | Type | Required | Description |
|---|---|---|---|
case_id | UUID | Yes | Case the document belongs to |
mime_type | string | Yes | File MIME (see supported types) |
url | string | Conditional | Public URL of the file. XOR with base64. |
base64 | string | Conditional | File content in base64. XOR with url. |
type | string | No | Document type (see Document types). If omitted, classification runs automatically. |
parent_file_id | UUID | No | Parent document inside the same case (e.g. an invoice attachment). |
Size limit: 20 MB per file. You must send exactly one of
urlorbase64.
application/pdf · application/xml · image/jpeg · image/jpg · image/png · image/tiff · image/tif · image/x-tiff
curl -X POST https://api.nexcar.mx/v1/documents \
-H "x-api-key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"case_id": "7040fd87-5f49-4187-b2a3-b4a19670825c",
"url": "https://your-storage.example.com/repuve-certificate.pdf",
"mime_type": "application/pdf",
"type": "repuve"
}'
BASE64=$(base64 -i ./invoice.pdf)
curl -X POST https://api.nexcar.mx/v1/documents \
-H "x-api-key: your_api_key" \
-H "Content-Type: application/json" \
-d "{
\"case_id\": \"7040fd87-5f49-4187-b2a3-b4a19670825c\",
\"base64\": \"$BASE64\",
\"mime_type\": \"application/pdf\",
\"type\": \"factura\"
}"
201#{
"document_id": "abc123",
"url": "https://...nexcar.mx/storage/.../repuve-certificate.pdf"
}
| HTTP | Code | Cause |
|---|---|---|
400 | MISSING_PARAMETER | Missing case_id, mime_type or the file source |
400 | VALIDATION_ERROR | Invalid UUID, unsupported MIME, file > 20 MB, both url and base64 |
404 | RESOURCE_NOT_FOUND | The case_id or parent_file_id does not exist |
/v1/documents/{document_id}#Returns metadata, OCR and extracted data for the document.
curl https://api.nexcar.mx/v1/documents/abc123 \
-H "x-api-key: your_api_key"
200#{
"case_id": "7040fd87-5f49-4187-b2a3-b4a19670825c",
"url": "https://...nexcar.mx/storage/.../invoice.pdf",
"mime_type": "application/pdf",
"type": "factura",
"json_ocr": { "...": "..." },
"parsed_data": {
"vin": "3VWFE21C04M000001",
"rfc_emisor": "ABC010101AAA",
"monto_total": 285000.00,
"fecha_emision": "2024-08-15"
},
"validity": {
"document_validity": "vigente",
"codes": ["QR detectado"],
"userInfo": { "nombre": "JUAN PÉREZ GARCÍA" }
}
}
json_ocr and parsed_data are null while OCR has not finished. Instead of polling, configure a webhook.
/v1/documents/{document_id}/classify#Sets or changes the document type. Useful when you uploaded the file without a type and want to classify it manually, or when you want to force a fresh automatic detection.
curl -X POST https://api.nexcar.mx/v1/documents/abc123/classify \
-H "x-api-key: your_api_key" \
-H "Content-Type: application/json" \
-d '{ "type": "tenencia" }'
If you omit the body, automatic classification runs against the file's content.
/v1/documents/{document_id}/reclassify#Changes the document type and re-runs OCR with the new classification. The response is 202 Accepted with the job_id of the new processing job.
curl -X POST https://api.nexcar.mx/v1/documents/abc123/reclassify \
-H "x-api-key: your_api_key" \
-H "Content-Type: application/json" \
-d '{ "type": "factura_xml" }'