Places
Two endpoints for resolving pickup/dropoff locations: a PostGIS radius search and a typeahead autocomplete. Both feed `pickup_place_uuid` straight into POST /fleet/list.
GET /places — autocomplete
Cheap LIKE on the seeded `places` table. Returns up to limit (default 10, max 25) rows ordered by prefix-match then alphabetical. Cached for 5 minutes per (q, country, limit). Aliased at GET /api/v1/places/autocomplete for callers who prefer the more explicit name.
Request
bash
curl -s "https://greenflow.live/api/v1/places?q=miami&country=US&limit=5" \
-H "Authorization: Bearer gfc_7s2wprmy_DWTZRBGBEV6La4dTOoFdMkEhWmWCsXdwc3zVMnqP"
Response
json
{
"data": [
{
"uuid": "9566c9fe-a2d6-451b-a754-e2fee27a2c8f",
"name": "Miami Downtown",
"latitude": 25.77125531,
"longitude": -80.19186806,
"country_id": 254,
"country_code": "US",
"place_type": 2
}
]
}
GET /places/search — radius search
PostGIS `ST_DWithin` lookup over the `location` geography column. Pass `lat` + `lng` (required) and an optional `radius_km` (default 50, max 500). Each result includes the pivoted offices for that place so you can jump straight into POST /fleet/list.
Request
bash
curl -s "https://greenflow.live/api/v1/places/search?lat=-23.6273&lng=-46.6566&radius_km=25" \
-H "Authorization: Bearer gfc_7s2wprmy_DWTZRBGBEV6La4dTOoFdMkEhWmWCsXdwc3zVMnqP"
Response
json
{
"data": [
{
"uuid": "c31ec1ee-3fdf-4cb2-8445-6d07e82dacd0",
"name": "Congonhas Airport",
"latitude": -23.62799975,
"longitude": -46.65703389,
"distance_km": 0.089,
"place_type": 1,
"offices": [
{"code": "AACGH", "name": "AGENCIA AEROPORTO CONGONHAS", "brand_id": 11, "distance_km": 0.142}
]
}
]
}
Errors
| HTTP | Body | Cause |
|---|---|---|
| 401 | {"message": "Invalid API key"} | Missing or invalid Bearer token. |
| 422 | {"message": "The q field is required."} | Autocomplete needs `q` (min 2 chars). |
| 422 | {"message": "The lat field is required."} | Search needs both `lat` and `lng`. |