Address validation
Check and complete an address: a verdict, its parts, its point and its postcode.
Note:
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
Is this address real, where is it, what is it properly?
POST https://nways.ng/maps/v1/addresses/validate
A NIPOST postcode, GhanaPost GPS address or Plus Code in the address is resolved first; the words are geocoded and checked against the code; the components come from what is at the point, and a missing NIPOST postcode is filled in from the building there (verdict.inferredPostcode). Reasons: ADDRESS_REQUIRED, COUNTRY_INVALID, NEAR_INVALID, LANG_INVALID.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
fields | query | string | Comma list of the fields to keep in each result (a.b reaches into objects; id is always kept; * = all). |
Request body
| Field | Type | Description |
|---|---|---|
address | string | Required. Up to 300 characters. |
country | string | One of: NG, GH, BJ, TG, GA, CI, LR, GN, SL, GW, SN, CM, BF, CV, GM. |
near | LatLng | |
near.lat | number | Required. ≥ -90, ≤ 90. |
near.lng | number | Required. ≥ -180, ≤ 180. |
lang | string | One of: en, fr, pt. |
cURL
curl -X POST "https://nways.ng/maps/v1/addresses/validate" \
-H "X-NWays-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"address":"12 Admiralty Way, Lekki, LA 08 A09 DB 09","country":"NG"}'JavaScript
const res = await fetch('https://nways.ng/maps/v1/addresses/validate', {
method: 'POST',
headers: { 'X-NWays-Api-Key': process.env.NWAYS_API_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"address": "12 Admiralty Way, Lekki, LA 08 A09 DB 09",
"country": "NG"
}),
})
const data = await res.json()Python
import os
import requests
res = requests.post(
"https://nways.ng/maps/v1/addresses/validate",
headers={"X-NWays-Api-Key": os.environ["NWAYS_API_KEY"]},
json={"address": "12 Admiralty Way, Lekki, LA 08 A09 DB 09", "country": "NG"},
timeout=10,
)
data = res.json()Response
The verdict
| Field | Type | Description |
|---|---|---|
verdict | object | Required. |
verdict.status | string | Required. One of: VALID, VALID_WITH_CORRECTIONS, PARTIAL, UNRESOLVED, INVALID. |
verdict.granularity | string | Required. One of: PREMISE, POINT, ROUTE, NEIGHBOURHOOD, LOCALITY, REGION, NONE. |
verdict.confidence | number | Required. ≥ 0, ≤ 1. |
verdict.codesAgree | boolean | null | Required. |
verdict.inferredPostcode | boolean | |
formattedAddress | string | Required. |
components | object[] | Required. |
components[].type | string | Required. One of: postcode, ghanapost, pluscode, premise, street, neighbourhood, locality, lga, region, country. |
components[].text | string | Required. |
components[].code | string | |
components[].source | string | Required. One of: input, corrected, inferred, unconfirmed. |
location | Point | null | Required. |
accuracyM | number | |
postcode | Postcode | null | Required. |
plusCode | string | |
issues | object[] | Required. |
issues[].code | string | Required. POSTCODE_INVALID, POSTCODE_UNKNOWN, GHANAPOST_UNKNOWN, PLUSCODE_UNRESOLVED, LEGACY_POSTCODE, CODE_ADDRESS_MISMATCH, COUNTRY_MISMATCH, WORDS_NOT_FOUND, NOT_FOUND |
issues[].message | string | Required. |
attribution | string | Required. |
200 OK
{
"verdict": {
"status": "VALID",
"granularity": "PREMISE",
"confidence": 0,
"codesAgree": true,
"inferredPostcode": true
},
"formattedAddress": "string",
"components": [
{
"type": "postcode",
"text": "string",
"code": "string",
"source": "input"
}
],
"location": {
"type": "string",
"coordinates": [
0
]
},
"accuracyM": 0,
"postcode": {
"code": "LA08A09DB09",
"display": "LA 08 A09 DB 09",
"components": {
"state": "LA",
"stateName": "Lagos",
"lga": "08",
"lgaName": "Eti-Osa",
"district": "A09",
"area": "DB",
"building": "09"
},
"location": {
"type": "string",
"coordinates": [
0
]
},
"name": "string",
"address": "string",
"buildingType": "string",
"entrances": [
{
"location": {
"type": "string",
"coordinates": []
},
"kind": "main",
"verified": true
}
],
"plusCode": "string",
"country": "string",
"source": "nipost",
"estimated": true,
"accuracyM": 0,
"distanceM": 0,
"attribution": "string"
},
"plusCode": "string",
"issues": [
{
"code": "CODE_ADDRESS_MISMATCH",
"message": "string"
}
],
"attribution": "string"
}Errors
defaultError