Create Order with Previously Created Label
Create a new fulfillment order by providing a previously created shipping label. This endpoint also allows you to attach order-related files in PDF format that will be included in the shipment.
Request Format
This endpoint uses multipart/form-data instead of JSON. Make sure to configure your HTTP client correctly.
POST
/shipment/create_with_labelThis endpoint allows you to create a new fulfillment order by providing a previously created shipping label. You must include the Bearer token obtained previously in the request header.
Headers
| Parameter | Type | Required | Description |
|---|---|---|---|
Authorization | string | β Yes | Bearer token obtained from /token/generate endpoint |
Content-Type | string | β Yes | Must be multipart/form-data |
Accept | string | β Yes | Must be application/json |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
cod | boolean | β Yes | Define if the order is COD (cash on delivery) or regular |
unique_order_number | string | β Yes | Identification code provided by the seller (max: 12) |
invoice | string | β No | Defines the invoice number for the order (max: 45) |
shipping_service | string | β Yes | Name of the shipping service with which the label was previously generated (max: 20) |
warehouse_id | integer | β Yes | The ID of the warehouse from which the order will be fulfilled (max: 10) |
shipment_number | string | β Yes | Guide number for the order provided by the shipping service (max: 45) |
label | file | β Yes | PNG guide file provided by the shipping service (max. 3MB) |
consignee_name | string | β Yes | Customer's name (max: 70) |
consignee_country | string | β Yes | Customer's country of origin, Mexico by default (max: 20) |
consignee_state | string | β Yes | Customer's city/state of residence (max: 45) |
consignee_municipality | string | β Yes | Customer's municipality address (max: 35) |
consignee_neighborhood | string | β No | Customer's neighborhood address (max: 35) |
consignee_street | string | β Yes | Customer's street address (max: 25) |
consignee_external_number | string | β Yes | Customer's apartment or house external number (max: 5) |
consignee_internal_number | string | β No | Customer's apartment or house internal number (max: 5) |
consignee_zipcode | string | β Yes | Customer's zip code (max: 10) |
consignee_email | string | β No | Customer's email (max: 80) |
consignee_phone | string | β No | Customer's phone (max: 15) |
consignee_comments | string | β No | Customer comments about the order (max: 80) |
order_details | string | β Yes | A JSON in STRING format will be added in this field with the order details |
total_price | float | β Yes | Total order price, the total amount of the shipment must be entered (max: 5) |
attached_files[] | array | β No | An array of order-related files in PDF format (max. 5 files) |
Examples
- cURL
- JavaScript
- Python
curl -X POST https://apisandbox.eonwms.com/shipment/create_with_label \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Accept: application/json" \
-F "cod=false" \
-F "unique_order_number=TESTORDER02" \
-F "invoice=invoice01" \
-F "shipping_service=FEDEX" \
-F "warehouse_id=1" \
-F "shipment_number=0000000001" \
-F "label=@/path/to/your/label.png" \
-F "consignee_name=TEST CLIENT" \
-F "consignee_country=Mexico" \
-F "consignee_state=Mexico City" \
-F "consignee_municipality=Benito Juarez" \
-F "consignee_neighborhood=Del Valle" \
-F "consignee_street=Insurgentes Sur" \
-F "consignee_external_number=100" \
-F "consignee_internal_number=" \
-F "consignee_zipcode=03100" \
-F "consignee_email=test@test.com" \
-F "consignee_phone=5555555555" \
-F "consignee_comments=Deliver to reception" \
-F 'order_details=[{"quantity":1,"sku":"PRODUCT01","unit_price":100.0}]' \
-F "total_price=100.0" \
-F "attached_files[]=@/path/to/invoice.pdf"
// Create FormData for multipart/form-data
const formData = new FormData();
// Add basic fields
formData.append('cod', 'false');
formData.append('unique_order_number', 'TESTORDER02');
formData.append('invoice', 'invoice01');
formData.append('shipping_service', 'FEDEX');
formData.append('warehouse_id', '1');
formData.append('shipment_number', '0000000001');
// Add label file
const labelFile = document.getElementById('labelInput').files[0];
formData.append('label', labelFile);
// Add recipient data
formData.append('consignee_name', 'TEST CLIENT');
formData.append('consignee_country', 'Mexico');
formData.append('consignee_state', 'Mexico City');
formData.append('consignee_municipality', 'Benito Juarez');
formData.append('consignee_neighborhood', 'Del Valle');
formData.append('consignee_street', 'Insurgentes Sur');
formData.append('consignee_external_number', '100');
formData.append('consignee_internal_number', '');
formData.append('consignee_zipcode', '03100');
formData.append('consignee_email', 'test@test.com');
formData.append('consignee_phone', '5555555555');
formData.append('consignee_comments', 'Deliver to reception');
// Add order details as STRING
const orderDetails = JSON.stringify([
{
quantity: 1,
sku: 'PRODUCT01',
unit_price: 100.0
}
]);
formData.append('order_details', orderDetails);
formData.append('total_price', '100.0');
// Add attached files (optional)
const attachedFile = document.getElementById('attachmentInput').files[0];
if (attachedFile) {
formData.append('attached_files[]', attachedFile);
}
// Send request
const response = await fetch('https://apisandbox.eonwms.com/shipment/create_with_label', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Accept': 'application/json'
},
body: formData
});
const result = await response.json();
import requests
# Prepare files
files = {
'label': ('label.png', open('/path/to/your/label.png', 'rb'), 'image/png'),
'attached_files[]': ('invoice.pdf', open('/path/to/invoice.pdf', 'rb'), 'application/pdf')
}
# Prepare form data
data = {
'cod': 'false',
'unique_order_number': 'TESTORDER02',
'invoice': 'invoice01',
'shipping_service': 'FEDEX',
'warehouse_id': '1',
'shipment_number': '0000000001',
'consignee_name': 'TEST CLIENT',
'consignee_country': 'Mexico',
'consignee_state': 'Mexico City',
'consignee_municipality': 'Benito Juarez',
'consignee_neighborhood': 'Del Valle',
'consignee_street': 'Insurgentes Sur',
'consignee_external_number': '100',
'consignee_internal_number': '',
'consignee_zipcode': '03100',
'consignee_email': 'test@test.com',
'consignee_phone': '5555555555',
'consignee_comments': 'Deliver to reception',
'order_details': '[{"quantity":1,"sku":"PRODUCT01","unit_price":100.0}]',
'total_price': '100.0'
}
# Send request
response = requests.post(
'https://apisandbox.eonwms.com/shipment/create_with_label',
headers={
'Authorization': 'Bearer YOUR_TOKEN',
'Accept': 'application/json'
},
data=data,
files=files
)
# Close files
files['label'][1].close()
files['attached_files[]'][1].close()
result = response.json()
Responses
200Success - Order created with label
{
"status": "PLACED",
"message": "The order has been created with the provided label"
}
401Unauthorized - Invalid token
{
"v": "EON_V2.0",
"fault": {
"arguments": {
"Authorization": "invalid"
},
"type": "InvalidAuthorizationException",
"message": "The request is unauthorized, the access token is invalid."
}
}
422Unprocessable Entity - Validation error
{
"fault": {
"error": "invalid_label",
"error_description": "The label file is invalid or exceeds the maximum size"
}
}
Important Considerationsβ
order_details Format
The order_details field must be valid JSON but sent as a STRING. Example:
"[{\"quantity\":1,\"sku\":\"PRODUCT01\",\"unit_price\":100.0}]"
Attached Files
- The label must be in PNG format with a maximum size of 3MB
- Attached files must be PDF
- You can attach up to 5 additional PDF files
- Attached files will be physically included in the package
Differences with regular endpoint
This endpoint is useful when:
- You already have a label generated by the carrier
- You need to include physical documents in the shipment
- You manage your own carrier integration
Use Case Exampleβ
This endpoint is ideal for situations where:
- Direct carrier integration: You already have a direct account with FedEx, UPS, etc., and generate your own labels
- Special documentation: You need to include invoices, permits, or physical customs documentation
- Reshipments: When you need to use a previously generated label for a reshipment
Validationsβ
- The guide number (
shipment_number) must be unique - The label must be readable and in PNG format
- The shipping service must match the label's carrier
- PDF files must not exceed 5MB each