> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stateset.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generates a commercial invoice / customs document from a canonical

> commercial-invoice payload. Emits a signed edi.commercial_invoice.generated VES event…

commercial-invoice payload. Emits a signed `edi.commercial_invoice.generated`
VES event. The response flags whether every line carries the HS code and
country of origin a compliant declaration needs.

### Path parameters

<ParamField path="partner_id" type="string" required>
  Partner ID
</ParamField>

### Request body

`CommercialInvoice`

<ParamField body="buyer" type="CustomsParty" required />

<ParamField body="currency" type="string">
  ISO currency code the values are expressed in.
</ParamField>

<ParamField body="freight" type="string">
  Freight charge added to the customs value (when DDP/CIF style terms).
</ParamField>

<ParamField body="incoterms" type="string">
  Incoterms 2020 three-letter rule, e.g. `DAP`, `DDP`, `EXW`.
</ParamField>

<ParamField body="incoterms_place" type="string">
  Named place for the incoterm, e.g. `Rotterdam`.
</ParamField>

<ParamField body="insurance" type="string">
  Insurance charge added to the customs value.
</ParamField>

<ParamField body="invoice_date" type="string" required />

<ParamField body="invoice_number" type="string" required />

<ParamField body="lines" type="CustomsLine[]" required />

<ParamField body="po_number" type="string" />

<ParamField body="reason_for_export" type="string">
  Why the goods are being exported (sale, sample, return, gift) — a CN22/23 and many national customs forms require it.
</ParamField>

<ParamField body="seller" type="CustomsParty" required />

<ParamField body="ship_to" type="object" />

### Response

No response body. Commercial invoice (structured + HTML).

### Status codes

| Code  | Meaning                                |
| ----- | -------------------------------------- |
| `200` | Commercial invoice (structured + HTML) |
| `403` | Not this credential's partner          |
| `422` | Invalid payload                        |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://edi.stateset.com/v1/commercial-invoice/{partner_id}' \
    --header 'Authorization: Bearer YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
    "buyer": {
      "address_lines": [
        "548 Market St"
      ],
      "city": "San Francisco",
      "country": "US",
      "name": "Two-Person Tent",
      "postal_code": "94107",
      "state": "CA",
      "tax_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
    },
    "currency": "USD",
    "freight": "string",
    "incoterms": "string",
    "incoterms_place": "string",
    "insurance": "string",
    "invoice_date": "2026-08-31T14:22:05Z",
    "invoice_number": "ORD-10042",
    "lines": [
      {
        "country_of_origin": "US",
        "description": "Two-person tent, green — replacement for damaged pole set.",
        "hs_code": "string",
        "net_weight_kg": "string",
        "quantity": "string",
        "sku": "SKU-TENT-2P-GRN",
        "unit_price": "49.00",
        "uom": "string"
      }
    ],
    "po_number": "ORD-10042",
    "reason_for_export": "string",
    "seller": {
      "address_lines": [
        "548 Market St"
      ],
      "city": "San Francisco",
      "country": "US",
      "name": "Two-Person Tent",
      "postal_code": "94107",
      "state": "CA",
      "tax_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
    },
    "ship_to": {
      "address_lines": [
        "548 Market St"
      ],
      "city": "San Francisco",
      "country": "US",
      "name": "Two-Person Tent",
      "postal_code": "94107",
      "state": "CA",
      "tax_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
    }
  }'
  ```
</RequestExample>
