Skip to main content

Get Available Warehouses

Query the list of available warehouses for your account, including their location and address details.

GET/client/warehouses/availables

This 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

ParameterTypeRequiredDescription
Authorizationstring✅ YesBearer token obtained from /token/generate endpoint

Examples

curl -X GET https://apisandbox.eonwms.com/client/warehouses/availables \
-H "Authorization: Bearer YOUR_TOKEN"

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:

FieldTypeDescription
idintegerUnique warehouse identifier
namestringWarehouse name
countrystringCountry where it's located
statestringState or province
zipcodestringZip code
municipalitystringMunicipality or city
neighborhoodstringNeighborhood or district
streetstringStreet
external_numberstringExternal number
internal_numberstringInternal 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

  1. By Geography: Use the warehouse closest to the customer
  2. By Inventory: Use the warehouse with available stock
  3. By Service: Use specific warehouses for certain carriers
  4. 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.