Two tools to put your clients on the map: geocoding, which finds the coordinates of an address, and road routing, which gives the distance, duration and shape of a route through 2 to 25 points.
Good to know
- Geocoding: the French national address base (Base Adresse Nationale) for France, then OpenStreetMap for other markets; without
country, France first. Five results at most, most likely first. - Routes: car profile.
geometryis the full shape, point by point: expect several hundred KB for a long route. Only ask for routes whose shape you display. - These services are shared: 30 calls a minute per organization, on top of the general limit (see rate limits). Cache addresses you have already geocoded.
- An upstream outage answers
502 geocode_unavailableor502 route_unavailable: retry with a growing delay.
Source and reuse
Addresses: Base Adresse Nationale (Licence Ouverte 2.0); elsewhere, and for routes: © OpenStreetMap contributors (ODbL), to be credited.
The Geocode object
| Field | Type | Description |
|---|---|---|
resultsalways present | object[] | 5 at most. |
results[].labelalways present | string | |
results[].latalways present | number | |
results[].lngalways present | number |
Geocode
{
"results": [
{
"label": "12 Rue de la République 69002 Lyon",
"lng": 4.835769,
"lat": 45.76511
},
{
"label": "Rue de la République 69001 Lyon",
"lng": 4.836016,
"lat": 45.76637
},
{
"label": "Place de la République 69002 Lyon",
"lng": 4.835689,
"lat": 45.760722
}
]
}The Route object
| Field | Type | Description |
|---|---|---|
distanceKmalways present | number | |
durationMinalways present | number | |
legsalways present | object[] | |
legs[].distanceKmalways present | number | |
legs[].durationMinalways present | number | |
geometryalways present | object[] | |
geometry[].latalways present | number | |
geometry[].lngalways present | number |
Route
{
"distanceKm": 465.9,
"durationMin": 298,
"legs": [
{
"distanceKm": 465.9,
"durationMin": 298
}
],
"geometry": [
{
"lat": 48.857243,
"lng": 2.352316
},
{
"lat": 48.857254,
"lng": 2.352327
},
{
"lat": 48.857283,
"lng": 2.352354
},
{
"lat": 45.763837,
"lng": 4.835663
}
]
}Geocode an address (France: national address base; other markets: OpenStreetMap)
GET
/v1/geocodeScope geo:readParameters
| Field | In | Type | Description |
|---|---|---|---|
qrequired | query | string1 to 200 characters | |
countryoptional | query | "fr" | "de" | "es" | "it" | "pt" | Absent: France (BAN) then every market. |
Response 200
OK — A Geocode object
Errors
| HTTP | Meaning |
|---|---|
400 | Invalid request |
401 | Missing, invalid or revoked API key |
403 | Forbidden (scope, plan or account status) |
404 | Resource not found |
429 | Too many requests |
500 | Internal error |
502 | Upstream service error |
Request
curl "https://api.floweet.com/v1/geocode?q=12%20rue%20de%20la%20R%C3%A9publique%2C%20Lyon" \
-H "Authorization: Bearer $FLOWEET_API_KEY"Response 200
{
"results": [
{
"label": "12 Rue de la République 69002 Lyon",
"lng": 4.835769,
"lat": 45.76511
},
{
"label": "Rue de la République 69001 Lyon",
"lng": 4.836016,
"lat": 45.76637
},
{
"label": "Place de la République 69002 Lyon",
"lng": 4.835689,
"lat": 45.760722
}
]
}Road route (car) through 2 to 25 points
POST
/v1/routesScope geo:readParameters
| Field | In | Type | Description |
|---|---|---|---|
Idempotency-Keyoptional | header | stringat most 255 characters | Unique key for this request (a new UUID v4, kept for its retries): the first response is replayed for 24 hours. |
Request body RouteInput
| Field | Type | Description |
|---|---|---|
pointsrequired | object[]2 to 25 items | |
points[].latrequired | numberfrom -90 to 90 | |
points[].lngrequired | numberfrom -180 to 180 |
Response 200
OK — A Route object
Errors
| HTTP | Meaning |
|---|---|
400 | Invalid request |
401 | Missing, invalid or revoked API key |
403 | Forbidden (scope, plan or account status) |
404 | Resource not found |
429 | Too many requests |
500 | Internal error |
502 | Upstream service error |
Request
curl -X POST "https://api.floweet.com/v1/routes" \
-H "Authorization: Bearer $FLOWEET_API_KEY" \
-H "Idempotency-Key: 6f1c2b0e-8d4a-4f7e-9a51-3c2d1e0f9b87" \
-H "Content-Type: application/json" \
-d '{
"points": [
{
"lat": 48.8566,
"lng": 2.3522
},
{
"lat": 45.764,
"lng": 4.8357
}
]
}'Response 200
{
"distanceKm": 465.9,
"durationMin": 298,
"legs": [
{
"distanceKm": 465.9,
"durationMin": 298
}
],
"geometry": [
{
"lat": 48.857243,
"lng": 2.352316
},
{
"lat": 48.857254,
"lng": 2.352327
},
{
"lat": 48.857283,
"lng": 2.352354
},
{
"lat": 45.763837,
"lng": 4.835663
}
]
}