Skip to main content

6. Print Label API

This API provides printing label for the package order in PDF format.

info

This label can be pasted on the physical package and it contains the order details. E.g: barcode, shipping addresses, label id, ...

  • GHTK provides 2 types of order labels: portrait and landscape.
  • Supported sizes: A5 or A6 (default).

Label samples

Sample for A5 landscape

Sample for A5 portrait

Request

Endpoint

GET /services/label/{TRACKING_ORDER}?original={ORIGINAL}&paper_size={PAPER_SIZE}

Headers

Token: {API_TOKEN}
X-Client-Source: {PARTNER_CODE}

Parameters

ParameterMandatory (Y/N)Description
TRACKING_ORDERYGHTK’s reference ID (order.label)
ORIGINALNString - Label printing type: portrait (vertical) or landscape (horizontal) (default is portrait).
PAPER_SIZENString - Label size: A5, A6 (default is A6).

Code

GET /services/label/{TRACKING_ORDER} HTTP/1.1
Token: {API_TOKEN}
X-Client-Source: {PARTNER_CODE}

Response

The system will return the result as a binary PDF file. The returned result is described as follows:

Successful request

HTTP/1.1 200 OK
tuneContent-Type: application/pdf
Content-Disposition: attachment; filename=""
shareContent-Transfer-Encoding: binary

Failed response

Failed response: label id is not recognized or cannot be found

{
"success": false,
"message": "Mã vận đơn không hợp lệ, không tìm thấy vận đơn",
"error_code": "40102",
"log_id": "..."
}