API ip_info. Get Country Code by IP Address


The API "ip_info()" returns a 2-letter country code (US, UK, CN and etc) for an IP address. You can specify a list for IP addresses to find countries for each IP address by one API call.


Call required GET params:

  • method_name - must be 'ip_info',
  • ip - an IPv4 address to obtain 2 letter country code.


Optional POST params:

  • data - list of IP addresses separated by comma (,).




API returns JSON string, for example:

 {"data":{"":{"country_code":"US","country_name":"United States"}}}


Response explanation:

  • data - array with checked records,
    • record - array with details per record,
      • country - a 2 letter country code for the IP address.



If you get calls limit, API returns error notice. Example:

{"error_message":"Calls limit exceeded.","error_no":10}

Current calls limit is 10 per 60 seconds.

If you get data elements limit in spam_check method, API returns error notice. Example:

{"error_message":"Received 1001 records to check, maximum 1000 records check per call.","error_no":8}

Current data elements limit is 1000.


Recommended timeout is no more than 180 seconds.



Was this information helpful?

It would also be interesting

Copied to clipboard