Skip to main content

Geo-IP API

The following document highlights the details of the Geo-IP API.

API Description

Objective

The Geo-IP API accepts an IP address and responds with the geolocation details.

InputOutput
An IP address (optional - defaults to the public IP address of the end user's system)Geolocation details including city, country, coordinates, ISP, organization, and timezone information

API URL

https://<regionCode>.idv.hyperverge.co/v1/geoIp

API Endpoint

geoIp

regionCode Details

The API URL accepts any of the following region code values against the regionCode placeholder.

RegionregionCode Value
Indiaind
USAusa
Africazaf
Europeirl
Singaporesgp
Indonesiaidn

Overview

The Geo-IP API is RESTful and uses standard HTTP verbs and status codes. The responses are in JSON format, and you should send the request body as JSON through a POST request.

Method - POST

Authentication

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

Headers

HeaderMandatory / OptionalDescriptionInput Format
content-type MandatoryThis parameter defines the media type for the request payloadapplication/json
appId MandatoryThe application identifier shared by HyperVerge. You can find the details in the dashboard's credentials tabThis should be a unique value
appKey MandatoryThe application key shared by HyperVerge. You can find the details in the dashboard's credentials tabThis should be a unique value
transactionIdMandatoryUnique ID for the customer journeyAny defined unique value mapped to a transaction in your business ecosystem

Inputs

IP Address Requirements

A Public IP is assigned by your Internet Service Provider (ISP) and is visible on the internet, allowing the Geo-IP API to fetch location data.

In contrast, Private IPs are used within local networks, for example, at home or in an office and cannot be used to retrieve such details, as they are not visible on the public internet.

The following table provides the details of the parameters required for the Geo-IP API's request body:

ParameterMandatory / OptionalTypeDescriptionInput FormatDefault Value
ipOptionalstringThe IP address for verificationValid IPv4 or IPv6 addressThe public IP address of the end user's system

Request

The following code snippet demonstrates a standard curl request for the Geo-IP API:


curl --location --request POST 'https://<regionCode>.idv.hyperverge.co/v1/geoIp' \
--header 'Content-Type: application/json' \
--header 'appId: <Enter_the_HyperVerge_appId>' \
--header 'appKey: <Enter_the_HyperVerge_appKey>' \
--header 'transactionId: <Enter_the_HyperVerge_transactionID>' \
--data '{
"ip": "<Enter_the_IP_address>"
}'

Success Response

The following code snippet demonstrates a success response from the Geo-IP API:

  {
"status": "success",
"statusCode": "200",
"metadata": {
"requestId": "<Unique_Request_ID>",
"transactionId": "<Transaction_ID>"
},
"result": {
"ipAddress": "<IP_Address>",
"geoDetails": {
"as": "<Autonomous_System>",
"city": "<City>",
"country": "<Country>",
"countryCode": "<Country_Code>",
"isp": "<Internet_Service_Provider>",
"lat": "<Latitude>",
"lon": "<Longitude>",
"org": "<Organization>",
"query": "<Query_IP_Address>",
"region": "<Region_Code>",
"regionName": "<Region_Name>",
"status": "<Request_Status>",
"timezone": "<Timezone>",
"zip": "<Zip_Code>"
}
},
"summary": {
"action": "<Action>",
"details": []
}
}

Success Response Details

The following table outlines the details of the success response from the Geo-IP API:

ParameterTypeDescription
statusstringThe status of the request
statusCodestringThe HTTP status code for the response
metadataobjectThe JSON object containing request and transaction identifiers
metadata.requestIdstringA unique identifier for the request
metadata.transactionIdstringA unique transaction identifier for tracking purposes
resultobjectThe JSON object containing the geolocation details
result.ipAddressstringThe IP address used in the request
result.geoDetailsobjectThe JSON object containing detailed geolocation information
result.geoDetails.asstringThe Autonomous System (AS) related to the IP address
result.geoDetails.citystringThe city corresponding to the IP address
result.geoDetails.countrystringThe country corresponding to the IP address
result.geoDetails.countryCodestringThe country code for the IP address location
result.geoDetails.ispstringThe Internet Service Provider (ISP) associated with the IP address
result.geoDetails.latstringThe latitude of the geographical location of the IP address
result.geoDetails.lonstringThe longitude of the geographical location of the IP address
result.geoDetails.orgstringThe organization associated with the IP address
result.geoDetails.querystringThe IP address query
result.geoDetails.regionstringThe region code corresponding to the IP address location
result.geoDetails.regionNamestringThe name of the region corresponding to the IP address location
result.geoDetails.statusstringThe status of the geolocation request
result.geoDetails.timezonestringThe timezone corresponding to the IP address location
result.geoDetails.zipstringThe zip code corresponding to the IP address location
summaryobjectThe JSON object containing the summary of the verification process
summary.actionstringThe result of the verification process, indicating if the request was successful or required further action
summary.detailsarrayAn array providing additional details of the request

Failure Response

The following code snippet demonstrates a failure response from the Geo-IP API when it fails to locate the geo-IP:

 {
"status": "failure",
"statusCode": 400,
"metadata": {
"requestId": "<Request_ID>",
"transactionId": "<Transaction_ID>"
},
"result": {
"error": "Unable to locate geoIp",
"summary": {
"action": "fail",
"details": [
{
"code": "136",
"message": "Unable to locate geoIp"
}
]
}
}
}

Error Responses

The following are some error responses from the Geo-IP API:

{
"status": "failure",
"statusCode": 400,
"metadata": {
"requestId": "<Request_ID>",
"transactionId": "<Transaction_ID>"
},
"result": {
"error": "Unable to locate geoIp",
"summary": {
"action": "fail",
"details": [
{
"code": "136",
"message": "Unable to locate geoIp"
}
]
}
}
}

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
400Unable to locate geoIpGeolocation details could not be fetched due to invalid or unresolvable IPEnsure the IP address is valid and publicly accessible. If not providing an IP, ensure the system has a valid public IP address
500Internal Server ErrorKindly check the request headers or contact the HyperVerge team for resolution.Check the request headers or contact the HyperVerge team for resolution
503Server BusyThe Geo-IP API server is currently busy and cannot process the requestRetry the request after some time or contact the HyperVerge team if the issue persists
Was this helpful?
Ask AIBeta
Hi! How can I help?
Ask me anything about HyperVerge products, APIs, and SDKs.
Try asking: