Skip to main content

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 List Provinces endpoint returns the full catalogue of geographic province entries stored in Ship Quote. Each province object includes the two-digit postal prefix, the normalized name used for internal search, and the adminFullCode — a compound code like ES-GR or ES-M that you pass directly to POST /rates/compareByProvinceCode when you already know the destination province. The Spanish province dataset (all 52 provinces including the Balearic and Canary Islands) is seeded automatically on first startup and is served from an in-memory cache, so this endpoint returns results with no database query.

Endpoint

GET /api/v1/locations/provinces

Response

Returns HTTP 200 OK with a JSON array of province objects.
id
string
MongoDB ObjectId of the province document.
countryCode
string
Uppercased ISO-2 country code (e.g. ES).
countryName
string
Country name as stored (e.g. Spain).
adminCode
string
Short administrative region code (e.g. VI for Álava, AB for Albacete, M for Madrid). Used together with countryCode to build adminFullCode.
adminFullCode
string
Fully-qualified province code with country prefix (e.g. ES-VI, ES-AB, ES-M). This is the value you pass as province when calling POST /rates/compareByProvinceCode.
name
string
Display name of the province in Title Case (e.g. Álava, Albacete).
normalizedName
string
Lowercase, accent-stripped, underscore-separated version of the name used for internal indexing and search (e.g. alava, albacete).
postalCode
string
Two-digit postal prefix that identifies the province. For example, any 5-digit postal code beginning with 01 belongs to Álava, and any code beginning with 28 belongs to Madrid. Pass this prefix to GET /api/v1/locations/provincesByPostalCode/:postalCode for reverse lookup.
type
string
Geographic classification. For the seeded Spanish dataset this is always province. Custom entries may be state or region.
createdAt
string
ISO 8601 timestamp of when the document was created.
updatedAt
string
ISO 8601 timestamp of the most recent update.

Example

curl -X GET "http://localhost:3000/api/v1/locations/provinces"
Use the adminFullCode values from this response (e.g. ES-GR, ES-M) as the province field when calling POST /rates/compareByProvinceCode. This workflow is recommended when you already know the destination province — it skips the postal-code resolution step and gives you direct control over which province’s rate table is applied.
Province records are loaded into memory from MongoDB at server boot via loadProvinces() and stored in a Map keyed by two-digit postal prefix. The getProvinces() call behind this endpoint returns the full in-memory array — no additional database query is issued at request time.

Build docs developers (and LLMs) love