Geocoding API / Address to lat long api

Geocoding API

Search addresses with confidence

Geocoding API (or Forward Geocoding) lets you convert addresses to latitude/longitude.

Our API returns well-formed and accurate addresses along with their geographical coordinates. Display addresses on a map, use them to plan a delivery route, or estimate the distance between locations for your drivers or customers.

For example, when you search "14 Grange Rd., London" with Geocode API, it will take you to "14 Grange Road, London, N6 4DG, United Kingdom" with longitude: -0.1537649, latitude: 51.576525, and offer other helpful information such as the timezone, and structured address.

Try Geocoding API

Enter the addresses you want to search in the text field and press "Geocode" to find the corresponding locations. You have the option to limit your search within a country, and select the language for the geocoding results:

The demo shows only a few of the options available with Geocoding API. The API has more options to help you to get accurate results for your use case. Read the documentation and try more options with our Playground >>

What Is Geocoding?

Geocoding gives you the corresponding geographical coordinates for a postal address. This is highly valuable to businesses. You can add geographical data to your existing customer data, enable location analytics, and verify postal addresses in payment and shipment forms.

  • Geocoding API also returns valuable information about each location, such as corresponding timezone, and structured and formatted addresses.
  • Geocoding also works with incorrect addresses or addresses with errors or misspellings.
  • Geoapify Geocoding API doesn't just return the address. It also shows confidence coefficients to help you decide if the address is correct.

Address by Latitude/Longitude?

Reverse geocoding returns corresponding address for given Lat/Lon or GPS coordinates.

This helps you to get the address by customer location or when the user clicks on a map.

Address Suggestions in a Drop-Down?

Address autocomplete returns suggestions for a given part of the address, starting from a few symbols.

This helps to enter cities, postcodes, or complete addresses easily.

Use Cases

Our Geocoding API can help your business find locations, and verify and validate addresses.

Find corresponding locations for addresses

  • If you have addresses (for example, a customer database), our API helps you find the corresponding coordinates for them.
  • Use this for analytics and location intelligence. For example, you can analyze your customers' density in different regions and plan marketing campaigns accordingly.
  • Get locations in JSON or CSV formats.
  • Store address and location data on your side without restrictions or additional costs.

Do you have millions of addresses to deal with? Then we can geocode them for you. Contact us - we'll work with you to find the best terms and conditions for your needs.

Verify and validate shipment or payment addresses

Make sure addresses entered in an address form are valid. Checking addresses prevents fraud, and delivery errors.

  • Our Geocoding API returns confidence levels for each address, to help you decide whether the address is valid, or if you need to make additional checks.
  • Here is an example of How to validate and verify addresses >>

Features and capabilities

Free-form and structured addresses

You can enter free-form addresses as well as structured addresses. So you can geocode an address string, as well as address components. For example, here are the URLs for a free-form string, and a structured address:

A free-form address URL ("11 Rue Grenette, 69002, Lyon, France"):

https://api.geoapify.com/v1/geocode/search?text=11%20Rue%20Grenette%2C%2069002%20Lyon%2C%20France&apiKey=YOUR_API_KEY

A structured address URL ("11 Rue Grenette, 69002, Lyon, France" as structured address):

https://api.geoapify.com/v1/geocode/search?housenumber=11&street=Rue%20Grenette&postcode=69002&city=Lyon&country=France&apiKey=YOUR_API_KEY

International addresses and multilanguage support

Our Geocoding API returns international addresses in any language. We use multiple datasets, including including OpenStreetMap, OpenAddresses, Who's on First, Geonames, Wikipedia, and more.

Moreover, we can import the custom datasets on request.

Address search with confidence

The Geocoding API searches for the most relevant and accurate results, every time. Even if the address string has ambiguous formatting, mistakes, or insufficient information.

Our API parses and cleans up the request and performs several rounds of searches using different address strings. Finally, it chooses the one that fits best.

Our confidence level rating and match type parameters help you figure out location accuracy even if the address was incorrect or incomplete. We use three confidence values to validate and verify each address:

  • confidence - the whole address confidence rate
  • confidence_city_level - confidence rate for the city, showing whether the city is correct
  • confidence_street_level - confidence rate for the street, showing if the street is correct
  • confidence_building_level - confidence rate for the building, indicating if the building is correctly identified

