Skip to main content

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_number

This 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

ParameterTypeRequiredDescription
Authorizationstringβœ… YesBearer token obtained from /token/generate endpoint

Examples

curl -X GET https://apisandbox.eonwms.com/v1/client/shipment/label_path/Order-12345 \
-H "Authorization: Bearer YOUR_TOKEN"

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)

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
  1. Cache URLs: URLs remain the same during the label's lifetime
  2. Implement retries: In case of network failure when downloading
  3. Check expiration: Before attempting to download
  4. Save locally: To avoid multiple downloads of the same label