Quick Start Guide
The general format for a WhatIsMyIP.com API query looks like the following:
https://api.whatismyip.com/[TOOL_FILE_NAME]?key=[YOUR_API_KEY]&input=[YOUR_INPUT]&output=[OUTPUT_FORMAT]All values within and including brackets should be replaced with corresponding values for each tool. An example query to get your IP address using a sample key "ABCDEF123456789ABCDEF123456789AB" that returns the output in XML format would look like the following:
https://api.whatismyip.com/ip.php?key=ABCDEF123456789ABCDEF123456789AB&output=xmlOutput Options
- Plain Text (default)
- Extensible Markup Language (XML) &output=xml
- JavaScript Object Notation (JSON) &output=json
- Comma-Separated Values (CSV) &output=csv
Note: The output parameter is optional for every tool in the API and is case sensitive. If the output parameter is missing from the query string, plain text will be returned by default.
Tools And Usage Examples
Get IP Address: This would output only your IP address in simple text. (No input required, output is optional)
https://api.whatismyip.com/ip.php?key=ABCDEF123456789ABCDEF123456789ABDetect Proxy: This will output your IP address and whether a proxy has been detected (No Proxy Detected or Proxy Detected and the IP of the proxy). (No input required, output is optional)
https://api.whatismyip.com/proxy.php?key=ABCDEF123456789ABCDEF123456789ABIP Address Lookup: This will output IP Geolocation of the IP address within the query. (Input is IPv4, output is optional)
https://api.whatismyip.com/ip-address-lookup.php?key=ABCDEF123456789ABCDEF123456789AB&input=123.123.123.123Blacklist Check: This will output whether or not the input has been found on a blacklist. (Input is IPv4 or domain name, output is optional)
https://api.whatismyip.com/domain-black-list.php?key=ABCDEF123456789ABCDEF123456789AB&input=123.123.123.123or
https://api.whatismyip.com/domain-black-list.php?key=ABCDEF123456789ABCDEF123456789AB&input=google.comHostname Lookup: This will output the hostname for the IP in the query. (Input is IPv4, output is optional)
https://api.whatismyip.com/host-name.php?key=ABCDEF123456789ABCDEF123456789AB&input=123.123.123.123IP Whois Lookup: This will output the IP data found in the ARIN IP Address database for the IP address in the query. (Input is IPv4, output is optional)
https://api.whatismyip.com/whois.php?key=ABCDEF123456789ABCDEF123456789AB&input=123.123.123.123Server Headers Check: This will output the server header data for the input URL or IP address. (Input is URL with either IPv4 or domain, output is optional)
https://api.whatismyip.com/server-headers.php?key=ABCDEF123456789ABCDEF123456789AB&input=https://www.google.comor
https://api.whatismyip.com/server-headers.php?key=ABCDEF123456789ABCDEF123456789AB&input=https://74.125.21.138User Agent Info: This will output the User Agent data for the requesting browser. (No input required, output is optional)
https://api.whatismyip.com/user-agent.php?key=ABCDEF123456789ABCDEF123456789ABStatus Codes
Each of the API tools will return a status code. The status code gives developers the ability to troubleshoot and correct any errors in usage. If your query is successful, you will receive a status code of "OK". If your query is unsuccessful for any reason, the status code will return a single digit number, which can be reference in the table below.
| Status Code | Status Description | Recommended Action |
|---|---|---|
| "OK" | API query was successful. | None. |
| 0 | API key was not entered. | Ensure you entered an API key using the following format: ?key=[yourkey] |
| 1 | API key is invalid. | Ensure that your API key was entered correctly and without typographical errors. Try to copy/paste your API key from your profile page. |
| 2 | API key is inactive. | Your API key has been inactivated. Visit your membership profile page to activate your API key. |
| 3 | Too many lookups. | API requests are limited to 1000 requests per API key, per day. Use a different key or get additional keys via your account page. |
| 4 | No input. | Some ip tools in the API require input in the url. Ensure that you have entered an input string in the API query. |
| 5 | Invalid input. | Some ip tools in the API require input in the url. Make sure the input you have entered is correct and in an appropriate format. |
| 6 | Unknown error. | The error you have received is unknown. Please contact WhatIsMyIP Support and provide details of the issue. |
Our Full API Documentation can be viewed here.