Skip to main content

Reverse Geocoding API

This document outlines the details of the Reverse Geocoding API.

API Description

Objective

The Reverse Geocoding API converts a latitude-longitude coordinate pair into a human-readable address.

InputOutput
The user's location coordinatesThe user's equivalent human-readable address

API URL

https://ind-engine.thomas.hyperverge.co/v1/reverseGeoCoding

API Endpoint

reverseGeoCoding

Overview

The Reverse Geocoding API is RESTful and uses standard HTTP verbs and status codes. The responses are in JSON format and you should send all data in JSON format through a POST request.

Authentication

You need a unique pair of application ID ( appId ) and application key (appKey) from HyperVerge to verify your identity for accessing the Reverse Geocoding API.

API Request Details

Method - POST

Headers

HeaderMandatory / OptionalDescriptionInput Format
content-typeMandatoryThis parameter defines the media type for the request payload.application/json
appIdMandatoryApplication ID shared by HyperVergeNot Applicable - this is a unique value
appKeyMandatoryApplication Key shared by HyperVergeNot Applicable - this is a unique value
transactionIdMandatoryUnique ID for the user journeyNot Applicable - any defined unique value mapped to a transaction in your business ecosystem

Input

The following table provides the details of the parameters required for the Reverse Geocoding API's request body:

ParameterMandatory / OptionalTypeDescriptionInput FormatDefault Value
latitudeMandatorynumberLatitude in the captured location coordinatesA valid decimal coordinate valueNot Applicable
longitudeMandatorynumberLongitude in the captured location coordinatesA valid decimal coordinate valueNot Applicable

Request

The following code snippet demonstrates a standard curl request for the Reverse Geocoding API:

curl --location --request POST 'https://ind-engine.thomas.hyperverge.co/v1/reverseGeoCoding' \
--header 'Content-Type: application/json' \
--header 'appId: <Enter_the_HyperVerge_appId>' \
--header 'appKey: <Enter_the_HyperVerge_appKey>' \
--header 'transactionId: <Enter_the_HyperVerge_transactionID>' \
--data '{
"latitude": <Enter_the_latitude_coordinates>,
"longitude": <Enter_the_longitude_coordinates>
}'

Success Response

The following is a response for a valid request where the Reverse Geocoding API returns the formatted nearest text address based on the coordinates:

{
"status": "success",
"statusCode": "200",
"metaData": {
"requestId": "<Request_ID>",
"transactionId": "<Transaction_ID>"
},
"result": {
"details": {
"plus_code": {
"compound_code": "<Plus_Code_Compound_Code>",
"global_code": "<Plus_Code_Global_Code>"
},
"results": [
{
"address_components": [
{
"long_name": "<Address_Component_Long_Name>",
"short_name": "<Address_Component_Short_Name>",
"types": [
"<Address_Component_Type>"
]
}
],
"formatted_address": "<Formatted_Address>",
"geometry": {
"location": {
"lat": "<Latitude_Coordinate>",
"lng": "<Longitude_Coordinate>"
},
"location_type": "<Location_Type>",
"viewport": {
"northeast": {
"lat": "<Northeast_Latitude>",
"lng": "<Northeast_Longitude>"
},
"southwest": {
"lat": "<Southwest_Latitude>",
"lng": "<Southwest_Longitude>"
}
}
},
"place_id": "<Place_ID>",
"plus_code": {
"compound_code": "<Plus_Code_Compound_Code>",
"global_code": "<Plus_Code_Global_Code>"
},
"types": [
"<Place_Type>"
]
}
],
"status": "<Status>"
}
}
}

Success Response Details

The following table outlines the details of the success response from the Reverse Geocoding API:

ParameterTypeDescription
result.details.plus_codeobjectContains the plus code information for the location
result.details.resultsarrayArray of address results for the given coordinates
result.details.results[].address_componentsarrayArray of address components for each result
result.details.results[].formatted_addressstringThe complete formatted address
result.details.results[].geometryobjectContains location and viewport information
result.details.results[].place_idstringUnique identifier for the place
result.details.results[].typesarrayArray of place types

Failure Response

The following code snippet shows a response from the Reverse Geocoding API where it returns a success status but with zero results:

{
"status": "success",
"statusCode": "200",
"metaData": {
"requestId": "<Request_ID>",
"transactionId": "<Transaction_ID>"
},
"result": {
"details": {
"results": [],
"status": "ZERO_RESULTS"
}
}
}

Error Responses

The following code snippets show the error responses from the Reverse Geocoding API:

{
"message": "Missing/Invalid credentials",
"statusCode": 401,
"status": "failure"
}

Error Response Details

A failure or error response contains a failure status with a relevant status code and error message. The following table lists all error responses:

Status CodeError MessageError DescriptionError Resolution
200ZERO_RESULTSThe reverse geocoding was successful but returned no results. This may occur if the geocoder was passed a latitude-longitude in a remote location.Verify that the provided coordinates are valid and within a geocodable region
401Missing/Invalid credentialsThe request is either missing the mandatory appId and appKey combination or has invalid valuesProvide valid appId and appKey in the request headers. Check the dashboard's credentials tab
Was this helpful?
Ask AIBeta
Hi! How can I help?
Ask me anything about HyperVerge products, APIs, and SDKs.
Try asking: