← Back to API Ninjas
GET/v1/geocoding

Get coordinates for a city, state, or US ZIP code

Converts a place name into latitude and longitude. Requires `city`; narrow with `state`, `country` or `zipcode`. On this listing the enrichment fields (county, zip_code, area_codes, nearest_airport, is_land, climate_zone, urbanisation) are returned as an upgrade-notice string rather than data. For the reverse direction use /reversegeocoding.

API Ninjas·$0.001 per call

Example code

// Using @orth/sdk - The simplest way to call APIs // Install: npm install @orth/sdk import Orthogonal from "@orth/sdk"; const orthogonal = new Orthogonal({ apiKey: process.env.ORTHOGONAL_API_KEY, }); const output = await orthogonal.run({ api: "api-ninjas", path: "/v1/geocoding", query: { "city": "example" } }); console.log(output);

Query parameters

cityrequired
string

City name.

state
string

US state (for United States cities only).

country
string

Country name, 2-letter ISO country code, or 3-letter ISO country code.

zipcode
string

5-digit zipcode (for United States cities only).

    Orthogonal - Giving AI agents the tools they need.