| Endpoint | Methods | Description |
|---|---|---|
/api/normalize | POST, GET | Normalize a free-text address. Optional match via ?match=true. For GET use ?address=.... |
/api/normalize/structured | POST, GET | Normalize a structured address (fields). Optional match via ?match=true. For GET pass structured fields as query params. |
POST or GET /api/normalize
Send a single address string. It is parsed into components. If match=true, an OpenStreetMap building lookup is performed and the first result is returned.
Content-Type: application/json
{
"address": "47 Glen Avenue, Newton, MA 02459"
}
Query: match (optional, boolean, default false) — if true, attempt OSM match and include best_result and photon_query.
Query: address (required), match (optional).
{
"input": "47 Glen Avenue, Newton, MA 02459",
"components": {
"house_number": "47",
"road": "Glen Avenue",
"city": "Newton",
"state": "MA",
"postcode": "02459"
},
"matched": false
}
Same fields plus best_result (first OpenStreetMap building: street, housenumber, postcode, city, state, country_code, lat, lon, osm_id, osm_type). matched is true if a result was found.
POST or GET /api/normalize/structured
Send address components. House number suffixes (e.g. 47a, 47 2, 47-2, 47 bis) are stripped for the OpenStreetMap lookup only.
Content-Type: application/json. At least one field required.
{
"house_number": "47 2",
"street": "Glen Avenue",
"city": "Newton",
"state": "MA",
"postcode": "02459",
"countrycode": "US"
}
Supported fields (POST body or GET query): house_number, housenumber, streetnumber, road, street, city, state, postcode, postalcode, countrycode. Use street or road; house_number/housenumber/streetnumber; postcode or postalcode.
Query: Same match parameter as above, plus any structured fields when using GET.
Same shape as free-text: input, components, and when match=true, photon_query, best_result, matched.
{"error": "message"} on server errors.