Rates & Territories
zr.territories, zr.rates, and zr.hubs cover geography and delivery pricing.
Territories
Filter by level (wilaya or commune). Live rows include the Arabic name (drift §9.2):
ts
const wilayas = await zr.territories.search({
pageSize: 100,
advancedFilter: { field: 'level', operator: 'eq', value: 'wilaya' },
});
console.log(wilayas.items[0]?.name, wilayas.items[0]?.nameArabic);
const communes = await zr.territories.search({
pageSize: 200,
advancedFilter: { field: 'level', operator: 'eq', value: 'commune' },
});Iterate everything with zr.territories.searchAll(body).
Rates
ts
// All effective rates for the current supplier.
const { rates } = await zr.rates.getAll(); // GetAllRatesResponse
// The effective rate for one destination territory (pickup-point / home / return prices):
const rate = await zr.rates.getForTerritory(toTerritoryId);
for (const price of rate.deliveryPrices ?? []) {
console.log(price.deliveryType, price.price);
}Deprecated pricing endpoints
zr.rates.getPriceList(id) and zr.rates.getSupplierSpecificPrices(supplierId) are @deprecated — prefer rates.getAll(), whose effective rates supersede price lists. They remain implemented for completeness.
Hubs
ts
const hubs = await zr.hubs.search({ pageSize: 50 });
// get is a POST-by-id operation with an options body:
const hub = await zr.hubs.get(id, { includeServices: true });A deliveryType: 'pickup-point' parcel needs a hubId — find a pickup-point hub here (drift §9.13).