Download label (PDF)
Returns the PDF label of your order. The label can be obtained as long as the order is not cancelled and label_available is true.
GET /shipments/{id}/label
- Key Permission:
labels:read - Key: test or live
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id |
string | yes | Order number or tracking number (in the address). |
In the address {id} is the order number (field id from the response) or tracking number.
Important to know
- В ответе файл PDF (
Content-Type: application/pdf), а не JSON. Ошибки приходят в обычном JSON-формате. - Только для вашего заказа с готовым лейблом: у чужого заказа 404, у отменённого или ещё не готового 409.
Request example
curl -o label.pdf https://api.shippickup.com/v1/shipments/4f2a9c1e7b3d48a6c5e0f1d2b3/label \
-H "Authorization: Bearer $SHIPPICKUP_API_KEY"<?php
$ch = curl_init('https://api.shippickup.com/v1/shipments/4f2a9c1e7b3d48a6c5e0f1d2b3/label');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('SHIPPICKUP_API_KEY')],
]);
$pdf = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) === 200) {
file_put_contents('label.pdf', $pdf);
}
import os
import requests
r = requests.get(
"https://api.shippickup.com/v1/shipments/4f2a9c1e7b3d48a6c5e0f1d2b3/label",
headers={"Authorization": "Bearer " + os.environ["SHIPPICKUP_API_KEY"]},
timeout=30,
)
if r.status_code == 200:
open("label.pdf", "wb").write(r.content)
import { writeFile } from "node:fs/promises";
const res = await fetch("https://api.shippickup.com/v1/shipments/4f2a9c1e7b3d48a6c5e0f1d2b3/label", {
headers: { Authorization: `Bearer ${process.env.SHIPPICKUP_API_KEY}` },
});
if (res.status === 200) {
await writeFile("label.pdf", Buffer.from(await res.arrayBuffer()));
}
Response example 200
HTTP
HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Disposition: attachment; filename="label-4f2a9c1e7b3d48a6c5e0f1d2b3.pdf"
Cache-Control: private, no-store
%PDF-1.4 ...Possible errors
| HTTP | Code | Description |
|---|---|---|
| 404 | not_found | Object not found among your account's objects (order, address, invoice, webhook, member, or team invitation), or the order has no active pickup, or the method does not exist. Objects belonging to others appear as non-existent. |
| 409 | conflict | Action is currently not possible for this order (e.g., order cannot be canceled or pickup already ordered). Reason text in error.message. |
| 403 | insufficient_scope | Key lacks the required permission, specified in error.details.required_scope. |
| 429 | rate_limited | Key request limit exceeded. Retry after the time specified in the Retry-After header. |