Autocomplete
Suggestions while someone types, billed per session.
Send your key as key=YOUR_API_KEY on the address, or in the X-NWays-Api-Key header. API keys
Base address: https://nways.ng/maps/v1
Suggestions as someone types (billed per session)
GET https://nways.ng/maps/v1/autocomplete
Send the same session token (8–64 of A–Z a–z 0–9 - _, a UUID is fine) from the first letter until the user picks a result: the session's first request is billed (one autocomplete session); the rest are counted towards the rate limit but not charged, for up to 3 minutes between requests, 15 minutes and 100 requests in all. Start a new token after a pick. Without a token every request is a session. X-NWays-Session-Billed: 1|0 says which. Reasons: as /geocode, and SESSION_INVALID, TYPES_INVALID.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
q | query | string | Required. |
session | query | string | |
near | query | string | lat,lng: rank and pick results near it. |
country | query | string | Comma list of NG, GH, BJ, TG, GA, CI, LR, GN, SL, GW, SN, CM, BF, CV, GM. |
types | query | string | Comma list of address, street, business, place, area, postcode, ghanapost. |
limit | query | integer | Default: 5. ≥ 1, ≤ 10. |
lang | query | string | One of: en, fr, pt. Default: en. |
fields | query | string | Comma list of the fields to keep in each result (a.b reaches into objects; id is always kept; * = all). |
curl "https://nways.ng/maps/v1/autocomplete?q=lekki+ph" \
-H "X-NWays-Api-Key: YOUR_API_KEY"const res = await fetch('https://nways.ng/maps/v1/autocomplete?q=lekki+ph', {
headers: { 'X-NWays-Api-Key': process.env.NWAYS_API_KEY },
})
const data = await res.json()import os
import requests
res = requests.get(
"https://nways.ng/maps/v1/autocomplete?q=lekki+ph",
headers={"X-NWays-Api-Key": os.environ["NWAYS_API_KEY"]},
timeout=10,
)
data = res.json()Response
Suggestions
| Field | Type | Description |
|---|---|---|
results | Result[] | Required. |
results[].id | string | Required. |
results[].name | string | Required. |
results[].type | string | Required. address, street, business, landmark, building, postcode, ghanapost, or an area: neighbourhood, suburb, village, town, city, state… |
results[].category | string | |
results[].location | Point | Required. |
results[].location.type | string | Required. |
results[].location.coordinates | number[] | Required. [lng, lat] At least 2 items, at most 2 items. |
results[].bbox | number[] | west, south, east, north (areas) At least 4 items, at most 4 items. |
results[].formattedAddress | string | |
results[].postcode | string | NIPOST postcode, compact |
results[].ghanaPost | string | |
results[].plusCode | string | Required. |
results[].country | string | |
results[].distanceM | number | From near (or the point asked about). |
results[].estimated | boolean | The point is an estimate, within accuracyM. |
results[].accuracyM | number | |
results[].placeId | string | A business: its id for /places/{id}. |
results[].attribution | string | |
didYouMean | string | |
attribution | string | Required. |
{
"results": [
{
"id": "osm:w568367632",
"name": "Ikeja City Mall",
"type": "landmark",
"category": "shopping",
"location": {
"type": "string",
"coordinates": [
0
]
},
"bbox": [
0
],
"formattedAddress": "Ikeja, Lagos",
"postcode": "LA08A09DB09",
"ghanaPost": "GA-183-8164",
"plusCode": "6FR5J975+P4W",
"country": "NG",
"distanceM": 0,
"estimated": true,
"accuracyM": 0,
"placeId": "string",
"attribution": "string"
}
],
"didYouMean": "string",
"attribution": "string"
}Errors
defaultError