Get Shipping Label Download Links
Get the links to download shipping labels associated with a specific order. Labels are only available for 90 days after creation.
GET
/v1/client/shipment/label_path/:unique_order_numberThis endpoint provides a list of URLs to download the labels associated with the requested order. Labels will only be available 90 days after their creation.
Headers
| Parameter | Type | Required | Description |
|---|---|---|---|
Authorization | string | β Yes | Bearer token obtained from /token/generate endpoint |
Examples
- cURL
- JavaScript
- Python
curl -X GET https://apisandbox.eonwms.com/v1/client/shipment/label_path/Order-12345 \
-H "Authorization: Bearer YOUR_TOKEN"
const uniqueOrderNumber = 'Order-12345';
const response = await fetch(
`https://apisandbox.eonwms.com/v1/client/shipment/label_path/${uniqueOrderNumber}`,
{
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
}
);
const labelData = await response.json();
// Download each label
for (const label of labelData.shipment.data) {
console.log(`Format: ${label.format}`);
console.log(`Download URL: ${label.url}`);
// Download the label
const labelResponse = await fetch(label.url, {
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
});
if (labelResponse.ok) {
const blob = await labelResponse.blob();
// Save or display the label
}
}
import requests
from datetime import datetime
unique_order_number = 'Order-12345'
# Get download links
response = requests.get(
f'https://apisandbox.eonwms.com/v1/client/shipment/label_path/{unique_order_number}',
headers={
'Authorization': 'Bearer YOUR_TOKEN'
}
)
label_data = response.json()
if response.status_code == 200:
shipment = label_data['shipment']
print(f"Order: {shipment['unique_order_number']}")
print(f"Tracking: {shipment['master_tracking']}")
print(f"Expires: {shipment['expiration_date']}")
# Download each label
for label in shipment['data']:
print(f"\nDownloading label in {label['format']} format...")
# Download file
label_response = requests.get(
label['url'],
headers={'Authorization': 'Bearer YOUR_TOKEN'}
)
if label_response.status_code == 200:
# Save file
filename = f"{unique_order_number}_{shipment['master_tracking']}.{label['format'].lower()}"
with open(filename, 'wb') as f:
f.write(label_response.content)
print(f"Label saved as: {filename}")
else:
print(f"Error: {label_data['fault']['message']}")
Responses
200Success - Download links available
{
"shipment": {
"unique_order_number": "VALID-IDENTIFIER",
"master_tracking": "000000000000",
"expiration_date": "2024-11-27",
"data": [
{
"format": "PNG",
"url": "https://apisandbox.eonwms.com/v1/client/shipment/label/download/VALID-IDENTIFIER/000000000000.png"
}
]
}
}
404Not found - Order doesn't exist
{
"code": 404,
"fault": {
"arguments": {
"unique_order_number": "invalid"
},
"type": "shipmentNotFound",
"message": "Shipment not found."
}
}
422Unprocessable - Label expired
{
"code": 422,
"fault": {
"arguments": null,
"type": "get_label.expired",
"message": "The label is no longer available, the order has expired."
}
}
Response Structureβ
Shipment Informationβ
- unique_order_number: Unique order number
- master_tracking: Master tracking number
- expiration_date: Label expiration date (YYYY-MM-DD format)
Download Linksβ
The data array contains download links:
- format: File format (usually "PNG")
- url: Full URL to download the label
Authentication Required
Download URLs also require the Bearer token in the Authorization header. They are not public links.
Important Considerationsβ
Label Expirationβ
Labels are valid for 90 days from creation:
// Check if label is about to expire
function checkExpiration(expirationDate) {
const expires = new Date(expirationDate);
const today = new Date();
const daysRemaining = Math.floor((expires - today) / (1000 * 60 * 60 * 24));
if (daysRemaining < 0) {
return { expired: true, message: "Label has already expired" };
} else if (daysRemaining < 7) {
return {
expired: false,
message: `Warning! Label expires in ${daysRemaining} days`
};
}
return { expired: false, daysRemaining };
}
Available Formatsβ
Currently, labels are provided in:
- PNG: Standard image format
- Recommended print resolution: 300 DPI
- Typical size: 4" x 6"
Multiple Labelsβ
An order may have multiple labels if:
- The shipment requires multiple packages
- Return labels were generated
- There's additional documentation (like customs labels)
Complete Implementation Exampleβ
Download and Display Label in Browserβ
async function displayLabel(uniqueOrderNumber) {
try {
// 1. Get label URLs
const response = await fetch(
`https://apisandbox.eonwms.com/v1/client/shipment/label_path/${uniqueOrderNumber}`,
{
headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
}
);
if (!response.ok) {
throw new Error('Could not get labels');
}
const data = await response.json();
// 2. Check expiration
const expiration = checkExpiration(data.shipment.expiration_date);
if (expiration.expired) {
alert('Labels have expired');
return;
}
// 3. Download and display each label
for (const label of data.shipment.data) {
const labelResponse = await fetch(label.url, {
headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
});
const blob = await labelResponse.blob();
const imgUrl = URL.createObjectURL(blob);
// 4. Display in new window
const window = window.open('', '_blank');
window.document.write(`
<html>
<head>
<title>Label ${uniqueOrderNumber}</title>
<style>
@media print {
body { margin: 0; }
img { max-width: 100%; }
}
</style>
</head>
<body>
<img src="${imgUrl}" alt="Shipping label">
<script>
window.print();
</script>
</body>
</html>
`);
}
} catch (error) {
console.error('Error:', error);
alert('Error getting labels');
}
}
Batch Download Labelsβ
async function batchDownloadLabels(orders) {
const results = [];
for (const order of orders) {
try {
const response = await fetch(
`https://apisandbox.eonwms.com/v1/client/shipment/label_path/${order}`,
{
headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
}
);
if (response.ok) {
const data = await response.json();
results.push({
order,
success: true,
urls: data.shipment.data
});
} else {
results.push({
order,
success: false,
error: 'Not available'
});
}
} catch (error) {
results.push({
order,
success: false,
error: error.message
});
}
}
return results;
}
Use Casesβ
1. Label Reprintingβ
When a customer needs to reprint a lost or damaged label.
2. Print System Integrationβ
Automate label download and printing in your fulfillment center.
3. Digital Archiveβ
Maintain a digital backup of all generated labels.
Best Practices
- Cache URLs: URLs remain the same during the label's lifetime
- Implement retries: In case of network failure when downloading
- Check expiration: Before attempting to download
- Save locally: To avoid multiple downloads of the same label