API reference

Order & parcel label (PDF)

Download a printable label as a PDF, rendered from your organization's own default parcel label template (the full sticker). Address EITHER a single parcel — by its merchant_tracking (the sticker code) or its parcel_id (our parcel id, returned as items[].parcel_id on create), which prints that parcel's own data — OR a whole order by its order_id (the order's tracking number, returned as order_id on create), which prints a single ORDER label: the barcode, weight, dimensions and contents are all the order's (contents aggregated across its parcels). The response is the PDF itself (application/pdf, served inline), not JSON. Requires the labels:read scope, and only ever returns labels for your own orders (an unknown reference 404s).

Download a parcel label

GET/api/v1/orders/label

Query (send exactly one)

merchant_trackingstringoptional
The parcel's physical sticker code. Takes precedence over parcel_id.
parcel_idstringoptional
Our parcel id — the items[].parcel_id (Starmile tracking number) returned on create, e.g. STM0000000121.
order_idstringoptional
A whole order — the order's tracking number (returned as order_id on create), e.g. STM0000000120. Prints a single ORDER label: the scannable barcode is the order's tracking number and the weight, dimensions and contents are the order's (contents aggregated across its parcels), not any single parcel's.
# By merchant_tracking (the barcode you sent on create):
curl -G https://api.starmile.io/api/v1/orders/label \
  -H 'Authorization: Bearer <access_token>' \
  -H 'Accept: application/pdf' \
  --data-urlencode 'merchant_tracking=CN773300012345' \
  -o label.pdf

# Or by parcel_id (our parcel id — items[].parcel_id from the create response):
curl -G https://api.starmile.io/api/v1/orders/label \
  -H 'Authorization: Bearer <access_token>' \
  --data-urlencode 'parcel_id=STM0000000121' \
  -o label.pdf

# Or the whole ORDER's label by order_id — the order's tracking number:
curl -G https://api.starmile.io/api/v1/orders/label \
  -H 'Authorization: Bearer <access_token>' \
  --data-urlencode 'order_id=STM0000000120' \
  -o order-label.pdf