IP to Location API

IP to Location API

Locate and identify website visitors' info (latitude, logintude, connection, currency, timezone etc...) by IP address.
Free Plan $0.00 Monthly Subscribe
10,000 Requests / Monthly
Free for Lifetime
No Credit Card Required
Starter Plan $7.99 Monthly Subscribe
60,000 Requests / Monthly
Standard Support
Ultra fast
Competitive price
Pro Plan $29.99 Monthly Subscribe
300,000 Requests / Monthly
Standard Support
Ultra fast
Competitive price
Custom Plan Volume Monthly Contact Us
Any requests volume you need
Ultra fast
Competitive price

IP to Location API is a REST API which provides the essential data from any IP address in JSON format over HTTPS such as:

  • Country / City / State / Continent
  • Latitude and Longitude
  • Local currency
  • Internet Service Provider (ISP) lookup
  • Country calling code and Time Zone

See it in Action!

How do I use IP to Location API?

Below is a sample code querying for IP address

curl --location --request \
GET 'https://api.apilayer.com/ip_to_location/' \
--header 'apikey: YOUR API KEY'

Check out the response below

    "ip": "",
    "type": "ipv4",
    "country_code": "BD",
    "country_name": "Bangladesh",
    "region_name": "Dhaka",
    "city": "Dhaka",
    "latitude": 23.7104,
    "longitude": 90.40744,
    "continent_code": "AS",
    "continent_name": "Asia",
    "is_eu": false,
    "connection": {
        "asn": 58715,
        "isp": "Earth Telecommunication ( pvt ) Limited"
    "location": {
        "capital": "Dhaka",
        "native_name": "Bangladesh",
        "flag": "http://assets.apilayer.com/flags/BD.svg",
        "top_level_domains": [
        "calling_codes": [
    "currencies": [
            "name": "Bangladeshi taka",
            "code": "BDT",
            "symbol": "৳"
    "timezones": [

Use cases for IP to Location API

Knowing from where people access you extends your brand’s reach through the market and helps you create a more accurate customer base. You can think of any service to relate with a user’s location information but here are the most popular location-based use cases:

  • For geo-targeting your customers by content personalization
  • For any service that sends location-based push notifications
  • For mapping any social experiences through photos, trips, check-ins etc.
  • For using targeted ads and any other location-based marketing purposes
  • For any kind of services offering solutions for local community needs such as healthcare, municipality, social services, transportation
  • For detecting any abnormal activities within an area worth considering in terms of security concerns
  • For collecting user behavior data on specific purposes such as a new investment for businesses

IP to Location API Reference

This API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

Just Getting Started?

Check out our development quickstart guide.


IP to Location API uses API keys to authenticate requests. You can view and manage your API keys in the Accounts page.

Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.

All requests made to the API must hold a custom HTTP header named "apikey". Implementation differs with each programming language. Below are some samples.

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.


Fetches the geo location as well as many other from the IP address


ip (required)

Ipv4 IP Address

Location: Path, Data Type: string

** A word enclosed with curly brackets "{ }" in the code means that it is a parameter and it should be replaced with your own values when executing. (also overwriting the curly brackets).

Below is a sample response from the endpoint

If you wish to play around interactively with real values and run code, see...

Rate Limiting

Each subscription has its own rate limit. When you become a member, you start by choosing a rate limit that suits your usage needs. Do not worry; You can upgrade or downgrade your plan at any time. For this reason, instead of starting with a larger plan that you do not need, we can offer you to upgrade your plan after you start with "free" or "gold plan" options and start using the API.

When you reach a rate limit (both daily and monthly), the service will stop responding and returning the HTTP 429 response status code (Too many requests) for each request with the following JSON string body text.

"message":"You have exceeded your daily\/monthly API rate limit. Please review and upgrade your subscription plan at https:\/\/apilayer.com\/subscriptions to continue."

A reminder email will be sent to you when your API usage reaches both 80% and 90%, so that you can take immediate actions such as upgrading your plan in order to prevent your application using the API from being interrupted.

You can also programmatically check your rate limit yourself. As a result of each request made to the APILayer, the following 4 fields provide you with all the necessary information within the HTTP Headers.

x-ratelimit-limit-month: Request limit per month
x-ratelimit-remaining-month: Request limit remaining this month
x-ratelimit-limit-day: Request limit per day
x-ratelimit-remaining-day: Request limit remaining today

You can contact our support unit if you need any assistance with your application regarding to handle the returned result by looking at the header information.

Error Codes

APILayer uses standard HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate a clientside error, which means that failed given the information provided (e.g., a missing parameter, unauthorized access etc.). Codes in the 5xx range indicate an error with APILayer's servers (normally this should'nt happen at all).

If the response code is not 200, it means the operation failed somehow and you may need to take an action accordingly. You can check the response (which will be in JSON format) for a field called 'message' that briefly explains the error reported.

Status Code Explanation
400 - Bad Request The request was unacceptable, often due to missing a required parameter.
401 - Unauthorized No valid API key provided.
404 - Not Found The requested resource doesn't exist.
429 - Too many requests API request limit exceeded. See section Rate Limiting for more info.
5xx - Server Error We have failed to process your request. (You can contact us anytime)

You can always contact for support and ask for more assistance. We'll be glad to assist you with building your product.