LocateOne DocsBrowse docs →

Using the Geocoding API

Learn how to make a geocoding request using the Geocoding API. This document provides detailed instructions on making a POST request to the Geocoding endpoint, including necessary address details in the request body. The API will respond with a JSON conta

Making a Request

To geocode an address, make a POST request to the Geocoding endpoint with the address details in the request body.

Request body:

The request body should contain the data object with the following fields:

FieldRequired/OptionalTypeDescription
addressRequiredstringThe street address which you want to geocode.
pincodeOptionalstringPincode associated with the provided address.
cityOptionalstringCity associated with the provided address.
stateOptionalstringState associated with the provided address.

Example Request:

{
  "data": {
    "address": "Delhivery Corporate Office, Sector 44, Gurugram",
    "pincode": "122003",
    "city": "Gurgaon",
    "state": "Haryana"
  }
}

Understanding the Response

The Geocoding API will return a JSON response with the geocoded coordinates of the address.

Response Schema:

FieldTypeDescription
successbooleanIndicates if the request was successful. true if successful, false if there was an error.
status_codenumberStatus code of the request.
messagestringInformation about the processed request.
request_idstringA unique id for the request.
resultobjectContains the geocoded coordinates and the confidence radius.
result.latnumberThe latitude part of the geographical coordinates.
result.lngnumberThe longitude part of the geographical coordinates.
result.confidence_radiusnumberIt is a measure of horizontal accuracy that indicates the actual address will be within the radius of x meters around the predicted geocode.

Example Response:

{
  "success": true,
  "status_code": 200,
  "message": "Request has been processed",
  "request_id": "AX34687667877689",
  "result": {
    "geocode": {
      "lat": 28.454736,
      "lng": 77.070171
    },
    "confidence_radius": 24 // Unit is in meters
  }
}

In the result object, you'll find the geocoded coordinates (lat and lng) and the confidence_radius, which indicates the accuracy of the geocoded location.