Get Available Warehouses
Query the list of available warehouses for your account, including their location and address details.
GET
/client/warehouses/availablesThis endpoint allows you to get the supported warehouses for your account. Each warehouse has a unique ID that you must use when creating orders.
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/client/warehouses/availables \
-H "Authorization: Bearer YOUR_TOKEN"
const response = await fetch(
'https://apisandbox.eonwms.com/client/warehouses/availables',
{
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
}
);
const warehouses = await response.json();
// Display information for each warehouse
warehouses.data.forEach(warehouse => {
console.log(`Warehouse #${warehouse.id}: ${warehouse.name}`);
console.log(`Location: ${warehouse.municipality}, ${warehouse.state}, ${warehouse.country}`);
console.log(`Zip Code: ${warehouse.zipcode}`);
console.log('---');
});
import requests
response = requests.get(
'https://apisandbox.eonwms.com/client/warehouses/availables',
headers={
'Authorization': 'Bearer YOUR_TOKEN'
}
)
warehouses = response.json()
# Display information for each warehouse
for warehouse in warehouses['data']:
print(f"Warehouse #{warehouse['id']}: {warehouse['name']}")
print(f"Location: {warehouse['municipality']}, {warehouse['state']}, {warehouse['country']}")
print(f"Zip Code: {warehouse['zipcode']}")
print("---")
Responses
200Success - List of available warehouses
{
"data": [
{
"id": 1,
"name": "Chronos",
"country": "México",
"state": "San Luis Potosí",
"zipcode": "79526",
"municipality": "Villa de Reyes",
"neighborhood": "Logistik II",
"street": "Dubai",
"external_number": "112",
"internal_number": ""
}
]
}
401Unauthorized - Invalid token
{
"v": "EON_V2.0",
"fault": {
"arguments": {
"Authorization": "invalid"
},
"type": "InvalidAuthorizationException",
"message": "The request is unauthorized, the access token is invalid."
}
}
Response Structure
Each warehouse in the data array includes:
| Field | Type | Description |
|---|---|---|
| id | integer | Unique warehouse identifier |
| name | string | Warehouse name |
| country | string | Country where it's located |
| state | string | State or province |
| zipcode | string | Zip code |
| municipality | string | Municipality or city |
| neighborhood | string | Neighborhood or district |
| street | string | Street |
| external_number | string | External number |
| internal_number | string | Internal number (optional) |
Using the Warehouse ID
The warehouse id is required when creating orders:
// Example: Select warehouse for an order
const orderData = {
unique_order_number: "ORDER-123",
warehouse_id: "1", // Use the desired warehouse ID
shipping_service: "FEDEX",
// ... rest of the order data
};
Warehouses by Region
Mexico 🇲🇽
Warehouses in Mexico typically support:
- Carriers: FEDEX, YEGO, AFIMEX, TIUI
- National and international shipping
- COD (Cash on Delivery) services
United States 🇺🇸
Warehouses in USA typically support:
- Carriers: FEDEX, UPS, USPS
- Real-time rate calculation
- Domestic and international shipping
Use Cases
1. Automatic Selection of Nearest Warehouse
function selectNearestWarehouse(warehouses, destinationZipCode) {
// Simplified logic - in production you would use a geocoding API
const getRegion = (zip) => {
const firstDigit = zip.charAt(0);
if (['0', '1', '2'].includes(firstDigit)) return 'north';
if (['3', '4', '5'].includes(firstDigit)) return 'center';
return 'south';
};
const destinationRegion = getRegion(destinationZipCode);
// Filter warehouses by region
const nearbyWarehouses = warehouses.data.filter(wh => {
const warehouseRegion = getRegion(wh.zipcode);
return warehouseRegion === destinationRegion;
});
// If there are warehouses in the same region, use the first one
if (nearbyWarehouses.length > 0) {
return nearbyWarehouses[0].id;
}
// Otherwise, use the default warehouse
return warehouses.data[0].id;
}
2. Display Warehouse Selector to User
async function createWarehouseSelector() {
const response = await fetch(
'https://apisandbox.eonwms.com/client/warehouses/availables',
{
headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
}
);
const data = await response.json();
// Create HTML for selector
const options = data.data.map(wh => `
<option value="${wh.id}">
${wh.name} - ${wh.municipality}, ${wh.state} (${wh.country})
</option>
`).join('');
return `
<select id="warehouse-selector" class="form-control">
<option value="">Select a warehouse</option>
${options}
</select>
`;
}
3. Validate Service Availability
async function validateServiceInWarehouse(warehouseId, shippingService) {
// First get warehouse information
const response = await fetch(
'https://apisandbox.eonwms.com/client/warehouses/availables',
{
headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
}
);
const warehouses = await response.json();
const warehouse = warehouses.data.find(wh => wh.id === warehouseId);
if (!warehouse) {
return { valid: false, message: 'Warehouse not found' };
}
// Validate services by country
const servicesByCountry = {
'México': ['FEDEX', 'TIUI', 'YEGO', 'AFIMEX'],
'Estados Unidos': ['FEDEX', 'UPS', 'USPS'],
'USA': ['FEDEX', 'UPS', 'USPS']
};
const availableServices = servicesByCountry[warehouse.country] || [];
if (availableServices.includes(shippingService)) {
return { valid: true };
} else {
return {
valid: false,
message: `${shippingService} is not available in ${warehouse.country}`,
availableServices
};
}
}
Multi-Warehouse Configuration
If your account has access to multiple warehouses, consider:
Distribution Strategies
- By Geography: Use the warehouse closest to the customer
- By Inventory: Use the warehouse with available stock
- By Service: Use specific warehouses for certain carriers
- By Cost: Optimize based on shipping costs
Implementation Example
class WarehouseManager {
constructor(token) {
this.token = token;
this.warehouses = null;
}
async loadWarehouses() {
const response = await fetch(
'https://apisandbox.eonwms.com/client/warehouses/availables',
{
headers: { 'Authorization': `Bearer ${this.token}` }
}
);
this.warehouses = await response.json();
return this.warehouses;
}
getByCountry(country) {
return this.warehouses.data.filter(wh => wh.country === country);
}
getById(id) {
return this.warehouses.data.find(wh => wh.id === id);
}
getNearest(zipCode) {
// Implement proximity logic
// For now return the first one
return this.warehouses.data[0];
}
}
// Usage
const manager = new WarehouseManager('YOUR_TOKEN');
await manager.loadWarehouses();
const mexicoWarehouses = manager.getByCountry('México');
const mainWarehouse = manager.getById(1);
Optimization
Cache the warehouse list locally since it doesn't change frequently. Update it only when necessary or every 24 hours.
Warehouse Permissions
The warehouses shown are only those your account has access to. If you need access to additional warehouses, contact your account representative.