# Reverse Geocoding API Worldwide with Time Zones: OpenCage (`nabeelbaghoor/reverse-geocoding-worldwide-openstreetmap-api`) Actor

Forward and reverse geocoding for any country through the OpenCage API on OpenStreetMap and open data: coordinates to address, address to latitude and longitude, plus time zone, currency, calling code, what3words, geohash, MGRS, FIPS and NUTS annotations. Results may be stored. Bring your own key.

- **URL**: https://apify.com/nabeelbaghoor/reverse-geocoding-worldwide-openstreetmap-api.md
- **Developed by:** [Nabeel Hassan](https://apify.com/nabeelbaghoor) (community)
- **Categories:** Developer tools, Business, Integrations
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 geocoded address or coordinates

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Reverse Geocoding API Worldwide with Time Zones: OpenCage

Turn coordinates into addresses, or addresses and placenames into coordinates, for any country through the OpenCage geocoding API with your own API key, and get the time zone, currency, calling code, what3words and more for every match.

OpenCage is a worldwide geocoding API built on OpenStreetMap and other open data sources. Its results may be cached or stored permanently, on a free trial or a paid plan, and even after you stop being a customer. This actor wraps its one documented geocoding route, GET /geocode/v1/json on api.opencagedata.com, in forward and reverse mode, with every documented optional parameter that changes the result. Use it to reverse geocode GPS points from fleets, apps or IoT devices, geocode customer, store or event lists in any country, add local time zones and currencies to locations, or feed Google Sheets, BI dashboards, a data warehouse or AI agents. Bring your own API key.

BYOK, not live tested: every parameter comes from OpenCage's documentation at opencagedata.com/api, the route was probed on 2026-10-26 with an invalid key, and the response shape was checked against the testing key OpenCage publishes in its docs. The actor has not been run against a live customer key.

### What it does

- **Reverse geocoding worldwide**: one latitude,longitude pair per request, returning the nearest address with its formatted string, road, house number, postcode, city, state, country, ISO 3166 codes, confidence and the distance in meters from your point.
- **Forward geocoding**: addresses, placenames, postcodes or UN/LOCODEs (with the LOCODE: prefix) to latitude and longitude, with up to 100 ranked candidates per lookup.
- **Filters that cut wrong matches**: country codes (countrycode), a bounding box (bounds) and a proximity hint (proximity) for forward lookups, and a preferred language (or native) for both modes.
- **Annotations as flat columns**: IANA time zone, abbreviation, UTC offset and DST flag; currency code, name and symbol; international calling code; what3words address; geohash, MGRS, Maidenhead and DMS; US FIPS state and county codes; EU NUTS 3 code; UN M49 regions; Wikidata ID; OpenStreetMap link; drive side and speed unit; sunrise and sunset; and the full annotations object.
- **Road matching**: roadinfo snaps to the nearest road and adds road type, speed limit, lanes, surface and toll where OpenStreetMap has them.
- **Formatting and privacy switches**: address only (no point of interest name), abbreviated addresses, no deduplication, and no_record so OpenCage keeps no record of your queries.
- **Pay only for matches**: lookups with no match, and lookups OpenCage refuses, are recorded as a free row that says why, never charged.

### How to use it

1. Get an OpenCage API key at opencagedata.com/users/sign_up. The free trial allows 2,500 requests a day at one request per second and is meant for testing; subscriptions and one-time plans allow more.
2. Paste the key into the API key field, or set the DATA_API_KEY environment secret. OpenCage only accepts the key as the key query parameter, so the actor adds it to the request at the last moment and removes it from everything it logs.
3. Pick a mode, paste your addresses or coordinates, set any filters, and run.
4. Download the dataset as JSON, CSV or Excel, or connect it to your workflow through the Apify API, webhooks or integrations.

A missing or unknown key, a disabled key, a rejected IP address or a used up quota ends the run cleanly with a status message that explains what to change, and nothing is charged.

### Input

| Field | Modes | Description |
| --- | --- | --- |
| `mode` | all | `geocode` (default) or `reverse` |
| `addresses` | forward | One address, placename or postcode per line, such as `Frauenplan 1, 99423 Weimar, Germany` |
| `coordinates` | reverse | One `latitude,longitude` pair per line, such as `52.5432379,13.4142133` |
| `countryCodes` | forward | Two letter ISO 3166-1 codes such as `de`, `gb`, `us` (countrycode) |
| `bounds` | forward | `min_lng,min_lat,max_lng,max_lat` bounding box |
| `proximity` | forward | `latitude,longitude` point that ranks closer results higher |
| `limit` | forward | Matches per lookup, 1 to 100, default 1. Extra matches go in `otherResults` |
| `language` | all | IETF language code such as `de` or `pt-BR`, or `native` |
| `annotations` | all | Include annotations (default on); off sends `no_annotations=1` |
| `roadinfo` | all | Match the nearest road and add road details |
| `addressOnly` | all | Leave point of interest names out of the formatted address (`address_only=1`) |
| `abbreviate` | all | Shorten the formatted address (`abbrv=1`) |
| `noDedupe` | all | Keep duplicate results (`no_dedupe=1`) |
| `noRecord` | all | Ask OpenCage not to log the query (`no_record=1`) |
| `maxResults` | all | The most rows this run returns and charges for (default 100, up to 10,000) |
| `requestsPerMinute` | all | Pacing for calls to OpenCage (default 60, the free trial rate) |
| `apiKey` | all | Your OpenCage API key |

### Output

One row per address or coordinate. Example reverse geocoding row (the `components`, `annotations` and `bounds` objects shortened):

```json
{
    "mode": "reverse",
    "modeLabel": "Reverse geocoding",
    "query": "-22.6792,14.5272",
    "found": true,
    "formattedAddress": "Woermann Street, Swakopmund 13001, Namibia",
    "latitude": -22.6792396,
    "longitude": 14.5272048,
    "confidence": 9,
    "resultType": "road",
    "category": "road",
    "distanceMeters": 4,
    "houseNumber": null,
    "road": "Woermann Street",
    "suburb": "Central",
    "city": "Swakopmund",
    "state": "Erongo Region",
    "postcode": "13001",
    "country": "Namibia",
    "countryCode": "NA",
    "iso3166Alpha3": "NAM",
    "iso3166_2": ["NA-ER"],
    "continent": "Africa",
    "timezone": "Africa/Windhoek",
    "timezoneAbbreviation": "CAT",
    "utcOffsetSeconds": 7200,
    "utcOffset": "+0200",
    "nowInDst": false,
    "currencyCode": "NAD",
    "currencyName": "Namibian Dollar",
    "callingCode": 264,
    "what3words": "outsmarted.cheering.chemical",
    "mgrs": "33KVQ5143391910",
    "maidenhead": "JG77gh36gx",
    "osmUrl": "https://www.openstreetmap.org/?mlat=-22.67924&mlon=14.52720#map=16/-22.67924/14.52720",
    "driveOn": "left",
    "speedIn": "km/h",
    "roadType": "residential",
    "resultCount": 1,
    "totalResults": 1,
    "components": { "_type": "road", "road": "Woermann Street", "city": "Swakopmund" },
    "annotations": { "timezone": {}, "currency": {}, "what3words": {} },
    "otherResults": null,
    "dataLicense": "OpenStreetMap contributors (ODbL) and other open data; see opencagedata.com/credits",
    "note": null
}
```

`confidence` runs from 1 (low precision) to 10 (high precision) and is based on the size of the matched place's bounding box; 0 means OpenCage could not determine it. It is not a ranking: results are not ordered by confidence. `resultType` is OpenCage's `_type`, such as `building`, `road`, `city` or `postcode`, so a forward match that only reached the city level is easy to spot.

### Pricing

| Event | Price | Charged for |
| --- | --- | --- |
| `geocode-result` | 0.005 USD | Each matched address or coordinate returned without annotations |
| `geocode-result-with-annotations` | 0.008 USD | Each matched address or coordinate that comes back with annotations |

Lookups with no match and refused or invalid lookups are never charged.

**OpenCage bills your own account separately.** OpenCage plans are counted in requests, and this actor sends one request per address or coordinate. See opencagedata.com/pricing for current plans.

### FAQ

#### What is the OpenCage geocoding API?

OpenCage is a geocoding API run by OpenCage GmbH in Germany. It converts addresses and placenames to coordinates (forward geocoding) and coordinates to addresses (reverse geocoding) for the whole world, using OpenStreetMap and other open data, and adds annotations such as time zone, currency and what3words to each result.

#### Do I need my own OpenCage API key?

Yes. This actor is bring your own key: it calls OpenCage with your key, and your OpenCage plan and limits apply. Create a key at opencagedata.com; the free trial is for testing, at 2,500 requests a day and one request per second.

#### How do I reverse geocode GPS coordinates to an address?

Choose Reverse geocoding and paste one latitude,longitude pair per line, latitude first. Each row carries the nearest address, its components and `distanceMeters`, the distance from your point to the result.

#### How do I get the time zone or local currency of a location?

Leave Include annotations on. Every match carries `timezone` (IANA name such as Europe/Berlin), `timezoneAbbreviation`, `utcOffset`, `utcOffsetSeconds` and `nowInDst`, plus `currencyCode`, `currencyName`, `currencySymbol` and `callingCode`. The whole annotations object stays in `annotations`.

#### How do I stop forward geocoding from matching the wrong country?

Set Country codes, a Bounding box or both. OpenCage recommends them, and it does not do fuzzy matching, so write addresses the way the country writes them. Check `resultType` and `confidence` to catch matches that only reached a city or region.

#### Can I store the results?

Yes. OpenCage's documentation says all data returned by the API can be stored permanently, whether you are on the free trial or a paid plan, and even after you stop being a customer. Refreshing now and then is still wise, since OpenStreetMap keeps changing.

#### What attribution do I need?

Much of the data comes from OpenStreetMap, which is licensed under the Open Database License (ODbL). When you publish or display the results, credit "OpenStreetMap contributors" and follow OpenCage's attribution guide at opencagedata.com/credits. The OpenStreetMap Foundation's guidance is that geocoding does not trigger the share-alike obligations of the ODbL. Every row carries a `dataLicense` column as a reminder.

#### What do I pay?

0.005 USD per matched lookup without annotations and 0.008 USD per matched lookup with annotations, plus your own OpenCage plan, billed by OpenCage. Lookups with no match are free on this side.

### Keyword map

reverse geocoding API, reverse geocode coordinates, coordinates to address, latitude longitude to address, GPS to address, geocoding API worldwide, address to latitude longitude, international geocoding, OpenStreetMap geocoding API, Nominatim alternative, time zone by coordinates, time zone lookup API, currency by location, what3words from coordinates, geohash and MGRS conversion, FIPS code by coordinates, NUTS region lookup, nearest road lookup, OpenCage API, OpenCage geocoder.

### Routes and verification

| Mode | Route | Source | Probe with an invalid 32 character key (twice) |
| --- | --- | --- | --- |
| Forward geocoding | GET /geocode/v1/json?q=Berlin | opencagedata.com/api | 401 `unknown API key` |
| Reverse geocoding | GET /geocode/v1/json?q=52.5,13.4 | opencagedata.com/api | 401 `unknown API key` |

Controls on the same host: /geocode/v1/jsonx answered 400 `not a valid format`, /geocode/v9/json answered 400 `not a valid version`, an invented /reverse/v1/json answered a 404 HTML page, and a request with no key answered 401 `missing API key`, so the route above is confirmed. The publicly documented testing keys confirmed the 200 response shape, 402 `quota exceeded`, 403 `disabled` and 429. The GeoJSON, XML and google-v3-json formats and the separate geosearch product are not wrapped.

### Licensing and data use

This actor works only with your own OpenCage account and API key, and OpenCage's terms of use apply. Results may be stored permanently. Data from OpenStreetMap is licensed under the ODbL and needs attribution to OpenStreetMap contributors; see opencagedata.com/credits for the other sources. This actor is not affiliated with or endorsed by OpenCage GmbH.

# Actor input Schema

## `mode` (type: `string`):

Forward geocoding turns addresses and placenames into coordinates. Reverse geocoding turns latitude,longitude pairs into the nearest address. Both work for every country and return OpenCage annotations such as time zone and currency.

## `addresses` (type: `array`):

Forward mode. One address, placename or postcode per line, at least two characters, in the order the country writes it. OpenCage does not do fuzzy matching. A UN/LOCODE works with the prefix LOCODE:, such as LOCODE:DEBRV. Duplicates are sent once.

## `coordinates` (type: `array`):

Reverse mode. One latitude,longitude pair per line, latitude first, in decimal degrees with a period as the decimal separator. OpenCage returns at most one result per coordinate.

## `countryCodes` (type: `array`):

Forward mode. Restricts results to these countries or territories, as two letter ISO 3166-1 codes such as de, gb or us (sent as countrycode). Territories with their own code, such as pr for Puerto Rico, need that code.

## `bounds` (type: `string`):

Forward mode. Restricts results to a box given as min longitude,min latitude,max longitude,max latitude, for example -0.563160,51.280430,0.278970,51.683979 for Greater London.

## `proximity` (type: `string`):

Forward mode. A latitude,longitude point such as 52.5432379,13.4142133. Results closer to it rank higher; it is a hint, not a filter.

## `limit` (type: `integer`):

Forward mode. The most matches OpenCage returns per address, from 1 to 100. The first result fills the row and the rest go in otherResults. Reverse geocoding always returns at most one.

## `language` (type: `string`):

Optional. An IETF language code such as de, es or pt-BR, or native for the local language. OpenCage favours, but does not limit results to, this language. English when empty.

## `annotations` (type: `boolean`):

Adds OpenCage annotations to every match: time zone, currency, calling code, what3words, geohash, MGRS, Maidenhead, DMS, FIPS (US), NUTS (Europe), UN M49, Wikidata, OpenStreetMap links, road info and sun times. Switch off to send no_annotations=1 for slightly faster answers.

## `roadinfo` (type: `boolean`):

Sends roadinfo=1: OpenCage matches the nearest road instead of an address and fills extra road details where known, such as speed limit, lanes, surface and toll.

## `addressOnly` (type: `boolean`):

Sends address_only=1: the formatted address leaves out point of interest names, such as a shop or museum at the address.

## `abbreviate` (type: `boolean`):

Sends abbrv=1: OpenCage shortens the formatted address, for example Massachusetts Ave instead of Massachusetts Avenue.

## `noDedupe` (type: `boolean`):

Sends no_dedupe=1 so OpenCage does not deduplicate the results of a lookup.

## `noRecord` (type: `boolean`):

Sends no_record=1 so OpenCage keeps no record of the query contents. Use it for addresses of people or other sensitive locations.

## `maxResults` (type: `integer`):

The most rows this run returns and charges for. One run takes up to 10,000 addresses or coordinates.

## `requestsPerMinute` (type: `integer`):

Pacing for calls to OpenCage. Free trial keys are limited to one request per second (60 per minute); paid plans allow more. Throttled calls are retried after a pause.

## `apiKey` (type: `string`):

Your own OpenCage geocoding API key, from your dashboard at opencagedata.com. Stored as a secret and sent only to OpenCage as the documented key parameter; it is never logged. You can instead set the DATA_API_KEY environment secret.

## Actor input object example

```json
{
  "mode": "geocode",
  "addresses": [
    "Frauenplan 1, 99423 Weimar, Germany"
  ],
  "limit": 1,
  "annotations": true,
  "roadinfo": false,
  "addressOnly": false,
  "abbreviate": false,
  "noDedupe": false,
  "noRecord": false,
  "maxResults": 100,
  "requestsPerMinute": 60
}
```

# Actor output Schema

## `records` (type: `string`):

One row per address or coordinate the chosen mode looked up.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "addresses": [
        "Frauenplan 1, 99423 Weimar, Germany"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("nabeelbaghoor/reverse-geocoding-worldwide-openstreetmap-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "addresses": ["Frauenplan 1, 99423 Weimar, Germany"] }

# Run the Actor and wait for it to finish
run = client.actor("nabeelbaghoor/reverse-geocoding-worldwide-openstreetmap-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "addresses": [
    "Frauenplan 1, 99423 Weimar, Germany"
  ]
}' |
apify call nabeelbaghoor/reverse-geocoding-worldwide-openstreetmap-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,nabeelbaghoor/reverse-geocoding-worldwide-openstreetmap-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Y5hw9JUgOyEIWV4Ki/builds/bT01SHHSwNtLwwH1Z/openapi.json