Learn more about Geocode API result objects >>

Set filters and narrow your search

The Geoapify Geocoding API accepts additional parameters so you can set a preferred area for your search, or filter results by location:

  • Search by country, state, city, postcode, street, or amenity;
  • Limit search to countries, view box or by radius;
  • Set biases to add priority to locations.
Search a street near a location (Avenue Francois-Besson near Geneva, Switzerland - 46.197757, 6.137464):
https://api.geoapify.com/v1/geocode/search?text=Avenue%20Francois-Besson&bias=proximity:6.137464,46.197757&apiKey=YOUR_API_KEY
Search a city in the country (Paris city in the United States):
https://api.geoapify.com/v1/geocode/search?text=Paris&filter=countrycode:us&apiKey=YOUR_API_KEY
Search within a bounding (Disneyland in the bounding box of Paris, France):
https://api.geoapify.com/v1/geocode/search?text=Disneyland&limit=10&filter=rect:1.860012,48.624200,2.847246,49.1148054&apiKey=YOUR_API_KEY

Single Address Search and Batch API calls

You can send single geocoding requests or batch requests. Let's look at their purposes and specifics:

Single Address API Calls

  • Return corresponding location for 1 address
  • Synchronous - you send request and get response
  • 1 API call costs 1 credit
  • Main purpose - real-time address search, address verification / validation

Batch API Calls

  • You can send up to 1000 addresses in one request
  • Asynchronous - you create a geocoding job, and get results with separate request
  • 1 address costs 0.5 credits
  • Main purpose - search and validate a large number of addresses
Geocoding a single address ("Bruderhofstraße 12, 60388, Frankfurt, Germany"):
https://api.geoapify.com/v1/geocode/search?text=Bruderhofstra%C3%9Fe%2012%2C%2060388%20Frankfurt%2C%20Germany&format=json&apiKey=YOUR_API_KEY
Batch Geocoding call example (HTTP Post):
type: "HTTP POST"
url: "https://api.geoapify.com/v1/batch/geocode/search?&apiKey=YOUR_API_KEY"
headers: "Content-Type=application/json"
body: [
  "0605 SW 62nd Avenue, Pinecrest, FL 33156-4019, United States of America",
  "7000 Southwest 95th Street, Pinecrest, FL 33156, United States of America",
  "5830 Southwest 94th Street, Pinecrest, FL 33156, United States of America"
]

Go here to learn more about Batch Requests >>

Getting started

You can geocode addresses using our Geocoding API. Find tutorials here to help you get started.

Below are simple steps to geocode an address:

Step 1. Register and get an API Key

You will require an API Key to use the API:

  • register on MyProject Geoapify page;
  • create a new project;
  • go to the "API keys" page and get an API key.

On the Getting Started with Maps API page, you'll find detailed information about how to create a project, generate an API key, and get started developing with the Maps API.

Step 2. Generate and call HTTP GET API request

The API responds to HTTP Get requests. The typical geocoding request URL looks like:

https://api.geoapify.com/v1/geocode/search?text=4107%20East%20Princeton%20Avenue%2C%20Gilbert%2C%20AZ%2085234%2C%20United%20States%20of%20America&format=json&apiKey=YOUR_API_KEY

Note that you will need to use the encodeURIComponent() function or similar to generate the correct URL for the street address search.

Visit our documentation page for more information about the API parameters, or visit Geocoding API Playground to generate a URL.

Step 3. Get the API result object

