Extraction & Results Endpoints
Retrieve extracted data, download documents, and check compliance status.
Extraction & Results Endpoints
After documents are uploaded and processed, use these endpoints to retrieve extracted data, compliance information, and download the original documents.
List All Documents
Retrieve a paginated list of all documents with optional filtering.
Endpoint
GET /documents
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| offset | Integer | 0 | Number of items to skip |
| limit | Integer | 20 | Maximum items to return (max 100) |
| status | String | - | Filter by status (processing, processed, requires_review, reviewed, failed) |
| documentType | String | - | Filter by document type (invoice, packing_list, bill_of_lading, certificate_of_origin) |
| language | String | - | Filter by detected language |
Example Request
curl "https://api.cargolint.com/api/v1/documents?status=processed&limit=10&offset=0" \
-H "X-API-Key: sk_test_YOUR_SECRET_KEY_HERE"
Response Schema
{
"data": [
{
"id": "doc_abc123",
"fileName": "invoice.pdf",
"documentType": "invoice",
"status": "processed",
"fileSize": 245600,
"createdAt": "2026-03-02T10:30:00Z",
"updatedAt": "2026-03-02T11:45:00Z"
}
],
"pagination": {
"offset": 0,
"limit": 10,
"total": 250,
"hasMore": true
}
}
Get Single Document
Retrieve detailed information about a specific document.
Endpoint
GET /documents/{id}
Example Request
curl "https://api.cargolint.com/api/v1/documents/doc_abc123" \
-H "X-API-Key: sk_test_YOUR_SECRET_KEY_HERE"
Get Document Extractions
Retrieve all extracted data and fields from a processed document.
Endpoint
GET /documents/{id}/extractions
Example Request
curl "https://api.cargolint.com/api/v1/documents/doc_abc123/extractions" \
-H "X-API-Key: sk_test_YOUR_SECRET_KEY_HERE"
Response Schema
{
"documentId": "doc_abc123",
"extractedData": {
"invoice": {
"invoiceNumber": "INV-2026-0042",
"invoiceDate": "2026-03-01",
"totalAmount": 15250.00,
"currency": "USD",
"supplier": {
"name": "Global Logistics Ltd",
"address": "123 Trade St, Hong Kong"
},
"buyer": {
"name": "Midwest Imports Inc",
"address": "456 Commerce Ave, Chicago, IL"
},
"lineItems": [
{
"description": "Electronics Components",
"quantity": 100,
"unitPrice": 152.50,
"total": 15250.00,
"hsCode": "8471.30.00",
"countryOfOrigin": "CN"
}
]
}
},
"confidence": {
"overall": 0.94,
"fields": {
"invoiceNumber": 0.99,
"invoiceDate": 0.98,
"totalAmount": 0.96
}
}
}
Get Document Compliance Status
Check customs compliance and regulatory requirements for a document.
Endpoint
GET /documents/{id}/compliance
Example Request
curl "https://api.cargolint.com/api/v1/documents/doc_abc123/compliance" \
-H "X-API-Key: sk_test_YOUR_SECRET_KEY_HERE"
Response Schema
{
"documentId": "doc_abc123",
"complianceStatus": "compliant",
"checks": [
{
"checkName": "Required Fields Present",
"status": "passed",
"message": "All required invoice fields found"
},
{
"checkName": "HS Code Validation",
"status": "passed",
"message": "HS codes are valid and current"
},
{
"checkName": "Restricted Goods Check",
"status": "warning",
"message": "Product contains components that may require additional licensing"
}
]
}
Download Document
Download the original uploaded file. Returns a SAS URL for downloading from Azure Blob Storage.
Endpoint
GET /documents/{id}/download
Example Request
curl "https://api.cargolint.com/api/v1/documents/doc_abc123/download" \
-H "X-API-Key: sk_test_YOUR_SECRET_KEY_HERE"
Get Adjacent Documents
Retrieve the previous and next documents for navigation purposes.
Endpoint
GET /documents/{id}/adjacent
Set Shipment Label
Apply a label to a document (and its batch siblings):
Endpoint
PUT /documents/{id}/shipment-label
curl -X PUT "https://api.cargolint.com/api/v1/documents/doc_abc123/shipment-label" \
-H "X-API-Key: sk_test_YOUR_SECRET_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{"shipmentLabel": "SHIPMENT-2026-042"}'
Error Responses
404 Document Not Found
{
"error": "Document not found",
"code": "DOCUMENT_NOT_FOUND"
}
Best Practices
- Use filtering to optimize query results and reduce data transfer
- Implement pagination with appropriate limits for large datasets
- Cache extraction results if documents don’t change frequently
- Monitor compliance warnings and follow recommendations