Dealer Locator API
Overview
The Dealer Locator API returns a list of dealers near a postal code, sorted by distance. Use it to power dealer finder pages on websites and apps. The response includes group identifiers so you can collapse multi-unit dealer groups on the client side.
dealers array (sorted by distance) instead of a single nearest_dealer object. If you previously used nearest_dealer, switch to dealers[0].
How It Works
Each brand maintains a territory map — a list of postal codes pre-assigned to specific dealers. When you call the API, the following priority chain determines what comes back:
- Territory match — if the queried postal code is assigned to a dealer in the territory map, that dealer is always returned first (
match_type: "territory", index 0), regardless of distance. This is the authorised dealer for that area. - Distance results — all other active dealers within
max_distance_milesare returned sorted by proximity (match_type: "distance"). For non-US/CA countries, all dealers in the country are returned with no distance cap. - Group siblings — if a dealer in the results belongs to a multi-location group (
group_id), any other locations from the same group that weren't already included are automatically appended (match_type: "group_sibling"). This ensures the caller always sees every location of a dealer company, even if some are outside the distance radius. - Global fallback — for non-US/CA queries that find zero dealers in the country, the brand's designated fallback contact (e.g. a headquarters or importer) is returned (
match_type: "fallback").
Endpoint
Authentication
Requests require the X-API-Token header with your API token:
X-API-Token: your_api_token_here
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| brand | string | Yes | Brand identifier slug (provided by your administrator) |
| postal_code | string | Yes | Postal code for the search location. US must be 5 digits (e.g. 90210); Canada must be in A1A 1A1 format; all other countries are accepted as-is. |
| country | string | Yes | ISO 3166-1 alpha-2 country code (e.g. US, CA, DE, BR). US and CA have strict postal code validation; all others are accepted as-is and geocoded via Google Maps. |
| limit | integer | No | Maximum number of dealers to return. Default 10, max 50. Applies to US and CA only — all dealers in the queried country are returned for other countries. |
| max_distance_miles | number | No | Filter out dealers farther than this distance (in miles). Default 250. Applies to US and CA only — ignored for other countries so no dealer is missed. |
Example Request
curl -X GET "https://api.marquatica.com/dealer-locator?brand=your_brand&postal_code=28117&country=US&limit=5" \
-H "X-API-Token: your_api_token_here"
Success Response
Dealers Found
{
"dealers": [
{
"address": "123 Marina Drive",
"address2": "",
"city": "Lakeside",
"country": "USA",
"dealer_code": "1001-1",
"distance_miles": 3.2,
"email": "info@lakesidemarine.com",
"group_id": 1001,
"group_name": "Lakeside Marine Group",
"id": 101,
"latitude": 35.5001,
"legal_name": "",
"logo_url": "",
"longitude": -80.85,
"match_type": "territory",
"name": "Lakeside Marine Group",
"phone": "(555) 123-4567",
"postal_code": "28117",
"primary_contact": "",
"state": "NC",
"territory_match": true,
"unit_id": 1,
"website": "https://www.lakesidemarine.com"
},
{
"address": "456 Waterfront Blvd",
"address2": "",
"city": "Hillside",
"country": "USA",
"dealer_code": "1001-2",
"distance_miles": 87.5,
"email": "info@lakesidemarine.com",
"group_id": 1001,
"group_name": "Lakeside Marine Group",
"id": 102,
"latitude": 36.12,
"legal_name": "Lakeside Marine LLC",
"logo_url": "",
"longitude": -81.23,
"match_type": "group_sibling",
"name": "Lakeside Marine - Hillside",
"phone": "(555) 987-6543",
"postal_code": "28031",
"primary_contact": "",
"state": "NC",
"territory_match": false,
"unit_id": 2,
"website": "https://www.lakesidemarine.com"
}
],
"success": true,
"version": "0.2.0"
}
No Dealers Found
{
"success": true,
"version": "0.2.0",
"dealers": []
}
Response Fields
| Field | Type | Description |
|---|---|---|
| success | boolean | Whether the request was successful |
| version | string | API version (semantic) |
| dealers | array | Dealers sorted by distance. Empty if no matches. |
| dealers[].id | integer | Unique dealer location identifier |
| dealers[].dealer_code | string | Human-readable unit code used in external systems (e.g. 1001-1, 1001-2). Empty string if not assigned. |
| dealers[].group_id | integer / null | Dealer company identifier. Shared across multiple units of the same dealer group (e.g., dealers with multiple physical locations). Null if not assigned. |
| dealers[].unit_id | integer / null | Sequential unit number within the group (1, 2, 3, ...). Null if not assigned. |
| dealers[].group_name | string | Public-facing group/company name (currently mirrors name). |
| dealers[].name | string | Dealer location name |
| dealers[].legal_name | string | Legal business name (may be empty) |
| dealers[].address | string | Street address |
| dealers[].address2 | string | Suite / unit (may be empty) |
| dealers[].city | string | City |
| dealers[].state | string | State or province abbreviation |
| dealers[].postal_code | string | Postal code |
| dealers[].country | string | Country (e.g., USA, CAN) |
| dealers[].phone | string | Public phone (may be empty) |
| dealers[].email | string | Public email (may be empty) |
| dealers[].website | string | Public website URL (may be empty) |
| dealers[].latitude | number | Dealer latitude |
| dealers[].longitude | number | Dealer longitude |
| dealers[].logo_url | string | Logo URL (may be empty) |
| dealers[].primary_contact | string | Primary contact name (may be empty) |
| dealers[].distance_miles | number | Distance from the searched postal code in miles |
| dealers[].match_type | string | "territory" — assigned to this postal code via the territory map (index 0, US/CA only). "distance" — within max_distance_miles (or all in-country dealers for non-US/CA). "group_sibling" — shares a group_id with an included dealer; always appended regardless of distance or limit. "fallback" — brand's global fallback contact; returned only for non-US/CA queries that find zero local dealers. |
| dealers[].territory_match | boolean | true only for the territory-assigned dealer. Always returned at index 0 with its real distance, regardless of max_distance_miles. |
Ordering Rules
- US / CA: territory match is always at index 0 (if one exists), followed by dealers within
max_distance_milessorted by ascending distance, truncated tolimit. - Other countries:
max_distance_milesandlimitare ignored. All active dealers in the queried country are returned sorted by distance, guaranteeing no dealer is missed regardless of geography. - Group siblings — after the primary list is built, any dealer sharing a
group_idwith an included dealer (but not yet in the list) is appended asmatch_type: "group_sibling", bypassing all filters. - Fallback — for non-US/CA queries that return zero dealers, the brand's designated global fallback dealer is appended as
match_type: "fallback".
Grouping Dealers on the Client
Some dealer companies operate multiple physical locations (units). They share the same group_id and have distinct unit_id values. The API returns one row per unit sorted by distance. To display a single card per company with selectable locations, group the results client-side by group_id (or by id for solo dealers with no group).
Error Response Examples
Missing Brand Parameter
{
"error": "Brand parameter is required",
"version": "0.2.0"
}
Invalid Postal Code Format
{
"error": "Invalid US postal code format. Must be exactly 5 digits (e.g., 12345)",
"version": "0.2.0"
}
Invalid Country Code
{
"error": "Invalid country code. Use US or CA",
"version": "0.2.0"
}
Invalid limit
{
"error": "limit must be an integer",
"version": "0.2.0"
}
Country Code Support
US— United States: strict 5-digit ZIP validation.max_distance_milesandlimitapply.CA— Canada: strict A1A 1A1 format validation.max_distance_milesandlimitapply.- All others (e.g.
DE,BR,AU) — postal code accepted as-is and geocoded via Google Maps. All dealers in the queried country are returned (no distance cap). If no dealers exist in the country, the brand's global fallback dealer is returned.
Notes
- Distances are calculated using the Haversine formula.
- Only dealers in the same country as the searched postal code are returned.
- Only active dealers with stored coordinates are included in results.
- The territory match is preserved at index 0 even when filtered out by
max_distance_miles.