Skip to main content

Developers · Postal API

Postal API, specification v1

HTTPS and JSON. Field names in snake_case, dates as YYYY-MM-DD, money as a decimal string. We validate each item in the same request, so the response is the result.

Specification v1PlannedThe endpoints are planned. We open a sandbox for each client before production.

Basics

Basics
ItemValue
Productionhttps://api.alliedchb.com/v1
Sandboxhttps://api-test.alliedchb.com/v1
AuthenticationHeaders X-Client-Id and X-Client-Secret, one pair for each environment. We send the secret by a secure channel.
TracingOptional header X-Request-Id.
IdempotencyBy item_id: a second POST of the same S10 number returns DUPLICATE.
Batch size1 to 5,000 items in each request.
Schemapostal-items.v1.json (JSON Schema 2020-12).

Endpoints

  • POST/v1/itemsSend a batch of items. Each item gets its own result.
  • GET/v1/items/{item_id}The status history of one item: the entry number, the CBP and FDA events and the duty.
  • GET/v1/healthService check. No authentication.

Send a batch

The same request in three languages. The body is a postal-items.v1 batch.
curl -X POST https://api-test.alliedchb.com/v1/items \  -H "X-Client-Id: $ALLIED_CLIENT_ID" \  -H "X-Client-Secret: $ALLIED_CLIENT_SECRET" \  -H "Content-Type: application/json" \  --data @postal-items.v1.example.json

Response: one result for each item

200 OK · application/json
{  "batch_ref": "POST-DISPATCH-2026-10-01-A",  "results": [    {      "item_id": "CP123456785CA",      "result": "ACCEPTED",      "route": "ET13",      "ace_bill": { "mode": "AIR", "bill_type": "R", "issuer": "", "number": "SFPCP123456785CA" },      "warnings": [],      "field_errors": []    }  ]}

Errors

A request that fails as a whole gets this envelope. A problem with one item comes back in the result of that item.
Errors
HTTPErrorWhen
400INVALID_JSONThe body is not valid JSON.
401UNAUTHORIZEDThe client ID or the secret is missing or incorrect.
422VALIDATION_ERRORThe batch does not match the schema. field_errors gives each problem.
429RATE_LIMITEDToo many requests. Wait, then send again.
500SERVER_ERROROur error. Send the same batch again: a repeated item returns DUPLICATE.
422 · VALIDATION_ERROR
{  "error": "VALIDATION_ERROR",  "message": "The batch does not match postal-items.v1.json",  "field_errors": [    { "field": "items[3].contents[0].hs_code", "code": "SCHEMA", "message": "required" }  ]}

Validation codes

We check each item against these rules.
Validation codes
CodeRuleResult
SCHEMAThe item matches postal-items.v1.json.Reject
S10_FORMAT2 letters, 8 digits, 1 check digit and a 2-letter country code.Reject
S10_CHECK_DIGITWeights 8 6 4 2 3 5 9 7. A result of 10 becomes 0, and 11 becomes 5.Reject
ZIP_UNKNOWNThe addressee ZIP code is a valid U.S. ZIP code.Reject
S10_US_ISSUEDThe number ends in US, so USPS issued it. Entry type 13 needs the number from the foreign post.Warning
OVER_2500The item value is over $2,500 at the CBP exchange rate.Formal entry
DUPLICATEWe already have this S10 number.Duplicate

Status list

The status of an item in GET /v1/items/{item_id}.
Status list
StatusMeaning
RECEIVEDWe have the item data.
VALIDATEDThe item passed the checks.
FILEDWe sent the entry to CBP. The entry number is in the response.
CBP_RELEASEDCBP released the item.
CBP_HOLDCBP holds the item.
FDA_HOLDFDA holds the item for review.
FDA_MAY_PROCEEDFDA released the item.
REJECTEDThe item failed a check. The response gives each problem.

Start with a data test

Send us a sample dispatch in JSON, CSV or Excel. We report each gap in the data before the first entry. Quote on request.

Call (908) 291-8001 or email mail@alliedchb.com