N-Ways
Developer docsCodes

Codes

NIPOST postcodes, GhanaPost GPS addresses, Plus Codes and N-Ways home codes, in one lookup.

On this page
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

Any code people write as an address

GET https://nways.ng/maps/v1/codes/{code}

A NIPOST postcode (LA 08 A09 DB 09, any written form), a GhanaPost GPS address (GA-183-8164), a Plus Code (6FR5J975+P4W, or a short one with near= or a town after it: J975+P4 Ikeja) or an N-Ways home code (a place's name and a number, Fréau-Jardin 10 58, in every country N-Ways issues them), URL-encoded. The kind is detected (type= forces one); the answer says the kind, where it is, a one-line address and the kind's own detail (postcode, ghanaPost, plusCode or homeCode). Text that is no kind of code answers CODE_UNRECOGNISED and isn't counted. For home codes, country= and near= pick between countries where the same name and number exist. Reasons: CODE_REQUIRED, CODE_UNRECOGNISED, TYPE_INVALID, NEAR_INVALID, COUNTRY_INVALID, LANG_INVALID, POSTCODE_INVALID, POSTCODE_NOT_FOUND_CHECK, POSTCODE_NOT_NIPOST, GHANAPOST_INVALID, GHANAPOST_UNKNOWN, PLUSCODE_INVALID, PLUSCODE_SHORT, LOCALITY_NOT_FOUND, HOMECODE_UNKNOWN, HOMECODE_FORMAT (type=homecode only), HOMECODE_OUTSIDE.

Parameters

NameInTypeDescription
codepathstringRequired. Up to 120 characters.
typequerystringForce a kind (default: detected). One of: postcode, ghanapost, pluscode, homecode.
nearquerystringlat,lng: rank and pick results near it.
countryquerystringHome codes: the country to look in.
langquerystringOne of: en, fr, pt. Default: en.
fieldsquerystringComma list of the fields to keep in each result (a.b reaches into objects; id is always kept; * = all).
cURL
curl "https://nways.ng/maps/v1/codes/LA%2008%20A09%20DB%2009" \
  -H "X-NWays-Api-Key: YOUR_API_KEY"
JavaScript
const res = await fetch('https://nways.ng/maps/v1/codes/LA%2008%20A09%20DB%2009', {
  headers: { 'X-NWays-Api-Key': process.env.NWAYS_API_KEY },
})
const data = await res.json()
Python
import os
import requests

res = requests.get(
    "https://nways.ng/maps/v1/codes/LA%2008%20A09%20DB%2009",
    headers={"X-NWays-Api-Key": os.environ["NWAYS_API_KEY"]},
    timeout=10,
)
data = res.json()

Response

The code

FieldTypeDescription
querystringRequired.
typestringRequired. One of: postcode, ghanapost, pluscode, homecode.
codestringRequired. As it is written: LA 08 A09 DB 09, GA-183-8164, 6FR5J975+P4W, Fréau-Jardin 10 58.
locationPointRequired.
location.typestringRequired.
location.coordinatesnumber[]Required. [lng, lat] At least 2 items, at most 2 items.
countrystring
formattedAddressstring
estimatedboolean
accuracyMnumber
postcodePostcode
postcode.codestringRequired.
postcode.displaystringRequired.
postcode.componentsPostcodeComponentsRequired.
postcode.components.statestringRequired.
postcode.components.stateNamestring
postcode.components.lgastringRequired.
postcode.components.lgaNamestring
postcode.components.districtstringRequired.
postcode.components.areastringRequired.
postcode.components.buildingstringRequired.
postcode.locationPointRequired.
postcode.location.typestringRequired.
postcode.location.coordinatesnumber[]Required. [lng, lat] At least 2 items, at most 2 items.
postcode.namestring
postcode.addressstring
postcode.buildingTypestring
postcode.entrancesEntrance[]Required. Verified first, main first: route to the first.
postcode.entrances[].locationPointRequired.
postcode.entrances[].location.typestringRequired.
postcode.entrances[].location.coordinatesnumber[]Required. [lng, lat] At least 2 items, at most 2 items.
postcode.entrances[].kindstringRequired. One of: main, gate, pedestrian, service.
postcode.entrances[].verifiedbooleanRequired.
postcode.plusCodestringRequired.
postcode.countrystringRequired.
postcode.sourcestringRequired. One of: nipost, osm, user, estimate.
postcode.estimatedbooleanRequired.
postcode.accuracyMnumber
postcode.distanceMnumberReverse geocoding: from the point asked about.
postcode.attributionstringRequired.
ghanaPostResult
ghanaPost.idstringRequired.
ghanaPost.namestringRequired.
ghanaPost.typestringRequired. address, street, business, landmark, building, postcode, ghanapost, or an area: neighbourhood, suburb, village, town, city, state…
ghanaPost.categorystring
ghanaPost.locationPointRequired.
ghanaPost.location.typestringRequired.
ghanaPost.location.coordinatesnumber[]Required. [lng, lat] At least 2 items, at most 2 items.
ghanaPost.bboxnumber[]west, south, east, north (areas) At least 4 items, at most 4 items.
ghanaPost.formattedAddressstring
ghanaPost.postcodestringNIPOST postcode, compact
ghanaPost.ghanaPoststring
ghanaPost.plusCodestringRequired.
ghanaPost.countrystring
ghanaPost.distanceMnumberFrom near (or the point asked about).
ghanaPost.estimatedbooleanThe point is an estimate, within accuracyM.
ghanaPost.accuracyMnumber
ghanaPost.placeIdstringA business: its id for /places/{id}.
ghanaPost.attributionstring
plusCodePlusCodeResponse
plusCode.locationPointRequired.
plusCode.location.typestringRequired.
plusCode.location.coordinatesnumber[]Required. [lng, lat] At least 2 items, at most 2 items.
plusCode.plusCodestringRequired.
plusCode.countryArea | nullRequired.
plusCode.regionArea | nullRequired.
plusCode.formattedAddressstring
plusCode.postcodePostcode | nullRequired. Nigeria: the building's NIPOST postcode, when one is within reach.
plusCode.ghanaPoststring | nullRequired. Ghana: the nearest known GhanaPost GPS address (within 100 m).
plusCode.nearestResult | nullRequired.
plusCode.attributionstringRequired.
plusCode.boundsnumber[]Required. west, south, east, north At least 4 items, at most 4 items.
homeCodeHomeCodeAn N-Ways home code: a building's name-and-number address. People write code; machine carries the check digit for systems.
homeCode.codestringRequired.
homeCode.machinestringRequired. With the check digit (systems only; never shown to people).
homeCode.countrystringRequired.
homeCode.namestringRequired.
homeCode.officialNamestring
homeCode.coveragestringWhere an official address exists (officialAddress first). One of: official, official-pending.
homeCode.officialAddressstring
homeCode.nameProvisionalbooleanRequired.
homeCode.nearstring
homeCode.municipalitystringRequired.
homeCode.islandstring
homeCode.postcodestring
homeCode.fullLinestringRequired.
homeCode.spokenstringRequired.
homeCode.statusstringRequired.
homeCode.locationPointRequired.
homeCode.location.typestringRequired.
homeCode.location.coordinatesnumber[]Required. [lng, lat] At least 2 items, at most 2 items.
homeCode.entranceobject
homeCode.entrance.locationPointRequired.
homeCode.entrance.location.typestringRequired.
homeCode.entrance.location.coordinatesnumber[]Required. [lng, lat] At least 2 items, at most 2 items.
homeCode.entrance.kindstringRequired. gate, door or centre
homeCode.entrance.verifiedbooleanRequired. Placed by people on site.
homeCode.plusCodestringRequired.
homeCode.creditstringRequired.
homeCode.creditUrlstring (uri)Required.
attributionstringRequired.
200 OK
{
  "query": "string",
  "type": "postcode",
  "code": "string",
  "location": {
    "type": "string",
    "coordinates": [
      0
    ]
  },
  "country": "string",
  "formattedAddress": "string",
  "estimated": true,
  "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"
  },
  "ghanaPost": {
    "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"
  },
  "plusCode": {
    "location": {
      "type": "string",
      "coordinates": [
        0
      ]
    },
    "plusCode": "string",
    "country": {
      "code": "NG-LA",
      "name": "Lagos State",
      "nameFr": "string",
      "namePt": "string"
    },
    "region": {
      "code": "NG-LA",
      "name": "Lagos State",
      "nameFr": "string",
      "namePt": "string"
    },
    "formattedAddress": "12 Admiralty Way, Lekki, Lagos State, Nigeria",
    "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": {},
          "kind": "main",
          "verified": true
        }
      ],
      "plusCode": "string",
      "country": "string",
      "source": "nipost",
      "estimated": true,
      "accuracyM": 0,
      "distanceM": 0,
      "attribution": "string"
    },
    "ghanaPost": "string",
    "nearest": {
      "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"
    },
    "attribution": "string",
    "bounds": [
      0
    ]
  },
  "homeCode": {
    "code": "Fréau-Jardin 10 58",
    "machine": "string",
    "country": "CV",
    "name": "string",
    "officialName": "string",
    "coverage": "official",
    "officialAddress": "string",
    "nameProvisional": true,
    "near": "string",
    "municipality": "string",
    "island": "string",
    "postcode": "string",
    "fullLine": "string",
    "spoken": "string",
    "status": "string",
    "location": {
      "type": "string",
      "coordinates": [
        0
      ]
    },
    "entrance": {
      "location": {
        "type": "string",
        "coordinates": [
          0
        ]
      },
      "kind": "string",
      "verified": true
    },
    "plusCode": "string",
    "credit": "Home code by N-Ways Addressing",
    "creditUrl": "string"
  },
  "attribution": "string"
}

