Documentation

Migration to general_customs_declaration

The top-level customs_declaration object in requests to create or update shipments (e.g., in CreateCompositeShipmentRequest) previously supported several specific, now-deprecated declaration types. These have now been replaced with a general customs declaration that can be used for all occasions.

Summary of Changes

Reason for Deprecation

Previously, the customs_declaration object supported several distinct, specific declaration types (e.g., cn22, electronic_invoice_ups). This approach led to a fragmented and less flexible system, requiring integrators to manage multiple structures for similar information. To simplify the API, improve maintainability, and allow for a more consistent representation of customs data, these specific types have been consolidated into a single, general customs declaration (general_customs_declaration). This new structure is designed to be comprehensive enough for all use cases, reducing complexity and making future extensions easier.

Before Migration (Example JSON Body)

You might have been sending a customs_declaration object in your request body like this:

{
  "customs_declaration": {
    "cn22": {
      "items": [
        {
          "description": "Cotton T-Shirt",
          "quantity": 2,
          "total_net_weight": 400,
          "total_value": 5000,
          "hs_tariff_number": "61091000",
          "country_of_origin": "PT"
        }
      ],
      "currency": "USD",
      "total_gross_weight": 550,
      "contents_type": "SALE",
      "eori_number": "SE1234567890"
    }
  }
}

After Migration (Example JSON Body)

The equivalent object using general_customs_declaration is structured as follows. Note that the entire customs_declaration object is now replaced by the content of GeneralCustomsDeclaration.

{
  "customs_declaration": {
    "general_customs_declaration": {
      "items": [
        {
          "name": "Cotton T-Shirt",
          "quantity": 2,
          "unit_net_weight": 200,
          "unit_value": 2500,
          "hs_tariff_number": "61091000",
          "country_of_origin": "PT"
        }
      ],
      "currency": "USD",
      "total_gross_weight": 550,
      "contents_type": "SALE",
      "seller_identification_numbers": {
        "eori": "SE1234567890"
      }
    }
  }
}

Migration Steps

To migrate your integrations, you will need to:

  1. Identify Existing Declaration Type: Determine which of the deprecated customs declaration types (cn22, cn23, cp72, electronic_invoice_ups, electronic_invoice_fedex) your integration is currently using.
  2. Map Fields to GeneralCustomsDeclaration: Using the provided field mapping tables, translate your existing customs data to the corresponding fields within the general_customs_declaration object.
  3. Recalculate Item Values (Crucial): For each item within the customs declaration's items array, you must convert total_value to unit_value (total value / quantity) and total_net_weight to unit_net_weight (total net weight / quantity). This is a critical change, and failing to perform this calculation will result in incorrect customs declarations.
  4. Update Request Bodies: Modify your POST /shipments.create, POST /shipments.createAndBook, or POST /customs_declaration.upsert request bodies to use the new general_customs_declaration object instead of the deprecated specific types. Ensure the entire customs_declaration object now contains only the general_customs_declaration field.
  5. Update API Response Parsing: When consuming API responses that include shipment details, ensure your code is updated to expect and parse the customs.declaration field to contain general_customs_declaration instead of the old specific types.

Field Mapping Tables

DeclarationCN (CN22, CN23, CP72)

cn22, cn23, cp72 have been moved to general_customs_declaration and the fields should be mapped as:

Deprecated Field (DeclarationCN) New Field (GeneralCustomsDeclaration) Notes
items.description items.description Direct mapping
items.quantity items.quantity Direct mapping
items.total_net_weight items.unit_net_weight Calculation required: total_net_weight / quantity
items.total_value items.unit_value Calculation required: total_value / quantity
items.hs_tariff_number items.hs_tariff_number Direct mapping
items.country_of_origin items.country_of_origin Direct mapping
currency currency Direct mapping
total_gross_weight total_gross_weight Direct mapping
contents_type contents_type Direct mapping
contents_explanation contents_explanation Direct mapping
eori_number seller_identification_numbers.eori Assumes EORI belongs to the seller.

ElectronicInvoiceUPS / ElectronicInvoiceFedex

electronic_invoice_ups and electronic_invoice_fedex have been moved to general_customs_declaration and the fields should be mapped as:

Deprecated Field (ElectronicInvoiceUPS / ElectronicInvoiceFedex) New Field (GeneralCustomsDeclaration) Notes
items.description items.description Direct mapping
items.quantity items.quantity Direct mapping
items.total_value items.unit_value Calculation required: total_value / quantity
items.hs_tariff_number items.hs_tariff_number Direct mapping
items.country_of_origin items.country_of_origin Direct mapping
items.total_net_weight (Fedex only) items.unit_net_weight Calculation required: total_net_weight / quantity
items.unit_value (Fedex only) items.unit_value Direct mapping
currency currency Direct mapping
total_gross_weight (UPS only) total_gross_weight Direct mapping
contents_type contents_type Direct mapping
contents_explanation (UPS only) contents_explanation Direct mapping
invoice_number (UPS only) invoice_number Direct mapping
invoice_date (UPS only) invoice_date Direct mapping
sold_to (UPS only) sold_to Direct mapping
incoterms (Fedex only) incoterms Direct mapping
declaration_statement (Fedex only) declaration_statement Direct mapping

Last updated: Thu, Feb 12, 06:59 AM