N-Ways
Developer docsClient libraries

Client libraries and Postman

Call every N-Ways API from your language with a generated client, or try them in Postman first.

On this page
Note:

On npm: npm install @nways/client. The JavaScript and TypeScript client is published (Apache-2.0); the clients are generated from our OpenAPI files and built and tested with each release. Python, Kotlin and Swift aren’t on PyPI, Maven Central or Swift Package Index yet: until they are, ask us for the source at hello@nways.ng, or generate your own from the OpenAPI files.

What’s available

LanguagePackageRuns onNeeds
JavaScript and TypeScript@nways/client (npm)Browsers, Node 18+, Deno, BunNothing (uses fetch)
Pythonnways-maps (from source)Python 3.8+Nothing (the standard library)
Kotlinng.nways:client (from source)JVM 17+, Androidkotlinx.serialization
SwiftNWaysClient (Swift package, from source)iOS 15+, macOS 12+Nothing (Foundation)

Each has one method per API operation, named as in the API reference, sends your key in the X-NWays-Api-Key header, and turns error answers into an error with the HTTP status, the reason (API_KEY_HTTP_REFERRER_BLOCKED, RATE_LIMIT_EXCEEDED…) and the Retry-After seconds. For maps in web pages and apps, use the web, Android and iOS Maps SDKs, which include the same calls.

Examples

TypeScript
import { NWaysClient, ApiError } from '@nways/client'

const nways = new NWaysClient({ apiKey: process.env.NWAYS_API_KEY! })
try {
  const { results } = await nways.geocode({ q: 'Allen Avenue, Ikeja', limit: 3 })
  console.log(results[0]?.name, results[0]?.location.coordinates)
} catch (e) {
  if (e instanceof ApiError && e.status === 429) console.log(`Retry in ${e.retryAfter} s`)
  else throw e
}
Python
import os
from nways_maps import ApiError, Client

nways = Client(api_key=os.environ["NWAYS_API_KEY"])
try:
    answer = nways.geocode(q="Allen Avenue, Ikeja", limit=3)
    print(answer["results"][0]["name"])
except ApiError as e:
    print(e.status, e.reason, e.retry_after)
Kotlin
import ng.nways.client.ApiError
import ng.nways.client.NWaysClient

val nways = NWaysClient(apiKey = System.getenv("NWAYS_API_KEY"))
// Calls block: run them on Dispatchers.IO in an app.
try {
    val answer = nways.geocode(q = "Allen Avenue, Ikeja", limit = 3)
    println(answer.results.firstOrNull()?.name)
} catch (e: ApiError) {
    println("${e.status} ${e.reason}")
}
Swift
import NWaysClient

let nways = NWaysClient(apiKey: "YOUR_API_KEY")
do {
    let answer = try await nways.geocode(q: "Allen Avenue, Ikeja", limit: 3)
    print(answer.results.first?.name ?? "nothing found")
} catch let e as NWaysError {
    print(e.status, e.reason ?? "", e.message)
}
Warning:

A server’s key, restricted to your servers’ IP addresses, must never be put in a web page or a mobile app. In apps, use a key restricted to the app (Android package and SHA-1, or iOS bundle ID); the Maps SDKs send those for you.

Postman

Try every request without writing code:

  1. Download the N-Ways Maps Platform collection.
  2. In Postman, choose Import and pick the file.
  3. In the collection’s Variables, set apiKey to a key restricted to your computer’s IP address. baseUrl is https://nways.ng.
  4. Open a request and press Send.

The same works in Insomnia, Bruno and other tools that import Postman collections or OpenAPI files.

OpenAPI files

The API reference, the clients and the Postman collection are all made from two OpenAPI 3.1 files, which you can use with any OpenAPI tool to generate a client in another language, mock the API in tests or validate requests:

Versions

The clients follow the API: version 1 of a client calls version 1 of the API (/maps/v1), and only gains methods and fields within it. Generated types accept fields they don’t know yet, so a newer API never breaks an older client. How versions work

Licence

The four clients are open source under the Apache License 2.0 (Apache-2.0), Copyright 2026 N-WAYS LIMITED; each package has its LICENSE and NOTICE files. The licence covers the code only: N-Ways maps and data stay © OpenStreetMap contributors under the Open Database Licence (ODbL), with the credit shown wherever they appear.