This is the primary rate comparison endpoint. Submit a destination postal code, a country code, and a list of shipment items and Ship Quote will auto-resolve the postal code to its corresponding province, determine whether the shipment is national or international, fan out requests to every active agency that covers that scope in parallel, and return a normalized per-agency result array. Both static (database-backed) and API-integrated agencies are queried simultaneously, so you always receive the most complete picture in a single call.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.
The
DEFAULT_COUNTRY environment variable controls which country code is treated as national. When the server is configured for Spain (DEFAULT_COUNTRY=ES), sending countryCode: "ES" triggers national agency matching; any other ISO-2 code triggers international agency matching.Endpoint
Middleware chain
Requests pass through three middleware layers before reaching the controller:| Order | Middleware | What it checks |
|---|---|---|
| 1 | schemaValidation | Request body must be present and non-empty |
| 2 | rateDestinationValidation | destinationPostalCode and countryCode must be non-null strings; when the country matches DEFAULT_COUNTRY, postal code must match the 5-digit format (\d{5}) |
| 3 | rateItemsValidation | items must be a non-empty array; each item must have a positive weight, positive large/width/height, and a valid typeServices value |
Request body
The destination postal code. Must be a 5-digit string when shipping within the default country (e.g.
"18001" for Granada, Spain). For international destinations the format constraint is relaxed.ISO 3166-1 alpha-2 country code for the destination (e.g.
"ES", "FR", "DE"). The value determines whether national or international agencies are queried.List of shipment items to price. Must contain at least one entry.
Response body
The response is a flat JSON array. Each element represents one active agency and its computed services.Array of per-agency result objects.
Examples
HTTP status codes
| Code | Meaning |
|---|---|
200 OK | Rate comparison completed. The array always contains one entry per active agency in scope, even when available is false. |
400 Bad Request | Validation failed. The response body contains a message field describing which field failed (e.g. "Postal Code invalid", "items cannot be empty", "Item 1: weight must be a number > 0"). |
404 Not Found | The postal code could not be resolved to a known province for the default country, or no rate comparison result was produced. |
500 Internal Server Error | An unhandled server-side error occurred. |
How scope detection works
The controller callsgetProvinceByPostalCode(destinationPostalCode) to resolve the province from an in-memory map loaded at server startup. If the country code matches DEFAULT_COUNTRY (default: ES) and no province is found, a 404 is returned immediately. For international shipments the province defaults to an empty string and international-scoped agencies are queried instead.
The rates service then calls getScope(countryCode), which returns "national" when countryCode === DEFAULT_COUNTRY and "international" otherwise. Only agencies whose rules.coverage array includes the detected scope are included in the comparison.