Label API
The Label API allows you to retrieve printable shipping labels for consignments created through the Freightways API. Labels can be requested in multiple formats such as PDF, ZPL, or PNG (depending on carrier and configuration).
Retrieve Label
Endpoint: GET /v1/labels/{consignmentId}
Description: Returns a base64-encoded or binary printable label for a consignment.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
consignmentId |
string | ✅ | Unique identifier of the consignment for which to retrieve the label |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
format |
string | ⛔️ Optional | Output format (pdf, zpl, png). Default: pdf
|
layout |
string | ⛔️ Optional | Label layout (FreThermal-174x100 FreThermal-150x100, A4,FreThermal). Default: FreThermal
|
Example Request
GET /v1/labels/FW123456789?format=pdf&layout=FREThermal174x100 HTTP/1.1
Host: api.freightways.co.nz
x-api-key: your_api_key_here
Accept: application/json
Response Example (200 OK)
Note: The
labelDatafield contains a Base64-encoded string of the label file.
You can decode and save it as a.zpl, or.pngdepending on the requested format.
Example (Decode in cURL)
Error Responses
| Code | Example | Description |
|---|---|---|
| 404 | Consignment not found | Invalid consignmentId
|
| 406 | Unsupported format | Format other than pdf, zpl, or png
|
| 500 | Label generation failed | Internal system error |