Documents API
Generate, manage, and download trade documents, invoices, and export certificates.
POST
/api/v1/documents/generateGenerate export documents such as commercial invoices, packing lists, and certificates of origin.
Request Body
{
"type": "commercial_invoice",
"shipmentId": "shp_123456789",
"data": {
"invoiceNumber": "INV-2024-001",
"invoiceDate": "2024-12-01",
"seller": {
"name": "Export Company Ltd",
"address": "123 Export St",
"country": "US"
},
"buyer": {
"name": "Import Corp",
"address": "456 Import Ave",
"country": "CN"
},
"items": [
{
"description": "Mobile Phones",
"hsCode": "8517",
"quantity": 100,
"unitPrice": 500,
"total": 50000
}
],
"currency": "USD",
"paymentTerms": "Net 30"
}
}Response
{
"success": true,
"data": {
"documentId": "doc_987654321",
"type": "commercial_invoice",
"status": "generated",
"downloadUrl": "https://api.heydeo.ai/v1/documents/doc_987654321/download",
"expiresAt": "2024-12-08T00:00:00Z",
"format": "pdf",
"size": 245760
}
}GET
/api/v1/documents/:idRetrieve document metadata and status.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string | Unique document identifier |
Response
{
"success": true,
"data": {
"documentId": "doc_987654321",
"type": "commercial_invoice",
"status": "generated",
"shipmentId": "shp_123456789",
"createdAt": "2024-12-01T10:30:00Z",
"downloadUrl": "https://api.heydeo.ai/v1/documents/doc_987654321/download",
"expiresAt": "2024-12-08T00:00:00Z",
"format": "pdf",
"size": 245760
}
}GET
/api/v1/documents/:id/downloadDownload the generated document file (PDF).
Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string | Unique document identifier |
Response
Returns the PDF file with appropriate headers:
Content-Type: application/pdf
Content-Disposition: attachment; filename="commercial_invoice_INV-2024-001.pdf"
[Binary PDF data]Supported Document Types
| Type | Description |
|---|---|
| commercial_invoice | Commercial invoice for customs clearance |
| packing_list | Detailed packing list of goods |
| certificate_of_origin | Certificate of origin document |
| bill_of_lading | Bill of lading for shipment |
| proforma_invoice | Proforma invoice for quotation |