Commercial Invoice

Create a Commercial Invoice

Changed on

Generate an Envia commercial invoice PDF for an international label you already created.

When to use: After /ship/generate, when the carrier or destination needs a commercial invoice. FedEx and DHL Express return their own invoice in data[].additionalFiles of /ship/generate, so this call is not needed for them. For UPS (ups2), call it right after the label.

Prerequisites:

  • Valid JWT authentication token (Bearer)
  • A label that belongs to your account and is not cancelled (shipment.carrier + shipment.trackingNumber). Otherwise error 1127 is returned.
  • Every package must include amount, declaredValue, totalWeight, cost, cubicMeters and items

Key behaviors:

  • The PDF is built only from this request. Nothing is copied from the /ship/generate request.
  • The invoice is always in English. For FedEx, DHL, UPS and most carriers, amounts are printed in USD. Send settings.currency: "USD" when prices are in USD; otherwise prices are converted from packages[].currency.
  • price is a unit price. Line subtotal = price × quantity × package amount.
  • If customsSettings.exportReason is omitted, the invoice prints "Sample". Send sale for commercial shipments.
  • The "Tax ID" lines print origin.taxId / destination.taxId, not identificationNumber.
  • No charge is applied. Calling it again for the same tracking number replaces the PDF at the same URL (and, for UPS, sends it to UPS again).
  • The PDF URL does not expire. It is also returned later as bol_file by the Queries API (GET /guide/{tracking_number}).
post/ship/commercial-invoice

Request

  • Base URL
    https://api-test.envia.com
  • URL
    https://api-test.envia.com/ship/commercial-invoice
  • Auth
    HTTP bearer

Request body

Example request

{
  "origin": {
    "name": "Juan Pérez",
    "company": "Envia Corp",
    "email": "juan.perez@example.com",
    "phone_code": "+52",
    "phone": "8180000000",
    "street": "Av. Revolución 500",
    "number": "500",
    "district": "Centro",
    "city": "Monterrey",
    "state": "NL",
    "country": "MX",
    "postalCode": "64060",
    "reference": "Frente al parque",
    "address_id": 12345,
    "identificationNumber": "XAXX010101000",
    "category": 1,
    "taxId": "12-3456789"
  },
  "destination": {
    "name": "María García",
    "company": "Tienda Online SA",
    "email": "maria.garcia@example.com",
    "phone_code": "+52",
    "phone": "8180000000",
    "street": "Calle Reforma 123",
    "number": "123",
    "district": "Coyoacán",
    "city": "Ciudad de México",
    "state": "CX",
    "country": "MX",
    "postalCode": "04530",
    "reference": "Edificio azul, piso 3",
    "address_id": 12345,
    "identificationNumber": "XAXX010101000",
    "category": 1,
    "taxId": "12-3456789"
  },
  "shipment": {
    "carrier": "fedex",
    "trackingNumber": "7520610403",
    "orderReference": "ORDER-1001"
  },
  "packages": [
    {
      "amount": 1,
      "declaredValue": 26,
      "totalWeight": 2.2,
      "weightUnit": "LB",
      "currency": "USD",
      "items": [
        {
          "description": "Wireless headphones",
          "productCode": "8518.30",
          "countryOfManufacture": "CN",
          "quantity": 2,
          "price": 45
        }
      ]
    }
  ],
  "customsSettings": {
    "dutiesPaymentEntity": "recipient",
    "exportReason": "sale",
    "itn": "X20261028123456"
  },
  "settings": {
    "currency": "USD",
    "printSize": "PAPER_LETTER"
  }
}

Response

Commercial invoice created successfully

metastring

Always billoflading

Changes

    • breaking

      added the new required request property //

    • breaking

      added the new required request property //

    • breaking

      added the new required request property //

    • breaking

      added the new required request property //

    • breaking

      added the new required request property //

    • info

      added the new optional request property /

    • info

      added the new optional request property /

    • info

      added the new optional request property /

    • info

      added the new optional request property //

    • info

      added the new optional request property //

    • info

      added the new optional request property

    • info

      added the new optional request property /

    • info

      added the new envia_guaranteed enum value to the request property /