Skip to main content

Geocoding API

This document outlines the details of the Geocoding API.

API Description

Objective

The Geocoding API converts an address into geographical coordinates (latitude and longitude) and provides detailed information about the location. It internally maps addresses to the most relevant traceable location and retrieves corresponding latitude and longitude coordinates.

InputOutput
The user's addressIt returns the following details:
  • Latitude
  • Longitude
  • Address components
  • Formatted address
  • Location Type
  • Viewport

caution

There can be a difference between the expected and actual latitude-longitude coordinates based on the user input.

API Endpoint

geoCoding

API Request Details

Overview

The API is RESTful and uses standard HTTP verbs and status codes. The responses are in JSON format.

Authentication

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

Method - POST

Headers

HeaderMandatory or OptionalDescriptionAllowed Values
content-type MandatoryThe media type for the request payload.application/json
appId MandatoryThe application identifier shared by HyperVerge. You can find the details in the dashboard's credentials tab.This should be a unique value.
appKey MandatoryThe application key shared by HyperVerge. You can find the details in the dashboard's credentials tab.This should be a unique value.
transactionIdMandatoryA unique identifier for tracking a user journey.This should be both unique and easily associated with the user's journey in your application(s).

Inputs

The following table provides the details of the fields required for the API's request body:

ParameterDescriptionMandatory or OptionalAllowed ValuesDefault Values
addressThe user's address you want to verifyMandatoryNot ApplicableNot applicable

Request

The following is a standard cURL request for the API:


curl --location --request POST 'https://ind-engine.thomas.hyperverge.co/v1/geoCoding' \
--header 'Content-Type: application/json' \
--header 'appId: <Enter_the_HyperVerge_appId>' \
--header 'appKey: <Enter_the_HyperVerge_appKey>' \
--header 'transactionId: <Enter_the_HyperVerge_transactionID>' \
--data '{
"address": "<Enter_the_address>"
}'

Success Response

The following is a success response from the API:

{
"status": "success",
"statusCode": "200",
"result": {
"addressComponents": [
{
"long_name": "<Address_Component_Long_Name>",
"short_name": "<Address_Component_Short_Name>",
"types": [
"<Address_Component_Type_1>",
"<Address_Component_Type_2>"
]
}
],
"formattedAddress": "<Formatted_Address>",
"latitude": "<Latitude_Coordinate>",
"longitude": "<Longitude_Coordinate>",
"locationType": "<Location_Type>",
"viewport": {
"northeast": {
"lat": "<Northeast_Latitude>",
"lng": "<Northeast_Longitude>"
},
"southwest": {
"lat": "<Southwest_Latitude>",
"lng": "<Southwest_Longitude>"
}
}
},
"metaData": {
"requestId": "<Request_Identifier>"
}
}

Success Response Details

ParameterTypeDescription
addressComponentsarrayAn array containing the separate components applicable to this address. Each component is an object containing information such as long name, short name, and types
formattedAddressstringA string containing the human-readable address of this location
latitudenumberThe latitude coordinates for the location
longitudenumberThe longitude coordinates for the location
locationTypestringStores additional data about the specified location. Possible values include "ROOFTOP", "GEOMETRIC_CENTER", "APPROXIMATE", or "RANGE_INTERPOLATED"
viewportobjectThe recommended viewport for displaying the returned result. It is specified as two latitude and longitude values defining the northeast and southwest corners of the viewport. Generally, the viewport is used to frame a result when displaying it to a user.

Failure Response


{
"status": "failure",
"statusCode": 400,
"error": "ZERO_RESULTS",
"metaData": {
"requestId": "<Request_Identifier>"
}
}

Error Response Samples

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

Failure and Error Response Details

A failure or error response from the module contains a failure status, with a relavant status code and error message. The following table lists all error responses.

Status CodeError MessageError Description
400ZERO_RESULTSThe API failed to retrieve a location against
400Missing required request parametersSome mandatory request parameters are missing in the API request made. Check if "address" is given in request body.
401Missing/Invalid credentialsThe request is either missing the mandatory appId and appKey combination or has invalid values
403Access DeniedPlease contact the HyperVerge team for resolution
500Internal Server ErrorPlease check the request headers or contact the HyperVerge team for resolution
Was this helpful?
Ask AIBeta
Hi! How can I help?
Ask me anything about HyperVerge products, APIs, and SDKs.
Try asking: