Documentation
    Amazon Web Services
    Microsoft Azure
    RapidAPI
    APILayer
Last Update: 2024-03-28

IP Address Geolocation API


Table of Content


Subscribe on AWS Marketplace
Code sample
API endpoint: /get-location
Troubleshooting

Subscribe on AWS Marketplace


Navigate to our product listing on the AWS Marketplace. Select the "View purchase options" button to proceed.

On the following page, click the "Subscribe" button to initiate the subscription process.

After subscribing, you will need to set up your account on our platform. Do this by clicking the "Set up your account" link provided.

You will be directed to the registration page. Here, fill in your account details in the provided fields. Once you have entered all necessary information, click the 'Subscribe' button to proceed.

Upon successful registration, your unique API key will be displayed. It is crucial to store this key in a secure location for future use.

Code Samples


The code samples below calls the '/get-location' endpoint in order to retrieve the country, state, city, and latitude/longitude for the specified IP address. Replace <YourApiKey> with the actual API Key you received during the sign-up process:

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://ip-aws.silverlining.cloud/get-location");
request.Headers.Add("x-api-key", "<YourApiKey>");
var content = new StringContent("{\n    \"ip_address\": \"143.50.237.65\"\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
API endpoint: /get-location


URL endpoint: https://ip-aws.silverlining.cloud/get-location


Method: POST


"header": {
  "x-api-key": STRING,
  "Content-Type": "application/json"
}


"body": {
  "ip_address": STRING
}



Required

"ip_address": The IP address for which geolocation information is required.


Response:

"body": {
  "ip_address": STRING,
  "country": STRING,
  "state": STRING,
  "city": STRING,
  "latitude": NUMBER,
  "longitude": NUMBER
}   


"ip_address": The provided IP address.
"country": The country to which the IP address is assigned.
"state": The state or province to which the IP address is assigned.
"city": The city to which the IP address is assigned.
"latitude" / "longitude": The latitude and longitude geolocation of the assigned city.

Troubleshooting

"message": "Invalid Input: The request contains incorrectly formatted parameters"

This error message means that the body parameters you have passed are malformed. Please follow the instructions given in the endpoint descriptions. Common issues include forgetting to add a comma (',') after every parameter line or missing a parenthesis somewhere.

"message": "Endpoint request timed out"

You receive this error message when the code execution exceeds the maximum timeout (usually 29 seconds).