Shipping to Hong Kong

Ship to Hong Kong: no postal code, and the district as a code from the catalog.

Hong Kong has no postal code, and you ship to it from another country: it is a destination only. An address needs a three-letter district code and 000 in postalCode.

At a glance

Postal codeNone. Send 000: postalCode is required in every country
DistrictA three-letter code, in state: HCW for Central and Western
CityFree text: Central
House numbernumber, required to create a label
Tax IDOptional
OriginA destination only. Ship to Hong Kong from another country
In sandboxDHL runs the full cycle from Mexico

What an address to Hong Kong needs

The fields of a Hong Kong address. Where the address form (GET /generic-form?country_code=HK&form=address_info) differs, the table says so:

FieldRequiredWhat goes in it
streetyesQueen's Road Central
cityyesCentral — free text
stateyesA three-letter district code — HEA, KKC, NIS
postalCodeyesRequired by the API, although the form hides it. Send 000
numberyes, for the labelBuilding number. The sandbox's address form calls it streetNumber
identificationNumbernoOptional
referencenoFree text for the carrier

The districts

API reference → Get states by country

curl https://queries.envia.com/state?country_code=HK

16 entries — and Hong Kong has 18 districts. They carry no two-letter code — Hong Kong is one of twenty countries like that:

{ "name": "Eastern", "code_2_digits": null, "code_3_digits": "HEA", "country_code": "HK" }

Send code_3_digits. A district name is too long for state, which accepts two to three characters.

Southern and Wan Chai are not in the catalog. For an address in either, send the adjacent district the parcel routes through — Eastern (HEA) or Central and Western (HCW) — and write the real district in reference, which the carrier reads.

Trim district names before you compare them. One comes back with a trailing tab: "Tai Po\t". Matching on code_3_digits avoids it.

Do not use GET /provinces/{state_code} for Hong Kong: it has nothing for it, and it searches every country at once.

All 16 districts and their codes
CodeName
HCWCentral and Western
HEAEastern
NISIslands
KKCKowloon City
NKTKwai Tsing
KKTKwun Tong
NNONorth
NSKSai Kung
NSTSha Tin
KSSSham Shui Po
NTPTai Po
NTWTsuen Wan
NTMTuen Mun
KWTWong Tai Sin
KYTYau Tsim Mong
NYLYuen Long

The list comes from GET /state?country_code=HK.

A complete address

{
  "name": "Wong Mei Ling",
  "email": "[email protected]",
  "phone": "+852 0000 0000",
  "street": "Queen's Road Central",
  "number": "99",
  "city": "Central",
  "state": "HCW",
  "postalCode": "000",
  "country": "HK"
}

postalCode needs at least three characters, so an empty string fails.

Ship it, end to end

One shipment from start to finish: Mexico City → Central, Hong Kong, with DHL. Hong Kong is not among the countries Envia ships from, so the lane is international. Every request runs as written in sandbox, with the address above as the destination; only the tracking number is a placeholder.

Find the carriers that serve the lane

API reference → Get Carriers With Services

curl https://queries.test.envia.com/available-carrier/MX/1/1 \
  --header "Authorization: Bearer $ENVIA_TOKEN"

MX/1/1 reads: from Mexico, international (1), parcel (1). Each carrier comes with the services you can pass when you create the label.

Quote

API reference → Get Shipping Rates

curl --request POST \
  --url https://api-test.envia.com/ship/rate/ \
  --header "Authorization: Bearer $ENVIA_TOKEN" \
  --header "Content-Type: application/json" \
  --data @- <<'JSON'
{
  "origin": {
    "name": "Bodega CDMX",
    "company": "Tienda Demo",
    "email": "[email protected]",
    "phone": "+52 55 0000 0000",
    "street": "Avenida Insurgentes Sur",
    "number": "1602",
    "district": "Credito Constructor",
    "city": "Ciudad de Mexico",
    "state": "CX",
    "postalCode": "03940",
    "country": "MX"
  },
  "destination": {
    "name": "Wong Mei Ling",
    "email": "[email protected]",
    "phone": "+852 0000 0000",
    "street": "Queen's Road Central",
    "number": "99",
    "city": "Central",
    "state": "HCW",
    "postalCode": "000",
    "country": "HK"
  },
  "packages": [
    {
      "content": "Leather wallet",
      "amount": 1,
      "type": "box",
      "weight": 0.5,
      "insurance": 0,
      "declaredValue": 85,
      "weightUnit": "KG",
      "lengthUnit": "CM",
      "dimensions": {
        "length": 20,
        "width": 15,
        "height": 5
      },
      "items": [
        {
          "description": "Handmade leather wallet",
          "productCode": "4202.31",
          "quantity": 1,
          "price": 85,
          "countryOfManufacture": "MX"
        }
      ]
    }
  ],
  "shipment": {
    "carrier": "dhl",
    "type": 1
  },
  "settings": {
    "currency": "USD"
  },
  "customsSettings": {
    "dutiesPaymentEntity": "envia_guaranteed",
    "exportReason": "sale"
  }
}
JSON

