ar

introduction

the IPLOCINFO API allows you to retrieve information about a specific IP address and user agent. The API offers six main modules - user-agent module, location data, currency data, language data, connection module, and security data. With this information, you can gain a deeper understanding of your website's audience and make data-driven decisions to optimize your online presence.

authentication

API authentication is required by sending a GET request to the API endpoint with an API key.

endpoints

we have two main API endpoints: PRIVAT and PUBLIC.

public

https://www.iplocinfo.com/api/ip

find below an example API response for this endpointResponse:

{"ip": "xx.xx.xx.xx"}

privart

this andpoint came with API Access Key & Authentication let’s take a look how to access data.

after creating an account, you will be assigned a API access key, a unique hash consisting of 36 characters that will allow you to authenticate with the API interface.

to do this, simply append your API access key to the API with two methods:

  1. by passing the apiKey parameter into url as a query parameter:

    https://www.iplocinfo.com/api/v1/{IP_ADDRESS}?apiKey={YOUR_API_KEY}&user-agent={USER_AGENT_STRING}
  2. by passing the X-API-KEY parameter into HEADERS send as a request header:

    https://www.iplocinfo.com/api/v1/{IP_ADDRESS}

    into HEADERS pass X-API-KEY

    example
    curl -H "X-API-KEY: your_api_key" https://www.iplocinfo.com/api/v1/{IP_ADDRESS}
warning

protect your API access key: Your API access key is confidential and should never be disclosed publicly. You can reset it instantly through your account dashboard at any moment.

response

after a successful API request, the API returns over 40 unique response objects that include result data. The response is in JSON format and is divided into six modules: user-agent, location data, currency data, language data, connection module, and security data. The response objects within each module will be thoroughly described in the section titled 'API Response Objects'.

API response example:

{
    "user_agent": {
        "device": "Desktop",
        "os_family": "Windows",
        "os_version": "",
        "browser": "Firefox",
        "browser_version": "110",
        "device_family": "Other",
        "is_mobile": false,
        "is_pc": false,
        "is_tablet": false,
        "is_touch_screen": false,
        "is_bot": false
    },
    "ip_info": {
      "location": {
        "ip": "134.122.26.11",
        "ip_type": "IPv4",
        "continent_code": "NA",
        "continent_name": "North America",
        "subregion": "Northern America",
        "country_code2": "US",
        "country_code3": "USA",
        "country": "United States",
        "numericCode": "840",
        "nativeName": "United States",
        "area": 9629091,
        "population": 323947000,
        "capital": "Washington, D.C.",
        "borders": [
          "CAN",
          "MEX",
        ],
        "city": "North Bergen",
        "latitude": "40.793000000000006",
        "longitude": "-74.0247",
        "topLevelDomain": [
          ".us"
        ],
        "phone_code": [
          "213"
        ],
        "is_EU": false,
        "emoji": "🇺🇸"
      },
      "languages": [
        {
          "code": "en",
          "name": "English",
          "nativeName": "English"
        }
      ],
      "currency": [
        {
          "code": "USD",
          "name": "United States dollar",
          "symbol": "$"
        }
      ],
      "connection": {
        "isp": "Phoenix Technologies",
        "asn": "AS14061 DIGITALOCEAN-ASN",
        "org": "DIGITALOCEAN-ASN",
        "gip": "US"
      },
      "security": {
        "is_tor": false,
        "is_vpn": false,
        "suggestion": "allow"
      }
    }
}
        

error Codes

the iplocinfo API may return the following error codes:

error codes
code type info
404 404_not_found user requested a resource which does not exist.
400 ip_not_valid IP address is not valid!
401 missing_api_key api key is required!
403 invalid_api_key api key is required!
405 you_are_not_authorized the request shoud be true
401 usage_limit_reached your API usage limit has been reached. Please upgrade your plan.