Geocoding API Accurate | Documentation & Examples
Before you begin
Likewise, reverse geocoding converts geographic coordinates into a readable address.
How to use Geocoding API
After submitting your request, the service responds with a JSON-formatted document containing the most relevant results, ideally structured for straightforward use and integration with various platforms – from web browsers to different types of applications.
Security is important and HTTPS is recommended whenever possible, especially for applications that include sensitive user data, such as a user's location, in requests. Using HTTPS encryption makes your application more secure, and more resistant to snooping or tampering.
Below you can find examples and instructions on our geocoding APIs HTTPS requests, suitable for a broad array of approaches – whether through a web browser, any platform or application of your choice or systems like Postman. This guidance includes comprehensive descriptions on forming requests and interpreting responses across different environments.
How to use Geocoding API through Postman
One of the easiest and most efficient ways to start interacting and integrating our API into your projects is using Postman, known for its user-friendly interface and powerful features.
Here's how to do it:
- To get started with Postman, install it on your computer or access a browser web version.
- Import our pre-configured API collection:
- Open Postman
- Click on the “Import” button in the top left corner.
- Select “Import from link” and paste this Postman collection link: https://www.postman.com/distancematrix/workspace/distance-matrix/overview
- Upon importing, Postman will automatically add the collection into your workspace.
- For users of the online version of Postman, you can directly open the collection link and create a fork. Do this by clicking on the three dots next to the collection name.
- Set up your environment in Postman, go to the Variables section and add your authentication token in the “API Authorization Token” field.
- Don't forget to save these changes.
- Make your first request: Select an endpoint from our collection, configure your request parameters, and hit send to see the response.

