Using the Geocoding API
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:
Field | Required/Optional | Type | Description |
---|---|---|---|
address | Required | string | The street address which you want to geocode. |
pincode | Optional | string | Pincode associated with the provided address. |
city | Optional | string | City associated with the provided address. |
state | Optional | string | State associated with the provided address. |
Example Request:
The Geocoding API will return a JSON response with the geocoded coordinates of the address.
Response Schema:
Field | Type | Description |
---|---|---|
success | boolean | Indicates if the request was successful. true if successful, false if there was an error. |
status_code | number | Status code of the request. |
message | string | Information about the processed request. |
request_id | string | A unique id for the request. |
result | object | Contains the geocoded coordinates and the confidence radius. |
result.lat | number | The latitude part of the geographical coordinates. |
result.lng | number | The longitude part of the geographical coordinates. |
result.confidence_radius | number | It 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:
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.