The API returns result in JSON format. Here is an example of the API result object:

    • [] 1 item
      • {} 2 keys

      Geocoding API code samples

      You can call the API with any programming language that allows sending HTTP requests. The following examples show how to make an API call:

      Geocoding JavaScript

      JavaScript fetch() function provides a convenient and straightforward mechanism for external APIs and resources. The fetch interface allows parsing a JSON object from the response:

      const address = 'Baldersgade 3B, 2200 Copenhagen, Denmark';
      
      fetch(`https://api.geoapify.com/v1/geocode/search?text=${encodeURIComponent(address)}&apiKey=YOUR_API_KEY`)
      .then(resp => resp.json())
      .then((geocodingResult) => {
      	console.log(geocodingResult);
      });

      Check out the code samples generator on the Playground page >>

      Pricing details

      We know affordability matters. That's why we've kept our pricing fair, reasonable, and straightforward.

      We measure cost in credits. It's simple: 1 credit = 1 geocoding request.

      Our freemium pricing model is great for your budget! Our free plan includes 3000 credits per day.

      Need more credits? Check out our affordable Pricing Plans. Only need geocoding for a one time job? No problem, you can subscribe for one month only.

      Want to save more? Batch Geocoding Requests are up to 50% cheaper.

      Have questions? Get in touch and we'll help. Need to geocode high volumes of addresses? We can set the process up for you. Just reach out.

      Tutorials for Accurate and Efficient Address Processing

      Discover a range of tutorials that cover everything you need to know about the Geoapify Geocoding API, from basic address lookup to advanced geocoding techniques and optimization.

      The image illustrates the concept of bulk geocoding while efficiently managing API rate limits

      JavaScript Tutorial: Batch Geocoding and API Rate Limits

      Effortlessly batch geocode numerous addresses in JavaScript. Learn to manage API rate limits with raw code and the request-rate-limiter library.
      Search addresses to store them in your database or display them on a map

      Geocoding in Python

      A step-by-step guide that shows how to geocode addresses using Python, HTTP requests, and the Geoapify Geocoding API
      The addresses geocoded with Geoapify Geocoding API to CSV

      No-code Tutorial: Batch Geocode to CSV/JSON

      Learn how to geocode a list of addresses into a CSV or JSON format with HTTP requests in Postman

      These tutorials will guide you through various aspects of the Geoapify Geocoding API, helping you enhance your geocoding capabilities for any project, big or small.

      FAQ

      Geocoding works well with addresses in the United States but doesn't always search correctly for locations in my country. Can you improve that?

      Definitely! We always try to parse an address before the search, and address formats of many countries are parsed correctly. But we know that occasionally an address format, especially if it contains additional information, doesn’t return the accurate results you need. If you run into a problem, send us the addresses that aren’t getting found, so we can improve the geocoding service.

      Will the geocoding work if an address contains partially incorrect information? For example, a postcode consisting of the wrong numbers?

      We try to search the address using different address components and close to the given postcode or city. Therefore, the geocoder should give correct results if the address is located nearby. Please contact us if you do not get the expected results.

      We have high volumes. What can you offer us?

      We have pricing plans corresponding to different loads and volumes. A dedicated API server with unmetered geocoding starts from just 700€.

      Can I use the free pricing plan for a commercial solution?

      Yes, you can. But please remember to provide a follow-link to Geoapify on your website. For example, Powered by <a href="https://www.geoapify.com/">Geoapify</a> near information about Geocoding service.

      Is the geocoding API service GDPR-compliant? Where are your servers located?

      We are a German company and our services are GDPR-compliant. Our default API endpoints only use European data centers. Dedicated endpoints can utilize other server locations if you need them to, including those located in your intranet.

      How are batch geocoding requests different from single requests?

      The batch geocoding requests are asynchronous. That means you send a request to create a geocoding job and get the job ID. Then check the job status with separate requests, for example, every second. When job status is 200, the results are returned. Check our code samples of batch geocoding requests .

      Why are batch geocoding requests cheaper?

      Batch geocoding requests utilize free server capacity so allow us to optimize the server load. That means we can keep the price point low.

      Do your terms & conditions allow storing the received result?

      Our services are based on Open Data. So we do not restrict you from storing results. However, you have to keep all the attributions to the data source with the stored object or make it visible in some other way when you reuse the data.

      What is the rate limit for Geocoding requests?

      The rate limit indicates the maximum amount of requests per second. Depending on the pricing plan, we offer up to 30 requests/sec for Geocoding API requests. Higher rate limits are also available on request.

      World map

      Ready To Get Started?

      Get an API key and start Geocoding! Don't forget to check our tutorials for code samples.

      Need further help? Get in touch and we'll be happy to help you find what you need.