Label API

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)

{
  "consignmentId": "FW123456789",
  "format": "pdf",
  "labelData": "JVBERi0xLjQKJb/..."
}
 

Note: The labelData field contains a Base64-encoded string of the label file.
You can decode and save it as a .pdf, .zpl, or .png depending on the requested format.

 

Example (Decode in cURL)

curl -X GET "https://api.freightways.co.nz/v1/labels/FW123456789?format=pdf" \
  -H "x-api-key: your_api_key_here" \
  | jq -r '.labelData' | base64 --decode > label.pdf

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

 

Did this article answer your question?

Can't find the answer to your question?

Suggest an article