N-Ways
Developer docsAddress validation

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

NameInTypeDescription
fieldsquerystringComma list of the fields to keep in each result (a.b reaches into objects; id is always kept; * = all).

Request body

FieldTypeDescription
addressstringRequired. Up to 300 characters.
countrystringOne of: NG, GH, BJ, TG, GA, CI, LR, GN, SL, GW, SN, CM, BF, CV, GM.
nearLatLng
near.latnumberRequired. ≥ -90, ≤ 90.
near.lngnumberRequired. ≥ -180, ≤ 180.
langstringOne 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

FieldTypeDescription
verdictobjectRequired.
verdict.statusstringRequired. One of: VALID, VALID_WITH_CORRECTIONS, PARTIAL, UNRESOLVED, INVALID.
verdict.granularitystringRequired. One of: PREMISE, POINT, ROUTE, NEIGHBOURHOOD, LOCALITY, REGION, NONE.
verdict.confidencenumberRequired. ≥ 0, ≤ 1.
verdict.codesAgreeboolean | nullRequired.
verdict.inferredPostcodeboolean
formattedAddressstringRequired.
componentsobject[]Required.
components[].typestringRequired. One of: postcode, ghanapost, pluscode, premise, street, neighbourhood, locality, lga, region, country.
components[].textstringRequired.
components[].codestring
components[].sourcestringRequired. One of: input, corrected, inferred, unconfirmed.
locationPoint | nullRequired.
accuracyMnumber
postcodePostcode | nullRequired.
plusCodestring
issuesobject[]Required.
issues[].codestringRequired. POSTCODE_INVALID, POSTCODE_UNKNOWN, GHANAPOST_UNKNOWN, PLUSCODE_UNRESOLVED, LEGACY_POSTCODE, CODE_ADDRESS_MISMATCH, COUNTRY_MISMATCH, WORDS_NOT_FOUND, NOT_FOUND
issues[].messagestringRequired.
attributionstringRequired.
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

  • default Error