Upload individual files to a case, fetch their OCR and reclassify them when needed.
| Method | Path | Description |
|---|---|---|
GET | /v1/documents | Paginated list of the company's documents |
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 — List documents#Returns the paginated list of documents for the authenticated user's company, ordered from newest to oldest.
Requires Bearer Token (JWT). Unlike the other endpoints in this series, this one does not accept
x-api-key.
| Parameter | Type | Default | Description |
|---|---|---|---|
case_id | UUID | — | Filter by case. Combinable with document_id (AND). |
document_id | UUID | — | Filter by document. Combinable with case_id (AND). |
limit | integer | 10 | Page size (max 100) |
offset | integer | 0 | Numeric cursor for pagination |
A
case_idordocument_idthat doesn't exist, or belongs to another company, returns an empty list (not404/403) to avoid revealing the existence of resources you don't own.
curl "https://api.nexcar.mx/v1/documents?case_id=11111111-2222-3333-4444-555555555555&limit=10&offset=0" \
-H "Authorization: Bearer your_jwt_token"
200#{
"data": [
{
"document_id": "abc123",
"case_id": "11111111-2222-3333-4444-555555555555",
"type": "factura",
"mime_type": "application/pdf",
"status": "completed",
"url": "https://...nexcar.mx/storage/.../invoice.pdf",
"created_at": "2026-06-08T10:00:00+00:00",
"active": true
}
],
"pagination": {
"limit": 10,
"offset": 0,
"total": 1,
"has_more": false
}
}
| Field | Type | Description |
|---|---|---|
document_id | UUID | Document identifier |
case_id | UUID | Case the document belongs to |
type | string | null | Document type |
mime_type | string | null | File MIME type |
status | string | null | Document processing status |
url | string | null | Public URL of the stored file |
created_at | string | Creation date in ISO 8601 format |
active | boolean | true = document is active |
pagination.total | integer | Total number of matching records |
pagination.has_more | boolean | true if more pages are available |
| HTTP | Code | Cause |
|---|---|---|
400 | VALIDATION_ERROR | case_id/document_id are not valid UUIDs, or limit/offset are not integers |
401 | UNAUTHORIZED | Missing token, or company_id could not be determined from the token/profile |
/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": "11111111-2222-3333-4444-555555555555",
"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\": \"11111111-2222-3333-4444-555555555555\",
\"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": "11111111-2222-3333-4444-555555555555",
"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" }'