Options
Specify Response Format
The API is capable of delivering API results in JSON (default) and XML format. The response format can be controlled by appending the API's output parameter to your API request URL and setting it to json or xml.
Example API Request - JSON:
Sign Up to Run API Request
Example API Request - XML:
Sign Up to Run API Request
Would you like to see an API response? Jump to the API Response section.
Specify Response Fields
API responses from IPAPI can be extensive in size. To limit your API result set to specific fields or types of information, simply append the API's fields parameter to your API request URL and set it to a specific field or a comma-separated list of fields.
Examples:
Example API Request - JSON:
Sign Up to Run API Request
Would you like to see an API response? Jump to the API Response section.
Specify Response Language
The API is capable of translating certain applicable objects contained in the API response. The default language is always English; other languages can be requested by appending the API's language to your API request URL and setting it to one of the available 2-letter language codes.
Available Language Codes:
Example API Request:
In the example request below we are specifying Spanish as language.
Sign Up to Run API Request
Example API Response:
In the example response below, you will notice that all applicable response objects have been translated to Spanish. Please note that the API response has been shortened for readability purposes.
Enable Hostname Lookup
To reduce bandwidth and speed up API responses, standard IP lookups do not return hostname information. To include hostname data in your API responses, simply append the API's hostname parameter and set it to 1.
Example API Request:
Sign Up to Run API Request
https://api.ipapi.com/api/1.4.193.15
? access_key = YOUR_ACCESS_KEY
& hostname = 1
Example API Response:
As you can see below, hostname information is now returned right after the IP address.
Please note: Enabling Hostname Lookup may cause the speed of API requests to decrease slightly.
Enable Security Data
The API is capable of delivering valuable security assessment data, including the detection of threats like the TOR Network, proxies, and more. To enable Security Data in your API request, simply append the API's security parameter to your API request URL and set it to 1.
Example API Request:
Sign Up to Run API Request
https://api.ipapi.com/api/76.8.255.114
? access_key = YOUR_ACCESS_KEY
& security = 1
Example API Response:
In the API response below you will notice that the threat types attack_source and attack_source_mail have been detected, indicating that the given IP address is in some way associated with spam via email.
Please note: In the above response the rest of the API response has been skipped for readability purposes.