shipment.carrier takes one carrier per request; call it once per carrier to compare. Prices come back in settings.currency.

{
  "meta": "rate",
  "data": [
    {
      "carrier": "dhl",
      "service": "int_express",
      "serviceDescription": "DHL Express Worldwide",
      "deliveryEstimate": "Día siguiente",
      "totalPrice": 52.09,
      "currency": "USD"
    }
  ]
}

deliveryEstimate is text for a person, in Spanish as the carrier sends it. Show it as is.

Values are in your account's currency. declaredValue and items[].price are read in your account's currency, not in settings.currency. From a Mexican account, 85 declares MXN 85, about USD 4.75; to declare a USD 85 wallet, send 1520. With envia_guaranteed, the two values must agree within 15%, or the label is refused with 1212.

The body goes in through a heredoc because the street has an apostrophe: Queen's Road would end a single-quoted --data '…' halfway. Send any address with an apostrophe the same way, or read the body from a file.

Create the label

API reference → Generate a Shipping Label

curl --request POST \
  --url https://api-test.envia.com/ship/generate/ \
  --header "Authorization: Bearer $ENVIA_TOKEN" \
  --header "Content-Type: application/json" \
  --data @- <<'JSON'
{
  "origin": {
    "name": "Bodega CDMX",
    "company": "Tienda Demo",
    "email": "[email protected]",
    "phone": "+52 55 0000 0000",
    "street": "Avenida Insurgentes Sur",
    "number": "1602",
    "district": "Credito Constructor",
    "city": "Ciudad de Mexico",
    "state": "CX",
    "postalCode": "03940",
    "country": "MX"
  },
  "destination": {
    "name": "Wong Mei Ling",
    "email": "[email protected]",
    "phone": "+852 0000 0000",
    "street": "Queen's Road Central",
    "number": "99",
    "city": "Central",
    "state": "HCW",
    "postalCode": "000",
    "country": "HK"
  },
  "packages": [
    {
      "content": "Leather wallet",
      "amount": 1,
      "type": "box",
      "weight": 0.5,
      "insurance": 0,
      "declaredValue": 85,
      "weightUnit": "KG",
      "lengthUnit": "CM",
      "dimensions": {
        "length": 20,
        "width": 15,
        "height": 5
      },
      "items": [
        {
          "description": "Handmade leather wallet",
          "productCode": "4202.31",
          "quantity": 1,
          "price": 85,
          "countryOfManufacture": "MX"
        }
      ]
    }
  ],
  "shipment": {
    "carrier": "dhl",
    "service": "int_express",
    "type": 1
  },
  "settings": {
    "currency": "USD",
    "printFormat": "PDF",
    "printSize": "STOCK_4X6"
  },
  "customsSettings": {
    "dutiesPaymentEntity": "envia_guaranteed",
    "exportReason": "sale"
  }
}
JSON
{
  "meta": "generate",
  "data": [
    {
      "carrier": "dhl",
      "service": "int_express",
      "trackingNumber": "7000000001",
      "trackUrl": "https://test.envia.com/rastreo?label=7000000001&cntry_code=mx",
      "label": "https://…/dhl/7000000001.pdf",
      "totalPrice": 932.05,
      "currency": "MXN",
      "additionalFiles": [
        "https://…/commercial-invoice.pdf"
      ]
    }
  ]
}

The label is charged in your account's currency. The quote above is USD 52.09; a Mexican account is charged MXN 932.05.

An international label comes with the commercial invoice in additionalFiles. Print it with the label: customs reads it, not the label. items[] and its hsCode are what it is built from — see International Shipping & Customs.

Track it

API reference → Track Shipments

curl --request POST \
  --url https://api-test.envia.com/ship/generaltrack/ \
  --header "Authorization: Bearer $ENVIA_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "trackingNumbers": [
      "7000000001"
    ]
  }'

A label you just created answers "status": "Created". For anything at volume, subscribe to webhooks instead of polling.

Cancel it, if it does not ship

API reference → Cancel a Shipment

curl --request POST \
  --url https://api-test.envia.com/ship/cancel/ \
  --header "Authorization: Bearer $ENVIA_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "carrier": "dhl",
    "trackingNumber": "7000000001"
  }'

The response includes refundedAmount and balanceReturned: the charge returns to your balance.

International, into and out of Hong Kong

See International Shipping & Customs. Hong Kong is a separate customs territory from mainland China: a parcel between the two is an international shipment. To know whether a route needs items[] and a commercial invoice, ask What a route requires.

Testing in sandbox

Which carriers work for Hong Kong in sandbox
  • DHL runs the full cycle from Mexico.
  • FedEx quotes, and then refuses the label: origin not served for express.
  • No carrier quotes a domestic Hong Kong parcel.
  • trackUrl opens a tracking page that does not know sandbox shipments. It works for labels created in production.

In production you use the carriers enabled on your account.

Next steps


Did this page help you?