Errors

  • default Error

Up to 100 codes of any kind at once

POST https://nways.ng/maps/v1/codes/batch

Each code is one unit of SKU codes. An answer per code, in order (result, as /codes/{code}), with its own error when it has one. type, near, country and lang apply to every code. Reasons (whole call): CODES_INVALID, TYPE_INVALID, NEAR_INVALID, COUNTRY_INVALID, LANG_INVALID.

Request body

FieldTypeDescription
codesstring[]Required. At least 1 items, at most 100 items.
typestringOne of: postcode, ghanapost, pluscode, homecode.
nearLatLng
near.latnumberRequired. ≥ -90, ≤ 90.
near.lngnumberRequired. ≥ -180, ≤ 180.
countrystring
langstringOne of: en, fr, pt.
cURL
curl -X POST "https://nways.ng/maps/v1/codes/batch" \
  -H "X-NWays-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"codes":["LA08A09DB09","GA-183-8164","6FR5J975+P4W","Fréau-Jardin 10 58"]}'
JavaScript
const res = await fetch('https://nways.ng/maps/v1/codes/batch', {
  method: 'POST',
  headers: { 'X-NWays-Api-Key': process.env.NWAYS_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "codes": [
      "LA08A09DB09",
      "GA-183-8164",
      "6FR5J975+P4W",
      "Fréau-Jardin 10 58"
    ]
  }),
})
const data = await res.json()
Python
import os
import requests

