Command line Geocoding Tutorial

Using the OpenCage Geocoding API from the command line

The API is is accessed via an HTTP GET request with a few parameters. There is no need to set any headers or cookies.

curl

$ curl 'https://api.opencagedata.com/geocode/v1/json?q=-23.5373732,-46.8374628&pretty=1&key=YOUR-API-KEY'

HTTPie

$ http GET https://api.opencagedata.com/geocode/v1/json q==-23.5373732,-46.8374628 pretty==1 key==YOUR-API-KEY

WGET

$ WGET 'https://api.opencagedata.com/geocode/v1/json?q=-23.5373732,-46.8374628&pretty=1&key=YOUR-API-KEY' -O results.json

Further Reading

Start your free trial

2,500 API requests per day.

No credit card required.