Zones are the geographic building blocks of the Ship Quote rate engine. Each zone groups one or more destination province admin codes under a single name — for example, Cayco’s ZONA 1 covers only Madrid (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/plantasur-dev/ship-quote/llms.txt
Use this file to discover all available pages before exploring further.
ES-M), while its ZONA 7 spans eight north-western provinces. When a quote request arrives with a destination postal code or province, the engine resolves the province’s admin code, finds the matching zone for the active agency, and uses that zone name to look up the correct price row in the agency’s rate table.
Postal code exceptions — which override the default zone for specific postal code ranges within a province — are stored in a separate ZoneRules collection, not on the zone document itself. Tecum, for example, redirects certain postal codes in Guadalajara (ES-GU) to ZONA 2 instead of the province’s default zone, enabling fine-grained pricing for rural or remote areas. See the bootstrap reference below for sample ZoneRules data.
Each zone is agency-scoped via
agencyId. An agency’s zone set must be complete — every province it serves should be covered by at least one zone, otherwise the rate engine will return no quote for destinations in uncovered provinces.POST /api/v1/zones
Create a new zone for an agency. ThepricingMode and volumetric fields are set to their model defaults on creation; use the bootstrap utilities to set custom values during data seeding.
Request body
MongoDB ObjectId of the agency this zone belongs to.
Zone identifier as it appears in the agency’s rate table (e.g.
"ZONA 1", "ZONA 3", "ZONA 21", "NACIONAL"). This value is used verbatim as the lookup key when pricing a shipment.List of province admin full codes covered by this zone. Each entry must be a string in the format
"CC-ADMINCODE" matching the adminFullCode field in the locations collection (e.g. "ES-M" for Madrid, "ES-B" for Barcelona). A zone may cover multiple provinces or none (for special zones such as international or unassigned tiers).Controls which rate table the engine consults when pricing a shipment destined for this zone. Accepted values:
"pallet"— use the pallet rate table (default)"parcel"— use the parcel rate table
Response — 201 Created
MongoDB ObjectId of the newly created zone.
ObjectId of the owning agency. The
GET endpoints populate this with name and code from the agency document.Zone name as stored.
Array of province admin full codes covered by this zone.
"pallet" or "parcel".Volumetric weight configuration for this zone.
Internal pricing configuration applied by the engine for this zone. Set automatically by the server; not accepted as a POST request body field.
ISO 8601 creation timestamp.
ISO 8601 last-updated timestamp.
Error responses
| Status | Condition |
|---|---|
400 Bad Request | agencyId or name is missing, or the request body is malformed. |
Examples
GET /api/v1/zones
Return all zones across all agencies. TheagencyId field is populated with the agency’s name and code for convenience. Returns 404 when no zone documents exist in the collection.
Response — 200 OK
An array of zone objects. Each object matches thePOST 201 response shape above, with agencyId expanded to include name and code.
Example
GET /api/v1/zones/:zoneId
Retrieve the details of a single zone by its MongoDB ObjectId. TheagencyId field is populated with the agency’s name and code.
Path parameters
MongoDB ObjectId of the zone to retrieve.
Response — 200 OK
A single zone object (same shape as thePOST 201 response, with agencyId populated).
Error responses
| Status | Condition |
|---|---|
404 Not Found | No zone document exists with the given zoneId. |
Example
Bootstrap reference — real zone definitions
The tables below show the zones loaded by the built-in seed data for Cayco and Tecum, giving concrete examples of how province admin codes are grouped into pricing tiers.Cayco zones
| Zone | Provinces | Pricing mode |
|---|---|---|
| ZONA 1 | ES-M | weight |
| ZONA 2 | ES-TO | weight |
| ZONA 3 | ES-AV, ES-GU, ES-SG, ES-VA | weight |
| ZONA 4 | ES-VI, ES-A, ES-BU, ES-CS, ES-LE, ES-LO, ES-MU, ES-SA, ES-SO, ES-TE, ES-V, ES-Z, ES-CR | weight |
| ZONA 5 | ES-O, ES-S, ES-CU, ES-SS, ES-NA, ES-BI, ES-P, ES-AB, ES-ZA | weight |
| ZONA 6 | ES-B, ES-HU, ES-T | weight |
| ZONA 7 | ES-C, ES-GI, ES-LU, ES-OR, ES-PO, ES-CC, ES-BA, ES-L | weight |
| ZONA 11 | ES-AL, ES-J, ES-MA | weight_volume (Andalucia) |
| ZONA 12 | ES-SE, ES-CO | weight_volume (Andalucia) |
Tecum zones
| Zone | Provinces |
|---|---|
| ZONA 1 | ES-GU, ES-M |
| ZONA 2 | ES-SO, ES-TO |
| ZONA 3 | ES-AV, ES-BU, ES-LO, ES-SG, ES-VA, ES-Z |
| ZONA 4 | ES-VI, ES-HU, ES-LE, ES-NA, ES-P, ES-SA, ES-TE, ES-V, ES-ZA |
| ZONA 5 | ES-CS, ES-SS, ES-L, ES-O, ES-S, ES-T, ES-BI |
| ZONA 6 | ES-B, ES-CC |
| ZONA 7 | ES-C, ES-GI, ES-LU, ES-OR, ES-PO |
| ZONA 8 | (empty — reserved tier) |
| ZONA 9 | ES-IB-ML |
| ZONA 10 | ES-IB-IB, ES-IB-MN |
| ZONA 11 | ES-GC-GC, ES-TF-TE |
| ZONA 12 | ES-GC-FU, ES-GC-LA, ES-TF-LP, ES-TF-LG, ES-TF-EH |
| ZONA 13 | PT-Madeira |
| ZONA 14 | PT-São Miguel |
| ZONA 16 | ES-GR |
| ZONA 17 | ES-GR |
| ZONA 21 | ES-J |
| ZONA 22 | ES-CO |
| ZONA 23 | ES-AB, ES-AL, ES-CR, ES-SE, ES-MA |
| ZONA 24 | ES-BA, ES-CU, ES-H, ES-MU |
| ZONA 25 | ES-A, ES-CA |
ZONA 16 and ZONA 17 both list
ES-GR (Granada) as their province. The engine uses ZoneRules postal code range records to decide which of the two zones applies to a given Granada postal code — postal codes 18001–18330 route to ZONA 16; all other Granada addresses resolve to ZONA 17.Tecum ZoneRules — postal code range overrides (sample)
Postal code exceptions are stored in the ZoneRules collection, not on the zone document. Each ZoneRules record links a province, a target zone, and an array of postal code ranges. The sample below shows the Guadalajara (ES-GU) and León (ES-LE) overrides loaded by the Tecum bootstrap.