
# OpenCage Geocoding API

## Convert coordinates to and from places

## Worldwide · Affordable · Reliable · Open Data

- [Live API demo](https://opencagedata.com/demo)
- [Full API docs](https://opencagedata.com/api), [quick start](https://opencagedata.com/api#quickstart), [best practices](https://opencagedata.com/api#bestpractices), [Agent Skill](https://github.com/OpenCageData/opencage-skills/)
- [Geocoding buyer's guide](https://opencagedata.com/guides/how-to-compare-and-test-geocoding-services)
- [Cost comparison with Google Maps](https://opencagedata.com/reducing-your-google-geocoding-costs)
- [Upload a spreadsheet](https://opencagedata.com/tutorials/geocode-a-spreadsheet)

 ![Woman standing in from of a screen showing houses and their geographic coordinates - a metaphor for geocoding](https://assets.opencagedata.com/assets/hp-screen-0253e228b50b69189263529e1a8b65d391f1d5b55ffb0d34b9084ad9cd103332.png "Woman standing in from of a screen showing houses and their geographic coordinates - a metaphor for geocoding")

[Start your free trial](https://opencagedata.com/users/sign_up)

2,500 geocoding API requests/day - No credit card required

## [SDKs](https://opencagedata.com/sdks) and [tutorials](https://opencagedata.com/tutorials) for 40+ languages and frameworks

- [AI / Claude](#)
- [curl](#)
- [Go](#)
- [Java](#)
- [Node](#)
- [Perl](#)
- [PHP](#)
- [Python](#)
- [Ruby](#)

[More SDKs](https://opencagedata.com/sdks)

    

 ![Robert Theml, Director, SIXT Share](https://assets.opencagedata.com/assets/testimonials/roberttheml-b0b865a8b7ada183ac280d3b631b36ba673d1887a686240a5e5f8d7d9de1b804.jpg "Robert Theml, Director, SIXT Share")
Using open data has many benefits, doing it via OpenCage means one less thing for us to maintain.
**Robert Theml** · Director · [SIXT Share](https://www.sixt.de/en/share/)

### Customers around the world

- [CallPass](https://callpass.com)
- [cowboy](https://cowboy.com)
- [Datawrapper](https://www.datawrapper.de)
- [FORMATION](https://tryformation.com)
- [GPS Chile](https://www.gpschile.com)
- [Joblift](https://joblift.de)
- [LightBug](https://lightbug.io)
- [Nexxiot](https://nexxiot.com)
- [Schibsted](https://www.schibsted.com)
- [Phillips Connect](https://www.phillips-connect.com)
- [Sixt](https://www.sixt.com)
- [smugmug](https://www.smugmug.com)
- [stuart](https://stuart.com)
- [Telit](https://www.telit.com)
- [Vismo](https://www.vismo.com)
- [Vimcar](https://vimcar.de)

## Why OpenCage?

## A trusted, long-term partner

- **Thousands of satisfied customers worldwide** , tens of millions of API requests per day
- **Here today, here tomorrow**. Funded by customers, not VCs, since 2013. [Read our story](https://opencagedata.com/about#independent)
- Redundant EU data centers, [fully GDPR compliant](https://opencagedata.com/gdpr)
- [Independently monitored uptime](https://status.opencagedata.com)
- All API requests via 256-bit SSL encryption (HTTPS)
- Responsive, human (no AI) support. [Ask us anything](https://opencagedata.com/contact)
- Proud corporate member of the OpenStreetMap Foundation

 ![Paolo Perrucci, Director ICT Architectures and Operations, Sara Assicurazioni S.p.A](https://assets.opencagedata.com/assets/testimonials/paoloperrucci-10a06ec49f56dcbe05d4563e6489a3981ae828cebebee845eeea1d9eef088d15.jpg "Paolo Perrucci, Director ICT Architectures and Operations, Sara Assicurazioni S.p.A")
We've been a high-volume OpenCage customer for years. Exceptionally stable, very reasonably priced, no stress.
**Paolo Perrucci** · Director ICT Architectures and Operations · [Sara Assicurazioni S.p.A](https://www.sara.it)

## Great product

- Many open geocoders behind a single API
- Most **permissive licensing** in the industry
- **Cache results** as long as you like
- No vendor lock-in, **display results on ANY map**
- ** [Worldwide coverage](https://opencagedata.com/faq#coverage)** 
- Continual updates - OpenStreetMap has **over four million edits/day**

[![Many geocoders behind a single OpenCage API call](https://assets.opencagedata.com/assets/geocoder-one-to-many6-fb2fe05d1b78c4b52b4c6f016225b5e769b646cbe027cdfbd6c4cd29f53dfc0a.png "Many geocoders behind a single OpenCage API call") ](https://opencagedata.com/credits)

 ![Bas Wolff, Product Owner, BigMile](https://assets.opencagedata.com/assets/testimonials/baswolff-b9885ea73a0f71696cfa62f07c6267bba387d0d82a9d7eaf88a4f90b8f354f68.png "Bas Wolff, Product Owner, BigMile")
Fair pricing combined with great service. We are still relieved that we were able to unplug our custom-built geocoder in favour for OpenCage.
**Bas Wolff** · Product Owner · [BigMile](https://www.bigmile.eu)

## Less maintenance

- **Avoid the stress and on-going costs** of maintaining your own system
- **Easy setup:** [Tutorials](https://opencagedata.com/tutorials) and [SDKs](https://opencagedata.com/sdks) for over 40 different programming languages
- **Data enrichment with useful info** like [timezones, Wikidata ids, NUTS codes, FIPS codes, speed limits, UN/LOCODEs, what3words, etc](https://opencagedata.com/api#annotations)
- [Well-formatted address strings](https://opencagedata.com/api#formatted) so your users understand where they are - see [why this matters](https://opencagedata.com/guides/formatting-addresses)

 ![Jordan Hansen, CEO, Cobalt Intelligence](https://assets.opencagedata.com/assets/testimonials/jordanhansen-3e7c3d8aecd106bb2f8315b274d91c068ccd519ccc0b64103e9ee7b9775ca2e7.png "Jordan Hansen, CEO, Cobalt Intelligence")
I love their service so much that I asked OpenCage to let me write a testimonial. I've been a satisfied customer for years.
**Jordan Hansen** · CEO · [Cobalt Intelligence](https://cobaltintelligence.com)

## Affordable, predictable, transparent pricing

- **Generous free testing tier**
- **No credit card required** at sign up
- Subscription and one-time plans
- No tricks. **Cancel anytime** , for any reason
- **No surge or usage charges**
- No long term commitment. **Pay as you go**
- Secure payment in all major currencies
- [See pricing](https://opencagedata.com/pricing)

[![Compare our pricing with Google maps](https://assets.opencagedata.com/assets/pricing-comparison-a0cd6f6dfdefb91125203cc0040ea8cf310efa258f735143e8fa0e166c246645.png "Compare our pricing with Google maps") ](https://opencagedata.com/reducing-your-google-geocoding-costs)
[Compare our pricing with Google maps](https://opencagedata.com/reducing-your-google-geocoding-costs)

 ![Sonnet 4.6, AI model, Claude](https://assets.opencagedata.com/assets/testimonials/claude-c9f1474f6e419731c83e413b52fc2de722626b33cd5f40a6497a24fd947f9d0e.jpg "Sonnet 4.6, AI model, Claude")
Overall: Excellent — among the best documentation I've seen for an API provider.
**Sonnet 4.6** · AI model · [Claude](https://claude.ai/share/7645cbe8-6a18-4efa-a8d6-6afddcef835a)

### Who builds OpenCage? And why?

Friendly humans build OpenCage.

Our mission: to make using open data **easy, dependable,** and ** [much more affordable than proprietary geocoders](https://opencagedata.com/pricing).**

Learn about:

- ** [The team behind the API](https://opencagedata.com/about)** 
- [How we give back to the open geospatial community](https://opencagedata.com/about#geo-innovation)
- [The advantages of open data](https://opencagedata.com/why-use-open-data)

[![OpenCage team lunch 2022](https://assets.opencagedata.com/assets/opencage-teamlunch-882ab7df88d7d795cfdb53b2a37eba6c1d198941f9f64019e298e82809e57309.jpeg "OpenCage team lunch 2022") ](https://opencagedata.com/about)
_The OpenCage team (with advisors) at lunch, March 2022_

### See how OpenCage is used in your industry

- [Fleet Tracking](https://opencagedata.com/solutions/vehicle-tracking)
- [Classifieds](https://opencagedata.com/solutions/classifieds)
- [Academia](https://opencagedata.com/solutions/academia)
- [Data Enrichment](https://opencagedata.com/solutions/data-enrichment)
- [Internet of Things](https://opencagedata.com/solutions/internet-of-things)
- [Image Processing](https://opencagedata.com/solutions/image-processing)
- [Logistics](https://opencagedata.com/solutions/logistics)
- [Micromobility](https://opencagedata.com/solutions/micromobility)
- [Payment Processing](https://opencagedata.com/solutions/payment-processing)

### Questions?

Please [get in touch](https://opencagedata.com/contact) or have a look at our [FAQ](https://opencagedata.com/faq)

=== CLAUDE === ╭─── Claude Code v2.1.84 ────────────────────────────────────────────────────────────────────────────────────────────────╮ │ │ Tips for getting started │ │ Welcome back! │ Run /init to create a CLAUDE.md file with instructions for Claude │ │ │ ───────────────────────────────────────────────────────────────── │ │ ▐▛███▜▌ │ │ │ ▜█████▛▘ │ │ │ ▘▘ ▝▝ │ │ │ │ Recent activity │ │ │ No recent activity │ │ Sonnet 4.6 · Claude Pro · you@example.com's │ │ │ Organization │ │ │ ~/your-working-dir │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ❯&nbsp;grab the opencage geocoding api skill at https://github.com/OpenCageData/opencage-skills/ to learn how to access the api ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ⏺ Fetch(https://github.com/OpenCageData/opencage-skills/) ⎿ &nbsp;Fetching… === BASH === BASE\_URL="https://api.opencagedata.com/geocode/v1/json" curl "$BASE\_URL?q=New+York+City&pretty=1&key=YOUR-API-KEY" # "formatted": "New York City, United States of America", # "confidence": 2, # "bounds": { "northeast": { "lat": 40.9161785, "lng": -73.7001808 }, "southwest": { ... # ... # jq (https://stedolan.github.io/jq/) can filter and extract JSON data curl "$BASE\_URL?q=52.72,6.46&key=YOUR-API-KEY" | jq '.results[0].formatted' # "Fleminghof 21, 7909 AR Hoogeveen, Netherlands" curl "$BASE\_URL?q=52.72,6.46&key=YOUR-API-KEY" | jq '.results[0].components' # { "house\_number": "21", "road": "Fleminghof", "postcode": "7909 AR", "town": ... curl "$BASE\_URL?q=Washington&key=YOUR-API-KEY" | jq '.results[] | [.formatted,.geometry]' # ["Washington, District of Columbia, United States of America",{"lat":38.8950368,"lng":-77.0365427}] # ["Washington, United States of America",{"lat":47.2868352,"lng":-120.212613}] # ["Washington County, Texas, United States of America",{"lat":30.2226352,"lng":-96.3936114}] # ["Washington County, Illinois, United States of America",{"lat":38.3662806,"lng":-89.4201902}] # ["Washington County, Pennsylvania, United States of America",{"lat":40.1943798,"lng":-80.2541251}] # ... === JAVA === // See our full tutorial: // https://opencagedata.com/tutorials/geocode-in-java JOpenCageGeocoder jOCG = new JOpenCageGeocoder("YOUR-API-KEY"); JOpenCageReverseRequest req = new JOpenCageReverseRequest(41.40015, 2.15765); req.setLanguage("es"); // we want Spanish address format req.setLimit(5); // only return the first 5 results JOpenCageResponse res = jOpenCageGeocoder.reverse(req); // get the formatted address of the first result: String fAddress = res.getResults().get(0).getFormatted(); System.out.print(fAddress) // 'Travessera de Gràcia, 142, 08012 Barcelona, España' === PERL === # See our full Perl tutorial # https://opencagedata.com/tutorials/geocode-in-perl use feature qw(say); use Geo::Coder::OpenCage; use Data::Dumper; my $OCG = Geo::Coder::OpenCage-\>new(api\_key =\> 'YOUR-API-KEY'); my $rev\_response = $OCG-\>reverse\_geocode(lat =\> 50.978, lng =\> 11.328); my $result = $rev\_response-\>{'results'}-\>[0]; say $result-\>{'formatted'}; # Brauhausgasse 11, 99423 Weimar, Germany say $result-\>{'components'}-\>{'postcode'}; # 99423 my $resp = $OCG-\>geocode(location =\> "Kirkegata 9, 0153 Oslo"); say Dumper $resp-\>{'results'}-\>[0]-\>{'geometry'}; # { "lat" =\> 59.909836, "lng" =\> 10.743142 } say Dumper $resp-\>{'results'}-\>[0]-\>{'components'}; # { "city" =\> "Oslo", "road" =\> "Kirkegata", "suburb" =\> "Kvadraturen", ... === PHP === # See our full PHP tutorial: # https://opencagedata.com/tutorials/geocode-in-php # install with Composer composer require opencage/geocode require "vendor/autoload.php"; $OCG = new \OpenCage\Geocoder\Geocoder('YOUR-API-KEY'); $results = $OCG-\>geocode('43.77, 11.26') print(results['results'][0]['formatted']) # Via della Vigna Vecchia, 3 R, 50122 Florence FI, Italy $results = $OCG-\>geocode('43.77, 11.26', ['language' =\> 'it']) print(results['results'][0]['components']['country']) # Italia $results = $OCG-\>geocode('2672 Rue Notre-Dame Ouest, Montréal, Canada') print\_r($results); === PYTHON === # See our full Python tutorial: # https://opencagedata.com/tutorials/geocode-in-python from opencage.geocoder import OpenCageGeocode OCG = OpenCageGeocode('YOUR-API-KEY') results = OCG.reverse\_geocode(14.666, 76.833) print(results[0][formatted]) # Sirigedoddi, Gummagatta, India results = OCG.geocode(u'Athens') print(u'%f;%f;%s;%s' % (results[0]['geometry']['lat'], results[0]['geometry']['lng'], results[0]['components']['country\_code'], results[0]['annotations']['timezone']['name'])) # 37.983941;23.728305;gr;Europe/Athens results = OCG.geocode(u'Athens, Texas', language='de') print(results[0]['components']['country']) # Vereinigte Staaten von Amerika === RUBY === # See our full Ruby tutorial: # https://opencagedata.com/tutorials/geocode-in-ruby require 'opencage/geocoder' OCG = OpenCage::Geocoder.new(api\_key: 'YOUR-API-KEY') result = OCG.reverse\_geocode(51.5019951, -0.0698806) p result.address # 'Reeds Wharf, 33 Mill Street, London SE15, United Kingdom' result.components['house\_number'] # 33 results = OCG.geocode('Manchester', language: 'fr') p results.first.address # "Manchester, Angleterre, Royaume-Uni" p results.first.coordinates # [53.47949, -2.24511] === JAVASCRIPT === // See our full nodejs tutorial: // https://opencagedata.com/tutorials/geocode-in-nodejs // // npm install opencage-api-client const opencage = require('opencage-api-client'); opencage.geocode({ q: '37.4396, -122.1864', language: 'fr' }).then((data) =\> { console.log(JSON.stringify(data, null, 2)); // { "components": { "house\_number": "1330", "road": "Middle Avenue", "postcode": "94025", "town": ... if (data.status.code == 200 && data.results.length \> 0) { console.log(data.results[0].formatted); // "1330 Middle Avenue, Menlo Park, Californie 94025, États-Unis d'Amérique" } }); opencage.geocode({ q: '3629 Yale Street, Vancouver, CA' }).then((data) =\> { console.log(data.results[0].geometry); // { "lat": 49.2909409, "lng": -123.024879 } }).catch((error) =\> { console.warn(error.message) }; === GO === // Installation: // go get github.com/alexliesenfeld/opencage // import "github.com/alexliesenfeld/opencage" client := New("YOUR-API-KEY") // Can be used to control timeouts (e.g., using context.WithDeadline), // cancellation, etc. ctx := context.Background() response, err := client.Geocode(ctx, "52.3877830 9.7334394", &GeocodingParams{ RoadInfo: true, Language: "de", }) ===