Getting Started
API Access Key & Authentication
After creating an account, you will be assigned an API access key, a unique 32-character hash that allows you to authenticate with the IPAPI interface. To do this, simply append your API access key to the API's base URL using the access_key parameter.
Sign Up to Run API Request
Keep your API access key safe: Your API access key is private and should at no time be shown publicly. You can reset it with immediate effect using your account dashboard at any given time.
API Response
Following a successful API request, the API will return more than 40 unique response objects containing result data. An API response can be returned in JSON or XML format and is structured into 4 modules: General information, location data, time zone data, currency data, connection data and security data. Response objects contained in each module will be explained in detail in the API Response Objects section.
Find below an example API response for an IPv4 address in Brooklyn, New York.
Example API Response:
Please note: To be able to show you a comprehensive API response, Hostname and Security data have been included in the result above. To enable this data in your API response, please follow the instructions in the Hostname Lookup and Security Data sections of this documentation.
API Endpoints
The API includes three endpoints, each covering a different type of functionality. Please find below a quick overview, and click any endpoint to learn more about its usage.
Look up any given IP address.
Look up multiple IP addresses in bulk.
Look up the IP address from which the current API request is coming.
256-bit HTTPS Encryption
You can connect to the API using industry standard HTTPS (SSL) by appending an " s " to the HTTP Protocol. You can see an example API request using HTTPS below.
Example API Request:
JSONP Callbacks
The API supports JSONP Callbacks. To make use of this feature, simply append the API's callback parameter to your API request URL and set it to your preferred function name. The API will then return your API results set wrapped inside the tags of the function you specified.
Example API Request:
Sign Up to Run API Request
Example API Response:
Please note: The API also supports Access-Control (CORS) headers.
API Error Codes
If your API request fails for any reason, the API will return a JSON error message detailing the error that occurred. As an example, find below the error the API returns when the monthly API request limit is reached.
Example Error:
Common API Errors:
| Code | Type | Info |
|---|---|---|
404 | 404_not_found | User requested a resource which does not exist. |
101 | missing_access_key | User did not supply an access key. |
101 | invalid_access_key | User supplied an invalid access key. |
102 | inactive_user | User account is inactive or blocked. |
103 | invalid_api_function | User requested a non-existent API function. |
104 | usage_limit_reached | User has reached his subscription's monthly request allowance. |
105 | function_access_restricted | The user's current subscription does not support this API function. |
106 | invalid_ip_address | The IP Address supplied is invalid |
301 | invalid_fields | User specified one or more invalid fields inside the fields parameter. |
302 | too_many_ips | User specified too many IP addresses in a single Bulk Lookup request. |
303 | batch_not_supported_on_plan | The user's current subscription plan does not support Bulk Lookup. |