Returns a list of commercial invoices
Success
{- "_object": "/api/response",
- "version": 3,
- "data": {
- "_object": "/api/collections/paginated",
- "next": null,
- "data": [
- {
- "_object": "/commercial_invoice",
- "id": "abc123-456-def",
- "invoice_number": "INV-2024-8472",
- "digitization_status": "complete",
- "currency": "USD",
- "invoice_date": "2024-03-15",
- "order_number": "PO-2024-0042",
- "incoterm": "FOB",
- "is_related_parties": false,
- "manifest_quantity": 250,
- "manifest_quantity_unit_type": "CARTON",
- "manufacturer_addresses": [
- {
- "_object": "/address",
- "street_address": "88 Huayuan Industrial Road",
- "city": "Shenzhen",
- "state": "Guangdong",
- "country": "China",
- "country_code": "CN",
- "zip": "518000",
- "unlocode": "CN SZX",
- "ref": "id-3333"
}
], - "total_value": {
- "_object": "/money",
- "amount": "28750.00",
- "currency_code": "USD"
}, - "total_unit_count": "750",
- "total_weight": {
- "_object": "/quantity/weight",
- "value": 625,
- "unit": "kg"
}, - "total_volume": {
- "_object": "/quantity/volume",
- "value": 18.5,
- "unit": "cbm"
}, - "charge_adjustments": [
- {
- "code": "transport_handling_insurance",
- "amount": 450,
- "currency_code": "USD",
- "applied_as": "flat_rate",
- "applied_to": "value"
}, - {
- "code": "commissions_and_brokerage",
- "amount": 2.5,
- "applied_as": "percentage",
- "applied_to": "value"
}
], - "involved_parties": [
- {
- "_object": "/customs/involved_party",
- "type": "seller",
- "name": "Global Electronics Trading Ltd",
- "address": {
- "_object": "/address",
- "street_address": "123 Nathan Road",
- "street_address2": "Suite 1501",
- "city": "Kowloon",
- "country": "Hong Kong",
- "country_code": "HK",
- "zip": "00000",
- "unlocode": "HK HKG",
- "ref": "id-44444"
}, - "company_entity": {
- "_object": "/api/refs/object",
- "ref_type": "/company_entity",
- "id": 54321
}
}, - {
- "_object": "/customs/involved_party",
- "type": "buyer",
- "name": "TechImport USA Inc",
- "address": {
- "_object": "/address",
- "street_address": "1641 Settlers Lane",
- "street_address2": "STE 2918",
- "city": "Albany",
- "state": "MN",
- "country": "United States of America",
- "country_code": "US",
- "zip": "56307",
- "unlocode": "US MSP",
- "ref": "id-55555"
}, - "company_entity": {
- "_object": "/api/refs/object",
- "ref_type": "/company_entity",
- "id": 54322
}
}, - {
- "_object": "/customs/involved_party",
- "type": "manufacturer",
- "name": "Premium Electronics Factory",
- "address": {
- "_object": "/address",
- "street_address": "88 Huayuan Industrial Road",
- "city": "Shenzhen",
- "state": "Guangdong",
- "country": "China",
- "country_code": "CN",
- "zip": "518000",
- "unlocode": "CN SZX",
- "ref": "id-3333"
}, - "mid_code": "CNSZX456MFG",
- "company_entity": {
- "_object": "/api/refs/object",
- "ref_type": "/company_entity",
- "id": 54323
}
}
], - "line_items": [
- {
- "_object": "/commercial_invoice_line_item",
- "id": 78901,
- "document_line_number": 1,
- "price_per_unit": {
- "_object": "/money",
- "amount": "45.00",
- "currency_code": "USD"
}, - "first_sale_value": {
- "_object": "/money",
- "amount": "38.00",
- "currency_code": "USD"
}, - "value": {
- "_object": "/money",
- "amount": "13500.00",
- "currency_code": "USD"
}, - "net_value": {
- "_object": "/money",
- "amount": "12825.00",
- "currency_code": "USD"
}, - "total_units": 300,
- "quantity": {
- "_object": "/commercial_invoice_line_item/quantity",
- "value": "300",
- "unit": "pcs"
}, - "container_number": {
- "id": 5001,
- "container_number": "MSCU8765432",
- "commercial_invoice_line_item_id": 78901,
- "deleted_at": null,
- "created_at": "2024-03-10T10:15:30.000Z",
- "updated_at": "2024-03-10T10:15:30.000Z"
}, - "purchase_order_number": "PO-2024-0042",
- "po_line_item_number": "1",
- "weight": {
- "_object": "/quantity/weight",
- "value": 300,
- "unit": "kg"
}, - "net_weight": {
- "_object": "/quantity/weight",
- "value": 285,
- "unit": "kg"
}, - "volume": {
- "_object": "/quantity/volume",
- "value": 9,
- "unit": "cbm"
}, - "product": {
- "_object": "/api/refs/object",
- "ref_type": "/product",
- "id": 87654
}, - "charge_adjustments": [
- {
- "code": "commissions_and_brokerage",
- "amount": 675,
- "currency_code": "USD",
- "applied_as": "flat_rate",
- "applied_to": "value"
}
], - "special_program_indicator": {
- "code": "B"
}
}, - {
- "_object": "/commercial_invoice_line_item",
- "id": 78902,
- "document_line_number": 2,
- "price_per_unit": {
- "_object": "/money",
- "amount": "34.00",
- "currency_code": "USD"
}, - "value": {
- "_object": "/money",
- "amount": "15300.00",
- "currency_code": "USD"
}, - "total_units": 450,
- "quantity": {
- "_object": "/commercial_invoice_line_item/quantity",
- "value": "450",
- "unit": "pcs"
}, - "container_number": {
- "id": 5002,
- "container_number": "MSCU8765432",
- "commercial_invoice_line_item_id": 78902,
- "deleted_at": null,
- "created_at": "2024-03-10T10:15:30.000Z",
- "updated_at": "2024-03-10T10:15:30.000Z"
}, - "purchase_order_number": "PO-2024-0042",
- "po_line_item_number": "2",
- "weight": {
- "_object": "/quantity/weight",
- "value": 325,
- "unit": "kg"
}, - "volume": {
- "_object": "/quantity/volume",
- "value": 9.5,
- "unit": "cbm"
}, - "product": {
- "_object": "/api/refs/object",
- "ref_type": "/product",
- "id": 87655
}
}
], - "updated_at": "2024-03-15T14:22:18.500Z",
- "shipment": {
- "_object": "/api/refs/object",
- "ref_type": "/shipment",
- "id": 123456
}
}
]
}
}Creates a commercial invoice if it does not exist yet, otherwise updates an existing entry. This is an asynchronous operation. Successful response means only that submission is accepted, and the actual result of this operation is reported via webhook. Processing errors are not returned in this response; they are delivered in the failure webhook, which lists the possible errors along with their causes and suggested fixes.
| invoice_number required | string Invoice number on the commercial invoice, typically used for display purposes. | ||||||||||
required | Array of objects (CreateCommercialInvoiceLineItem) List of line items on the commercial invoice. | ||||||||||
Array | |||||||||||
required | Array of objects (CreateCustomsInvolvedParty) List of parties involved in the commercial transaction. | ||||||||||
Array
| |||||||||||
| incoterm | string Incoterm of the shipment to which this commercial invoice belongs. | ||||||||||
| is_related_parties | boolean Whether there was a related parties transaction as defined by CBP. Only applicable for the US entries. | ||||||||||
object or Array of objects Set of custom key-values specific to the object. The keys are strings and values are arrays of strings. The set of valid keys is always the consignee's list of keys, even if call was made by a different party. Please contact Flexport representative before sending any attributes in this field. | |||||||||||
| currency required | string Currency code for the commercial invoice. | ||||||||||
| invoice_date | string or null <date> Represents date of the invoice. This can be null. | ||||||||||
Array of objects (CreateCommercialInvoiceChargeAdjustment) List of charge adjustments. | |||||||||||
Array | |||||||||||
| manifest_quantity | integer The total manifest quantity (packaging) for the commercial invoice. | ||||||||||
| manifest_quantity_unit_type | string The unit type for the manifest quantity. If nothing is specified, defaults to CARTON | ||||||||||
Bad Request
Minimal example referencing existing products by SKU only and involved parties by company_entity_ref. Manufacturer is specified at invoice level.
{- "invoice_number": "INV-2024-001",
- "currency": "USD",
- "invoice_date": "2024-01-15",
- "is_related_parties": false,
- "manifest_quantity": 100,
- "manifest_quantity_unit_type": "CARTON",
- "charge_adjustments": [
- {
- "code": "transport_handling_insurance",
- "amount": 150,
- "currency_code": "USD",
- "applied_as": "flat_rate",
- "applied_to": "value"
}, - {
- "code": "deductions_discounts_rebates",
- "amount": 5,
- "applied_as": "percentage",
- "applied_to": "value"
}
], - "involved_parties": [
- {
- "type": "seller",
- "company_entity_ref": "my-seller-ref-1"
}, - {
- "type": "buyer",
- "company_entity_ref": "my-buyer-ref-1"
}, - {
- "type": "manufacturer",
- "company_entity_ref": "my-manufacturer-ref-1"
}
], - "line_items": [
- {
- "document_line_number": 1,
- "price_per_unit": {
- "amount": "25.50",
- "currency_code": "USD"
}, - "value": {
- "amount": "255.00",
- "currency_code": "USD"
}, - "quantity": {
- "value": "10",
- "unit": "pcs"
}, - "purchase_order_number": "PO-9876-ABC",
- "po_line_item_number": "1",
- "weight": {
- "value": 50,
- "unit": "kg"
}, - "volume": {
- "value": 2.5,
- "unit": "cbm"
}, - "product": {
- "sku": "AC-12V-ADPT-8472"
}
}, - {
- "document_line_number": 2,
- "price_per_unit": {
- "amount": "15.00",
- "currency_code": "USD"
}, - "value": {
- "amount": "300.00",
- "currency_code": "USD"
}, - "quantity": {
- "value": "20",
- "unit": "pcs"
}, - "purchase_order_number": "PO-9876-ABC",
- "po_line_item_number": "2",
- "weight": {
- "value": 30,
- "unit": "kg"
}, - "volume": {
- "value": 1.5,
- "unit": "cbm"
}, - "product": {
- "sku": "USB-C-2M-BLK-9183"
}
}
]
}Accepted
{- "_object": "/api/response",
- "version": "3",
- "data": {
- "_object": "/request",
- "request_uuid": "abcd-1234",
- "request_status": "acknowledged"
}
}Retrieves the details of a single commercial invoice.
Success
error
Success
{- "_object": "/api/response",
- "version": 3,
- "data": [
- {
- "_object": "/commercial_invoice",
- "id": "abc123-456-def",
- "invoice_number": "INV-2024-8472",
- "digitization_status": "complete",
- "currency": "USD",
- "invoice_date": "2024-03-15",
- "order_number": "PO-2024-0042",
- "incoterm": "FOB",
- "is_related_parties": false,
- "manifest_quantity": 250,
- "manifest_quantity_unit_type": "CARTON",
- "manufacturer_addresses": [
- {
- "_object": "/address",
- "street_address": "88 Huayuan Industrial Road",
- "city": "Shenzhen",
- "state": "Guangdong",
- "country": "China",
- "country_code": "CN",
- "zip": "518000",
- "unlocode": "CN SZX",
- "ref": "id-3333"
}
], - "total_value": {
- "_object": "/money",
- "amount": "28750.00",
- "currency_code": "USD"
}, - "total_unit_count": "750",
- "total_weight": {
- "_object": "/quantity/weight",
- "value": 625,
- "unit": "kg"
}, - "total_volume": {
- "_object": "/quantity/volume",
- "value": 18.5,
- "unit": "cbm"
}, - "charge_adjustments": [
- {
- "code": "transport_handling_insurance",
- "amount": 450,
- "currency_code": "USD",
- "applied_as": "flat_rate",
- "applied_to": "value"
}, - {
- "code": "commissions_and_brokerage",
- "amount": 2.5,
- "applied_as": "percentage",
- "applied_to": "value"
}
], - "involved_parties": [
- {
- "_object": "/customs/involved_party",
- "type": "seller",
- "name": "Global Electronics Trading Ltd",
- "address": {
- "_object": "/address",
- "street_address": "123 Nathan Road",
- "street_address2": "Suite 1501",
- "city": "Kowloon",
- "country": "Hong Kong",
- "country_code": "HK",
- "zip": "00000",
- "unlocode": "HK HKG",
- "ref": "id-44444"
}, - "company_entity": {
- "_object": "/api/refs/object",
- "ref_type": "/company_entity",
- "id": 54321
}
}, - {
- "_object": "/customs/involved_party",
- "type": "buyer",
- "name": "TechImport USA Inc",
- "address": {
- "_object": "/address",
- "street_address": "1641 Settlers Lane",
- "street_address2": "STE 2918",
- "city": "Albany",
- "state": "MN",
- "country": "United States of America",
- "country_code": "US",
- "zip": "56307",
- "unlocode": "US MSP",
- "ref": "id-55555"
}, - "company_entity": {
- "_object": "/api/refs/object",
- "ref_type": "/company_entity",
- "id": 54322
}
}, - {
- "_object": "/customs/involved_party",
- "type": "manufacturer",
- "name": "Premium Electronics Factory",
- "address": {
- "_object": "/address",
- "street_address": "88 Huayuan Industrial Road",
- "city": "Shenzhen",
- "state": "Guangdong",
- "country": "China",
- "country_code": "CN",
- "zip": "518000",
- "unlocode": "CN SZX",
- "ref": "id-3333"
}, - "mid_code": "CNSZX456MFG",
- "company_entity": {
- "_object": "/api/refs/object",
- "ref_type": "/company_entity",
- "id": 54323
}
}
], - "line_items": [
- {
- "_object": "/commercial_invoice_line_item",
- "id": 78901,
- "document_line_number": 1,
- "price_per_unit": {
- "_object": "/money",
- "amount": "45.00",
- "currency_code": "USD"
}, - "first_sale_value": {
- "_object": "/money",
- "amount": "38.00",
- "currency_code": "USD"
}, - "value": {
- "_object": "/money",
- "amount": "13500.00",
- "currency_code": "USD"
}, - "net_value": {
- "_object": "/money",
- "amount": "12825.00",
- "currency_code": "USD"
}, - "total_units": 300,
- "quantity": {
- "_object": "/commercial_invoice_line_item/quantity",
- "value": "300",
- "unit": "pcs"
}, - "container_number": {
- "id": 5001,
- "container_number": "MSCU8765432",
- "commercial_invoice_line_item_id": 78901,
- "deleted_at": null,
- "created_at": "2024-03-10T10:15:30.000Z",
- "updated_at": "2024-03-10T10:15:30.000Z"
}, - "purchase_order_number": "PO-2024-0042",
- "po_line_item_number": "1",
- "weight": {
- "_object": "/quantity/weight",
- "value": 300,
- "unit": "kg"
}, - "net_weight": {
- "_object": "/quantity/weight",
- "value": 285,
- "unit": "kg"
}, - "volume": {
- "_object": "/quantity/volume",
- "value": 9,
- "unit": "cbm"
}, - "product": {
- "_object": "/api/refs/object",
- "ref_type": "/product",
- "id": 87654
}, - "charge_adjustments": [
- {
- "code": "commissions_and_brokerage",
- "amount": 675,
- "currency_code": "USD",
- "applied_as": "flat_rate",
- "applied_to": "value"
}
], - "special_program_indicator": {
- "code": "B"
}
}, - {
- "_object": "/commercial_invoice_line_item",
- "id": 78902,
- "document_line_number": 2,
- "price_per_unit": {
- "_object": "/money",
- "amount": "34.00",
- "currency_code": "USD"
}, - "value": {
- "_object": "/money",
- "amount": "15300.00",
- "currency_code": "USD"
}, - "total_units": 450,
- "quantity": {
- "_object": "/commercial_invoice_line_item/quantity",
- "value": "450",
- "unit": "pcs"
}, - "container_number": {
- "id": 5002,
- "container_number": "MSCU8765432",
- "commercial_invoice_line_item_id": 78902,
- "deleted_at": null,
- "created_at": "2024-03-10T10:15:30.000Z",
- "updated_at": "2024-03-10T10:15:30.000Z"
}, - "purchase_order_number": "PO-2024-0042",
- "po_line_item_number": "2",
- "weight": {
- "_object": "/quantity/weight",
- "value": 325,
- "unit": "kg"
}, - "volume": {
- "_object": "/quantity/volume",
- "value": 9.5,
- "unit": "cbm"
}, - "product": {
- "_object": "/api/refs/object",
- "ref_type": "/product",
- "id": 87655
}
}
], - "updated_at": "2024-03-15T14:22:18.500Z",
- "shipment": {
- "_object": "/api/refs/object",
- "ref_type": "/shipment",
- "id": 123456
}
}
]
}This webhook is sent when the asynchronous processing of a commercial invoice create/update operation completes.
When data.status is PROCESSING_STATUS_FAILED, the data.error field contains a human-readable description of what went wrong. The table below lists the errors you may encounter, their cause, and how to resolve them.
| Error message | Cause | Suggested fix |
|---|---|---|
| Unable to locate shipment with provided identifier. | The shipment identifier (id or ref) in the request does not match a shipment in your account. | Verify the shipment identifier is correct and belongs to your account, then resubmit. |
| Provided shipment does not have one or more container(s) listed on the commercial invoice. | A container number on a line item is not present on the referenced shipment. | Ensure every line-item container number exists on the shipment before resubmitting. |
| One or more line items' currency do not match provided invoice level currency. | A line item's currency code differs from the invoice-level currency. |
Make all line-item currencies match the invoice currency. |
| Provided currency code {currency_code} does not exist. | The supplied currency code is not a recognized ISO currency. | Use a valid ISO 4217 currency code. |
| customs_proration {value} cannot be set when charge adjustments are provided. | customs_proration and charge_adjustments were both supplied, but they are mutually exclusive. |
Send either customs_proration or charge_adjustments, not both. |
| Document line number(s) invalid. | One or more document_line_number values are invalid. |
Provide valid, in-range document line numbers for each line item. |
| All or none of the line items must provide document_line_number consistently. | Some line items include document_line_number while others do not. |
Set document_line_number on all line items, or on none of them. |
| One or more involved parties on the commercial invoice are invalid. | An entry in involved_parties is malformed or references an unknown party. |
Check each involved party's required fields and company_entity_ref. |
| Manufacturer (MID: {mid_code}) does not exist in your network. | The manufacturer MID is not present in your network. | Add the manufacturer to your network, or correct the MID code. |
| Product with SKU {sku} does not exist or has been archived. | The referenced product SKU is missing or has been archived. | Use an active product SKU, or enable product creation for the line item. |
| Product(s) were not found with the provided sku and products creation are disabled. | The SKU was not found and automatic product creation is disabled. | Create the product first, or enable product creation. |
| Line item with ID {line_item_id} does not exist. | An update referenced a line-item ID that is not on this invoice. | Use a valid line-item ID, or omit the ID to create a new line item. |
| One or more line items are allocated by Customs and cannot be changed. | A line item is locked because it is allocated by a customs entry. | Line items allocated by Customs cannot be modified. |
| Commercial Invoice is being used in a customs entry and cannot be updated. | The invoice is locked by an active customs entry. | The invoice cannot be updated while it is used in a customs entry. |
| Commercial Invoice already exists for the client and seller. | A duplicate invoice for the same client and seller was detected. | Update the existing invoice instead of creating a duplicate. |
| Failed to update metadata with provided data. Make sure each key exists in your schema. | A metadata key is not defined in your configured schema. | Ensure each metadata key exists in your schema before resubmitting. |
| Client not enrolled in shipmentless commercial invoices, Must provide shipment details. | Shipment details were omitted, but your account requires a shipment. | Include shipment details, or contact Flexport support to enable shipmentless commercial invoices. |
| An internal error occurred while processing the commercial invoice. | A Flexport-side processing issue occurred (for example, while looking up or creating a company entity or location). | Retry the request. If the problem persists, contact Flexport support with your request_id. |
A notification about operation completion.
object | |||||||||||||
| |||||||||||||
| _object | string Type of the object, always | ||||||||||||
| id | integer A unique ID of a webhook notification | ||||||||||||
| version | integer | ||||||||||||
| created_at | string | ||||||||||||
| occurred_at | string | ||||||||||||
| type | string Webhook event type, containing information about the operation it refers to | ||||||||||||
Return a 200 response to indicate that webhook has been received successfully.
Commercial invoice was successfully created or updated.
{- "_object": "/event",
- "id": 987654,
- "type": "/async_api/commercial_invoice#post",
- "created_at": "2025-01-02T12:34:56.123Z",
- "occurred_at": "2025-01-02T12:34:56.321Z",
- "version": 3,
- "data": {
- "_object": "/async_api/commercial_invoice",
- "request_id": "11210440-d15f-4699-bda2-46d3b8d3e044",
- "status": "PROCESSING_STATUS_SUCCESSFUL",
- "commercial_invoice_number": "ABCDEFGHIJKLMNOP",
- "commercial_invoice_fid": "flx::core:commercial_invoice:dbid/12345"
}
}