-min.webp)
-min.webp)
-min.webp)
Once you're comfortable with the basics, you can explore more advanced features of our API. Our detailed documentation below will guide you through the specific functionalities of our API.
Direct Geocoding Developer Guide
API Request Format
- Base URL: In the DistanceMatrix.ai geocoding service, requests are structured as URLs with required and optional parameters, separated by the ampersand (&) character. Use HTTPS encryption for security: https://.
- Domain: The domain for the DistanceMatrix.ai API accurate is api.distancematrix.ai
- Request URL: For geocoding, it’s /maps/api/geocode/json.
- Parameters: Parameters are additional pieces of information that are added to the request URL to provide specific details to the API. These parameters can be categorized into two types: required and optional.
- Required parameters are mandatory for the API to successfully process the request because they provide essential information without which the API cannot perform the intended operation. Thus, in a geocoding API request, the address for which you need the geographic coordinates is a required parameter. Without this address, the API wouldn't know what location to geocode. For example, for such a place of interest as Anne Frank House ?address=Westermarkt+20,+1016+GV+Amsterdam,+Netherlands specifies the address for standard geocoding.
- Optional parameters are not required, but can be included to refine or customize the API response. Optional parameters can provide additional control over the format of the API response, the language in which data is returned, or other specifics relevant to the request. For example, in a geocoding request, an optional parameter might be the language in which you want the results to be returned, like &language=uk for specifying a language preference. Including this parameter is not necessary for the geocoding function itself, but it can improve the usability of the data.
- Authorization Token: Include your unique access token as &key=<your_access_token> to authenticate the request.
Optional parameters in a Geocoding request:
- See the list of supported languages.
- The geocoder defaults to the language specified in the Accept-Language header or the native language of the request's domain if no language is provided.
- To ensure readability, the geocoder returns street addresses in the local language, using transliteration when necessary, based on the user's preferred language. All address components are delivered in the same language, determined by the first component's language.
- If an address name isn't available in the preferred language, the geocoder selects the closest available match.
- The preferred language subtly influences the selection and order of results, as the geocoder interprets abbreviations and synonyms differently across languages. For instance, 'utca' and 'tér' in Hungarian correspond to 'street' and 'square.’
Required parameters in a geocoding request:
address=100%20Queens%20Park%20Toronto%20ON where "100 Queens Park, Toronto, ON" is the address of the Royal Ontario Museum
Geocoding Responses
Note that these results generally need to be parsed if you wish to extract values from the results.
Status Codes
Error Messages
*Note: The “error_message” field may not always be available, and its contents may change.
Results
Typical fields in a result include:
- location: Contains latitude and longitude. It's typically crucial for standard address lookups.
- location_type: Provides additional details about the location, with values like:
- "ROOFTOP": A precise geocode with street address precision.
- "RANGE_INTERPOLATED": An approximate result between two precise points, usually used when rooftop data isn’t available.
- "GEOMETRIC_CENTER": The geometric center of a line or area.
- "APPROXIMATE": An approximate location.
Address Types and Address Component Types
The geocoder supports and returns various types in both address type and component type arrays:
FAQ
What differentiates this API from other Geocoding APIs?
The Distancematrix.ai Geocoding API has several factors that differentiate it from other geocoding APIs:
- High Accuracy: The Distancematrix.ai Geocoding API uses advanced algorithms and data sources to provide accurate and reliable geocoding results. The API also has a high success rate for matching addresses, which means that it can handle a wide range of address formats and variations.
- Global Coverage: The API covers a wide range of countries and regions, including hard-to-reach places like rural areas, islands, and developing countries. This means that users can rely on the API to provide accurate results no matter where their data is coming from.
- Speed and Scalability: The API is designed to handle large volumes of geocoding requests quickly and efficiently.
- Cost-Effective: The API offers a simple and transparent pricing model, with no hidden fees or upfront costs. The API offers a Free plan and a Growth plan with pay-as-you-go pricing model.
Can I use this API as a converting address to lat long API?
Yes, you can use the Distancematrix.ai Geocoding API to convert addresses to latitude-longitude coordinates. In fact, that is one of the primary functions of an address to lat long API like this one.
To use the API for geocoding, you would send a request to the API with an address parameter, and the API would respond with the corresponding lat-long coordinates for that address.
The Distancematrix.ai Geocoding API is designed as a get latitude longitude from address API that is easy to use. It can be integrated into a wide range of applications and platforms. The API supports a variety of programming languages and frameworks, including Python, JavaScript, and PHP, among others.
Can I use this API as a latitude longitude API converter to human-readable addresses?
Yes, you can use the Distancematrix.ai Geocoding API to convert latitude-longitude (lat-long) coordinates to human-readable addresses. This process is also known as reverse geocoding and developers usually search for a latitude and longitude API or for aget coordinates from address API.
To use the API for reverse geocoding, you would send a request to the API with the latitude and longitude parameters, and the API would respond with the corresponding human-readable address for those coordinates.
If you have any questions or need further assistance in using the API for your reverse geocoding needs, the Distancematrix.ai team provides detailed documentation and customer support to help you get started.
What can you do with the Geocoding API?
Many companies and enterprises use software and applications to locate stores, warehouses, vehicles, and customers, to control transportation and movements that deal with geocoding. But currently, its definition is not limited to address searches. It is quite a universal tool that allows you to apply it to the overall market, from precise location and route mapping to customer data analysis and geographic pattern recognition.
This solution is in handy among, for example, taxi drivers in case they lack accurate data about the clients' destination addresses. Also, this service is convenient for food delivery couriers in their daily routines. You can read other successful geocoding API examples using our website.
Why use the Geocoding API?
The Distancematrix.ai APIs offer best-in-class accuracy that rivals industry giants but at a much more affordable price, greater scalability, and a friendly, real human support team that is always available to help you with your questions. An added benefit is the ease of transition from other vendors, ensuring a smooth switching process.
In addition, Distancematrix.ai allows users to test the service without the need to attach a credit/debit card before making a final decision. This is done so that users can verify the quality and value of the results obtained. Feel free to try to make sure that Distancematrix.ai is a high-quality and fast, yet cost-effective solution. What’s more, even during the trial period, users can reach out to the live support available for any queries.
What is a geocoding API?
A geocoding API is a service that converts street addresses into geographic coordinates (latitude/longitude) and vice versa. It enables applications to accurately place locations on maps, calculate distances between points, and perform location-based operations.
Is the Geolocation API free?
Yes, the Geolocation API offers a free plan where you can use up to 1000 elements per month.