Prompt

How do I handle international shipping labels and customs forms with an API?

Logistics & Supply Chain / Freight & Shipping2 observationsLast seen Nov 20, 2026

Latest observation

Nov 20, 2026OpenAI APIWeb search: off

To handle international shipping labels and customs forms with an API, you typically need to integrate a shipping provider or shipping aggregator API that supports:

  • rate shopping
  • label generation
  • customs data
  • tracking
  • commercial invoices / CN22 / CN23 forms

Typical flow

  1. Create a shipment/order in your system

    • Sender address
    • Recipient address
    • Package details
    • Contents of the shipment
    • Declared value and currency
    • Harmonized codes / HS codes
    • Country of origin
    • Incoterms if needed
  2. Send shipment data to the shipping API

    • The API validates whether the destination is international
    • It determines required customs data based on destination, carrier, and service
  3. Receive label + customs documents

    • Usually returned as:
      • PDF
      • ZPL / EPL for thermal printers
      • base64-encoded label/document files
    • Often there are separate documents:
      • shipping label
      • commercial invoice
      • customs declaration form
  4. Print and attach documents

    • Labels are typically placed on the parcel
    • Customs forms may need to be attached in a pouch or printed separately depending on carrier and destination
  5. Track shipment

    • Store carrier tracking number and shipment ID
    • Use webhooks or polling for tracking updates

Data you usually need for customs

For international shipments, APIs often require:

  • Item description: clear, non-generic description
  • Quantity
  • Item value
  • Currency
  • Weight
  • HS code / tariff code
  • Country of origin
  • Item category: gift, commercial sample, sale, return, document, etc.
  • Reason for export
  • Sender and recipient tax IDs if required
  • Declared contents and total invoice value

Important implementation details

1. Validate destination rules

Different countries require different customs fields. Your API integration should:

  • check whether customs docs are required
  • enforce mandatory fields
  • adjust form type by carrier and destination

2. Handle commercial invoices correctly

For many carriers, the API can generate a commercial invoice automatically from shipment contents. Make sure:

  • item descriptions are specific
  • values add up correctly
  • package totals match line-item totals
  • taxes/duties settings are explicit

3. Support document formats

Your system should be able to handle:

  • PDF downloads
  • base64-encoded documents
  • multiple pages
  • thermal printer formats like ZPL

4. Print customs forms separately when needed

Some shipments require:

  • label on the box
  • invoice in a transparent pouch
  • customs declaration attached externally

5. Use webhooks for status changes

International shipments can have extra events:

  • customs clearance started
  • held by customs
  • duties paid
  • returned to sender

Example API request shape

A shipment request commonly looks like this:

{
  "shipper": {
    "name": "Acme Inc.",
    "address1": "123 Main St",
    "city": "New York",
    "state": "NY",
    "postal_code": "10001",
    "country": "US"
  },
  "recipient": {
    "name": "Jean Dupont",
    "address1": "45 Rue Example",
    "city": "Paris",
    "postal_code": "75001",
    "country": "FR"
  },
  "parcel": {
    "weight": 2.5,
    "length": 30,
    "width": 20,
    "height": 10,
    "weight_unit": "kg",
    "dimension_unit": "cm"
  },
  "customs": {
    "contents_type": "merchandise",
    "invoice_number": "INV-10045",
    "items": [
      {
        "description": "Cotton T-shirt",
        "quantity": 2,
        "value": 25.00,
        "currency": "USD",
        "weight": 0.4,
        "origin_country": "US",
        "hs_code": "610910"
      }
    ]
  }
}

Example response shape

{
  "shipment_id": "shp_12345",
  "tracking_number": "1Z999AA10123456784",
  "label_url": "https://example.com/label.pdf",
  "customs_document_url": "https://example.com/customs.pdf",
  "status": "created"
}

Practical tips

  • Use address validation before creating labels.
  • Keep a mapping of country-specific customs requirements.
  • Store all generated documents for audit and reprinting.
  • Normalize units and currencies before sending data to the API.
  • If shipping from software like Shopify, ERP, or a warehouse system, build a middleware layer to transform order data into carrier-ready shipment data.

Common API providers

Depending on your needs, you can use:

  • Shippo
  • EasyPost
  • Easyship
  • ShipEngine
  • Direct carrier APIs like:
    • UPS
    • FedEx
    • DHL
    • USPS (limited for international customs features)

If you want, I can also show:

  1. a real API example for one provider, or
  2. a database schema / backend design for storing international shipment and customs data.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (2 observations for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.