> ## Documentation Index
> Fetch the complete documentation index at: https://docs.webrouter.net/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenCage Geocoding

> Forward and reverse geocoding worldwide, built on open data (OpenStreetMap and others), with annotations such as timezone, currency, calling code, geohash and road info.

![](https://mintcdn.com/webrouter/JBFYvcRI1PVnd4YX/logo/data-apis/opencage.webp?fit=max\&auto=format\&n=JBFYvcRI1PVnd4YX\&q=85\&s=e9d754eecf921bb10097057a8a1feae1)

[Web Catalog · Maps](https://docs.webrouter.net/data-apis.md?category=maps)

Needs&#x20;

`OPENCAGE_API_KEY`

Endpoints

2

Auth

Key in query

[Vendor docs](https://opencagedata.com/api)

&#x20;·&#x20;

[Pricing](https://opencagedata.com/pricing)

## Setup

| Variable | | What it is |
| - | - | - |
| `OPENCAGE_API_KEY` | required | An OpenCage API key (opencagedata.com > Dashboard), sent as the key query parameter. |

Put them in your environment or `.env`; [Data APIs](https://docs.webrouter.net/vendors.md) covers the other ways.

## Notes

* One path does both directions: q is an address or place for forward geocoding, or 'latitude,longitude' (latitude first, decimal point) for reverse.
* Free trial: 2,500 requests per day (reset at 00:00 UTC; 402 when spent) and 1 request per second (429 when exceeded). The free trial is for testing, not production.
* no\_annotations=1 makes answers smaller and faster when timezone, currency and the other annotations are not needed.

## Endpoints

GET

Geocode an address or place name

Coordinates, a formatted address, its components and a confidence score for free text.

[Open](#opencage-geocode-forward)

GET

Reverse geocode a coordinate

The address, place and annotations for one latitude,longitude.

[Open](#opencage-geocode-reverse)

### Geocode an address or place name

GET

`/geocode/v1/json`

`opencage.geocode.forward`

Coordinates, a formatted address, its components and a confidence score for free text.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`q` required</td><td>string</td><td>query</td><td>Address or place name. Example `Brandenburg Gate, Berlin`</td></tr>
    <tr><td>`countrycode`</td><td>string</td><td>query</td><td>Comma-separated ISO 3166-1 alpha-2 codes to restrict results to. Example `de`</td></tr>

    <tr>
      <td>
        `language`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        IETF language code (de, pt-BR) or native; default en.
      </td>
    </tr>

    <tr>
      <td>
        `limit`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Maximum results, default 10, max 100.
      </td>
    </tr>

    <tr>
      <td>
        `bounds`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Bounding box hint as minLng,minLat,maxLng,maxLat (longitude first).
      </td>
    </tr>

    <tr>
      <td>
        `proximity`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        latitude,longitude to favour nearer results.
      </td>
    </tr>

    <tr><td>`no_annotations`</td><td>integer</td><td>query</td><td>1 leaves annotations out. One of `0`, `1`</td></tr>
    <tr><td>`abbrv`</td><td>integer</td><td>query</td><td>1 abbreviates the formatted string. One of `0`, `1`</td></tr>
    <tr><td>`address_only`</td><td>integer</td><td>query</td><td>1 leaves POI names out of the formatted string. One of `0`, `1`</td></tr>
    <tr><td>`no_dedupe`</td><td>integer</td><td>query</td><td>1 keeps duplicate results. One of `0`, `1`</td></tr>
    <tr><td>`no_record`</td><td>integer</td><td>query</td><td>1 asks OpenCage not to log the query. One of `0`, `1`</td></tr>
  </tbody>
</table>

[Vendor docs](https://opencagedata.com/api#forward) · Same job: [Amap (Gaode) Web Service](https://docs.webrouter.net/data-apis/amap.md#amap-geocode), [API Ninjas](https://docs.webrouter.net/data-apis/apininjas.md#apininjas-geocode), [Geoapify](https://docs.webrouter.net/data-apis/geoapify.md#geoapify-geocode-search), [Google Maps Platform](https://docs.webrouter.net/data-apis/google-maps.md#google-maps-geocode-forward), [GraphHopper Directions API](https://docs.webrouter.net/data-apis/graphhopper.md#graphhopper-geocode-forward), [HERE](https://docs.webrouter.net/data-apis/here-maps.md#here-maps-geocode)

```python Python theme={null}
router.call_data_api("opencage.geocode.forward", {'q': 'Brandenburg Gate, Berlin', 'countrycode': 'de'})
```

```text MCP theme={null}
call_data_api(endpoint="opencage.geocode.forward", params={"q": "Brandenburg Gate, Berlin", "countrycode": "de"})
```

> [!NOTE]
>
> * Check each result's confidence: it measures how small the result's bounding box is (10 means its corners are under 0.25 km apart, 0 means no box), not how likely the match is right.

### Reverse geocode a coordinate

GET

`/geocode/v1/json`

`opencage.geocode.reverse`

The address, place and annotations for one latitude,longitude.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`q` required</td><td>string</td><td>query</td><td>latitude,longitude in decimal degrees, latitude first. Example `52.5163,13.3777`</td></tr>

    <tr>
      <td>
        `language`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        IETF language code or native; default en.
      </td>
    </tr>

    <tr><td>`roadinfo`</td><td>integer</td><td>query</td><td>1 matches the nearest road rather than an address and adds road details (speed unit, drive side, road type). One of `0`, `1`</td></tr>
    <tr><td>`no_annotations`</td><td>integer</td><td>query</td><td>1 leaves annotations out. One of `0`, `1`</td></tr>
    <tr><td>`abbrv`</td><td>integer</td><td>query</td><td>1 abbreviates the formatted string. One of `0`, `1`</td></tr>
    <tr><td>`address_only`</td><td>integer</td><td>query</td><td>1 leaves POI names out of the formatted string. One of `0`, `1`</td></tr>
    <tr><td>`no_record`</td><td>integer</td><td>query</td><td>1 asks OpenCage not to log the query. One of `0`, `1`</td></tr>
  </tbody>
</table>

[Vendor docs](https://opencagedata.com/api#reverse) · Same job: [Geoapify](https://docs.webrouter.net/data-apis/geoapify.md#geoapify-geocode-reverse), [Google Maps Platform](https://docs.webrouter.net/data-apis/google-maps.md#google-maps-geocode-reverse), [GraphHopper Directions API](https://docs.webrouter.net/data-apis/graphhopper.md#graphhopper-geocode-reverse), [HERE](https://docs.webrouter.net/data-apis/here-maps.md#here-maps-revgeocode), [TomTom](https://docs.webrouter.net/data-apis/tomtom.md#tomtom-geocode-reverse)

```python Python theme={null}
router.call_data_api("opencage.geocode.reverse", {'q': '52.5163,13.3777'})
```

```text MCP theme={null}
call_data_api(endpoint="opencage.geocode.reverse", params={"q": "52.5163,13.3777"})
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.