6. Order Label Printing API
This API is used to print the shipping label for GHTK orders
info
The order label is a sticker attached to the package, clearly displaying key order details such as the order code, barcode, product information, shipping method, ...
- GHTK provides two label formats: portrait (vertical) and landscape (horizontal)
- Supported paper sizes: A5 or A6 (A6 is the default)
Label Samples
A5 Landscape Label Sample:

A5 Portrait Label Sample:

Request
Hyperlink
GET /services/label/{TRACKING_ORDER}?original={ORIGINAL}&paper_size={PAPER_SIZE}
Headers
Token: {API_TOKEN}
X-Client-Source: {PARTNER_CODE}
Parameter
Parameter | Required | Description |
---|---|---|
TRACKING_ORDER | Yes | GHTK’s tracking code |
ORIGINAL | No | String - Label printing format portrait (vertical) or landscape (horizontal) (default is portrait) |
PAPER_SIZE | No | String - Paper size of A5 , A6 label (default is A6) |
Code
- HTTP
- CURL
- PHP
GET /services/label/{TRACKING_ORDER} HTTP/1.1
Token: {API_TOKEN}
X-Client-Source: {PARTNER_CODE}
curl -X GET -H "Token: {API_TOKEN}" \
-H "Token: {API_TOKEN}" \
-H "X-Client-Source: {PARTNER_CODE}" \
"https://services.giaohangtietkiem.vn/services/label/{TRACKING_ORDER}"
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://services.giaohangtietkiem.vn/services/label/{TRACKING_ORDER}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_HTTPHEADER => array(
"Token: APITokenSample-ca441e70288cB0515F310742",
),
));
$response = curl_exec($curl);
curl_close($curl);
echo 'Response: ' . $response;
?>
Response
Response
The system will return the result in binary file PDF format. The returned data is described as follows:
Success
HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Disposition: attachment; filename=""
Content-Transfer-Encoding: binary
When an error occurs
Returned result will be in JSON format
{
"success": false,
"message": "Mã vận đơn không hợp lệ, không tìm thấy vận đơn"
}