res = requests.post(
    "https://nways.ng/maps/v1/codes/batch",
    headers={"X-NWays-Api-Key": os.environ["NWAYS_API_KEY"]},
    json={"codes": ["LA08A09DB09", "GA-183-8164", "6FR5J975+P4W", "Fréau-Jardin 10 58"]},
    timeout=10,
)
data = res.json()

Response

One result per code

FieldTypeDescription
resultsobject[]Required.
results[].querystringRequired.
results[].resultCodeResponse
results[].result.querystringRequired.
results[].result.typestringRequired. One of: postcode, ghanapost, pluscode, homecode.
results[].result.codestringRequired. As it is written: LA 08 A09 DB 09, GA-183-8164, 6FR5J975+P4W, Fréau-Jardin 10 58.
results[].result.locationPointRequired.
results[].result.location.typestringRequired.
results[].result.location.coordinatesnumber[]Required. [lng, lat] At least 2 items, at most 2 items.
results[].result.countrystring
results[].result.formattedAddressstring
results[].result.estimatedboolean
results[].result.accuracyMnumber
results[].result.postcodePostcode
results[].result.postcode.codestringRequired.
results[].result.postcode.displaystringRequired.
results[].result.postcode.componentsPostcodeComponentsRequired.
results[].result.postcode.locationPointRequired.
results[].result.postcode.namestring
results[].result.postcode.addressstring
results[].result.postcode.buildingTypestring
results[].result.postcode.entrancesEntrance[]Required. Verified first, main first: route to the first.
results[].result.postcode.plusCodestringRequired.
results[].result.postcode.countrystringRequired.
results[].result.postcode.sourcestringRequired. One of: nipost, osm, user, estimate.
results[].result.postcode.estimatedbooleanRequired.
results[].result.postcode.accuracyMnumber
results[].result.postcode.distanceMnumberReverse geocoding: from the point asked about.
results[].result.postcode.attributionstringRequired.
results[].result.ghanaPostResult
results[].result.ghanaPost.idstringRequired.
results[].result.ghanaPost.namestringRequired.
results[].result.ghanaPost.typestringRequired. address, street, business, landmark, building, postcode, ghanapost, or an area: neighbourhood, suburb, village, town, city, state…
results[].result.ghanaPost.categorystring
results[].result.ghanaPost.locationPointRequired.
results[].result.ghanaPost.bboxnumber[]west, south, east, north (areas) At least 4 items, at most 4 items.
results[].result.ghanaPost.formattedAddressstring
results[].result.ghanaPost.postcodestringNIPOST postcode, compact
results[].result.ghanaPost.ghanaPoststring
results[].result.ghanaPost.plusCodestringRequired.
results[].result.ghanaPost.countrystring
results[].result.ghanaPost.distanceMnumberFrom near (or the point asked about).
results[].result.ghanaPost.estimatedbooleanThe point is an estimate, within accuracyM.
results[].result.ghanaPost.accuracyMnumber
results[].result.ghanaPost.placeIdstringA business: its id for /places/{id}.
results[].result.ghanaPost.attributionstring
results[].result.plusCodePlusCodeResponse
results[].result.plusCode.locationPointRequired.
results[].result.plusCode.plusCodestringRequired.
results[].result.plusCode.countryArea | nullRequired.
results[].result.plusCode.regionArea | nullRequired.
results[].result.plusCode.formattedAddressstring
results[].result.plusCode.postcodePostcode | nullRequired. Nigeria: the building's NIPOST postcode, when one is within reach.
results[].result.plusCode.ghanaPoststring | nullRequired. Ghana: the nearest known GhanaPost GPS address (within 100 m).
results[].result.plusCode.nearestResult | nullRequired.
results[].result.plusCode.attributionstringRequired.
results[].result.plusCode.boundsnumber[]Required. west, south, east, north At least 4 items, at most 4 items.
results[].result.homeCodeHomeCodeAn N-Ways home code: a building's name-and-number address. People write code; machine carries the check digit for systems.
results[].result.homeCode.codestringRequired.
results[].result.homeCode.machinestringRequired. With the check digit (systems only; never shown to people).
results[].result.homeCode.countrystringRequired.
results[].result.homeCode.namestringRequired.
results[].result.homeCode.officialNamestring
results[].result.homeCode.coveragestringWhere an official address exists (officialAddress first). One of: official, official-pending.
results[].result.homeCode.officialAddressstring
results[].result.homeCode.nameProvisionalbooleanRequired.
results[].result.homeCode.nearstring
results[].result.homeCode.municipalitystringRequired.
results[].result.homeCode.islandstring
results[].result.homeCode.postcodestring
results[].result.homeCode.fullLinestringRequired.
results[].result.homeCode.spokenstringRequired.
results[].result.homeCode.statusstringRequired.
results[].result.homeCode.locationPointRequired.
results[].result.homeCode.entranceobject
results[].result.homeCode.plusCodestringRequired.
results[].result.homeCode.creditstringRequired.
results[].result.homeCode.creditUrlstring (uri)Required.
results[].result.attributionstringRequired.
results[].errorItemError
results[].error.codeintegerRequired.
results[].error.reasonstringRequired.
results[].error.messagestringRequired.
attributionstringRequired.
200 OK
{
  "results": [
    {
      "query": "string",
      "result": {
        "query": "string",
        "type": "postcode",
        "code": "string",
        "location": {
          "type": "string",
          "coordinates": []
        },
        "country": "string",
        "formattedAddress": "string",
        "estimated": true,
        "accuracyM": 0,
        "postcode": {
          "code": "LA08A09DB09",
          "display": "LA 08 A09 DB 09",
          "components": {},
          "location": {},
          "name": "string",
          "address": "string",
          "buildingType": "string",
          "entrances": [],
          "plusCode": "string",
          "country": "string",
          "source": "nipost",
          "estimated": true,
          "accuracyM": 0,
          "distanceM": 0,
          "attribution": "string"
        },
        "ghanaPost": {
          "id": "osm:w568367632",
          "name": "Ikeja City Mall",
          "type": "landmark",
          "category": "shopping",
          "location": {},
          "bbox": [],
          "formattedAddress": "Ikeja, Lagos",
          "postcode": "LA08A09DB09",
          "ghanaPost": "GA-183-8164",
          "plusCode": "6FR5J975+P4W",
          "country": "NG",
          "distanceM": 0,
          "estimated": true,
          "accuracyM": 0,
          "placeId": "string",
          "attribution": "string"
        },
        "plusCode": {
          "location": {},
          "plusCode": "string",
          "country": {},
          "region": {},
          "formattedAddress": "12 Admiralty Way, Lekki, Lagos State, Nigeria",
          "postcode": {},
          "ghanaPost": "string",
          "nearest": {},
          "attribution": "string",
          "bounds": []
        },
        "homeCode": {
          "code": "Fréau-Jardin 10 58",
          "machine": "string",
          "country": "CV",
          "name": "string",
          "officialName": "string",
          "coverage": "official",
          "officialAddress": "string",
          "nameProvisional": true,
          "near": "string",
          "municipality": "string",
          "island": "string",
          "postcode": "string",
          "fullLine": "string",
          "spoken": "string",
          "status": "string",
          "location": {},
          "entrance": {},
          "plusCode": "string",
          "credit": "Home code by N-Ways Addressing",
          "creditUrl": "string"
        },
        "attribution": "string"
      },
      "error": {
        "code": 0,
        "reason": "string",
        "message": "string"
      }
    }
  ],
  "attribution": "string"
}

Errors

  • default Error