### Go - Get IP info with Authorization header
Source: https://ipregistry.co/docs/getting-location-from-ip-address
Performs a GET request to the single lookup endpoint with an Authorization header. Replace 'tryout' with your API key.
```go
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.ipregistry.co/1.2.3.4"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Authorization", "ApiKey tryout")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
```
--------------------------------
### Authenticate with cURL
Source: https://ipregistry.co/docs/authentication
Examples of using cURL to authenticate via URL parameter or Authorization header.
```bash
curl https://api.ipregistry.co?key=YOUR_API_KEY
curl -H "Authorization: ApiKey YOUR_API_KEY" https://api.ipregistry.co
```
--------------------------------
### Claude Code Setup
Source: https://ipregistry.co/docs/mcp
Command to add the Ipregistry MCP server to Claude Code via terminal.
```bash
claude mcp add --transport http ipregistry https://mcp.ipregistry.co/mcp \
--header "Authorization: ApiKey YOUR_API_KEY"
```
--------------------------------
### C# (RestSharp) - Get IP info
Source: https://ipregistry.co/docs/getting-location-from-ip-address
Uses RestSharp to make a GET request to the origin endpoint and prints the raw response. Replace 'tryout' with your API key.
```csharp
var client = new RestClient("https://api.ipregistry.co/?key=tryout");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
```
--------------------------------
### JavaScript (Vanilla) - Get country name
Source: https://ipregistry.co/docs/getting-location-from-ip-address
Uses XMLHttpRequest to fetch the origin endpoint and logs the country name. Replace 'tryout' with your API key.
```javascript
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (request.readyState === 4 && request.status === 200) {
var json = JSON.parse(request.responseText);
console.log('Your country is ' + json['location']['country']['name']);
}
};
request.open('GET', 'https://api.ipregistry.co/?key=tryout', true);
request.send(null);
```
--------------------------------
### Response example for security fields
Source: https://ipregistry.co/docs/proxy-tor-threat-detection
Example JSON response from the Ipregistry API showing the security object with boolean fields for various threat indicators. In this example, is_anonymous is true while all other security fields are false.
```json
{
"security": {
"is_abuser": false,
"is_attacker": false,
"is_bogon": false,
"is_cloud_provider": false,
"is_proxy": false,
"is_relay": false,
"is_tor": false,
"is_tor_exit": false,
"is_vpn": false,
"is_anonymous": true,
"is_threat": false
}
}
```
--------------------------------
### JavaScript (Fetch) - Get country name
Source: https://ipregistry.co/docs/getting-location-from-ip-address
Uses the Fetch API to retrieve the origin endpoint and logs the country name. Replace 'tryout' with your API key.
```javascript
fetch('https://api.ipregistry.co/?key=tryout')
.then(function (response) {
return response.json();
})
.then(function (json) {
console.log('Your country is ' + json['location']['country']['name']);
});
```
--------------------------------
### jQuery - Get country name
Source: https://ipregistry.co/docs/getting-location-from-ip-address
Uses jQuery's getJSON to fetch the origin endpoint and logs the country name. Replace 'tryout' with your API key.
```javascript
$.getJSON( "https://api.ipregistry.co/?key=tryout", function (json) {
console.log("Your country is " + json['location']['country']['name'])
});
```
--------------------------------
### GET /AS{asn}
Source: https://ipregistry.co/docs/endpoints
This endpoint looks up AS data by AS number (ASN).
```APIDOC
## [GET] /AS{asn}
### Description
This endpoint looks up AS data by AS number (ASN).
### Method
GET
### Endpoint
https://api.ipregistry.co/AS1?key=YOUR_API_KEY
### Parameters
#### Path Parameters
- **asn** (string) - Required - The AS number to look up. Example: AS1.
#### Query Parameters
- **key** (string) - Required - Your API key.
### Request Example
No request body required.
### Response
#### Success Response (200)
Returns AS data for the specified ASN.
#### Response Example
No example provided in the source.
### Notes
- Every request to this endpoint consumes 1 credit.
```
--------------------------------
### GET /AS
Source: https://ipregistry.co/docs/endpoints
Returns details for the Autonomous System associated with the calling address. This endpoint allows you to look up your own or a visitor's AS data without knowing the ASN or IP address in advance.
```APIDOC
## [GET] /AS
### Description
Returns details for the Autonomous System associated with the calling address. This endpoint allows you to look up your own or a visitor's AS data without knowing the ASN or IP address in advance.
### Method
GET
### Endpoint
https://api.ipregistry.co/AS
### Parameters
#### Query Parameters
- **key** (string) - Required - Your API key.
### Request Example
https://api.ipregistry.co/AS?key=YOUR_API_KEY
### Response
#### Success Response (200)
Details for the Autonomous System associated with the calling address.
```
--------------------------------
### Bash (cURL) - Get country name
Source: https://ipregistry.co/docs/getting-location-from-ip-address
Uses cURL and jq to fetch the country name from the origin endpoint. Replace 'tryout' with your own API key for production.
```bash
country=$(curl -s "https://api.ipregistry.co/?key=tryout" | jq ".location.country.name")
echo "Your country is: $country"
```
--------------------------------
### POST /
Source: https://ipregistry.co/docs/endpoints
Retrieves details for several IP addresses in a single request by POSTing a JSON array of IP addresses. This is an alternative to the comma-separated GET method for batch IP lookup.
```APIDOC
## [POST] /
### Description
Retrieves details for several IP addresses in a single request by POSTing a JSON array of IP addresses. This is an alternative to the comma-separated GET method for batch IP lookup.
### Method
POST
### Endpoint
https://api.ipregistry.co/
### Parameters
#### Query Parameters
- **key** (string) - Required - Your API key.
#### Request Body
- **body** (array of strings) - Required - A JSON array containing all IP addresses you'd like to get the data for.
### Request Example
```
curl --data '["66.165.2.7", "2a01:e35:2f22:e3d0::2", "1.1.1.1"]' \
--header "Content-Type: application/json" \
--request POST "https://api.ipregistry.co/?key=YOU_API_KEY"
```
### Response
#### Success Response (200)
For JSON outputs, the response includes a `results` field that has for value a JSON Array that contains one IP data object per requested IP address. For XML outputs, a main element `...` wraps `result` elements.
#### Response Example
(Not provided in the source)
### Notes
A batch IP lookup request costs as many credits as IP addresses specified plus one.
```
--------------------------------
### GET /AS{asn1},{asn2},...
Source: https://ipregistry.co/docs/endpoints
This endpoint performs a batch AS lookup by passing multiple comma-separated ASNs in the URL.
```APIDOC
## [GET] /AS{asn1},{asn2},...
### Description
This endpoint performs a batch AS lookup by passing multiple comma-separated ASNs in the URL.
### Method
GET
### Endpoint
https://api.ipregistry.co/AS7,AS42?key=YOUR_API_KEY
### Parameters
#### Path Parameters
- **asn1,asn2,...** (string) - Required - Comma-separated list of ASNs to look up. Example: AS7,AS42.
#### Query Parameters
- **key** (string) - Required - Your API key.
### Request Example
No request body required.
### Response
#### Success Response (200)
Returns a JSON object with a `results` field containing an array of AS data objects, one per requested ASN. For XML output, a main element `` wraps `result` elements.
#### Response Example
No example provided in the source.
### Notes
- A batch AS lookup request costs as many credits as ASNs specified plus one.
```
--------------------------------
### GET https://api.ipregistry.co/{ip_address}?fields=currency
Source: https://ipregistry.co/docs/detecting-users-currency
Retrieves the currency information for a given IP address. The response includes the ISO 4217 code, localized names, symbols, and formatting details for positive and negative amounts.
```APIDOC
## GET https://api.ipregistry.co/{ip_address}?fields=currency
### Description
Retrieves the currency information for a given IP address. The response includes the ISO 4217 code, localized names, symbols, and formatting details for positive and negative amounts.
### Method
GET
### Endpoint
https://api.ipregistry.co/{ip_address}?fields=currency
### Parameters
#### Path Parameters
- **ip_address** (string) - Required - The IP address to look up.
#### Query Parameters
- **key** (string) - Required - Your API key.
- **fields** (string) - Optional - Specifies which fields to include in the response. Use `currency` to get only the currency object.
### Request Example
```
curl https://api.ipregistry.co/210.138.184.59?key=YOUR_API_KEY&fields=currency
```
### Response
#### Success Response (200)
- **currency** (object) - The currency information for the IP address.
- **code** (string) - The ISO 4217 3-letter currency code.
- **name** (string) - The name of the currency in US locale.
- **name_native** (string) - The name of the currency in native locale based on detected location and primary language.
- **plural** (string) - The plural name of the given currency in US locale.
- **plural_native** (string) - The plural name of the given currency in native locale based on detected location and primary language.
- **symbol** (string) - The symbol of the given currency. For instance, `A$` for Australian dollars.
- **symbol_native** (string) - The native (local) symbol of the given currency. For instance, `$` for Australian dollars.
- **format** (object) - Formatting information for amounts.
- **negative** (object) - Formatting for negative amounts.
- **prefix** (string) - The currency prefix for negative amounts. For instance, `-` for `-10` euros.
- **suffix** (string) - The currency suffix for negative amounts. For instance, ` €` for `-10` euros.
- **positive** (object) - Formatting for positive amounts.
- **prefix** (string) - The currency prefix for positive amounts. For instance, `$` for `10` US dollars.
- **suffix** (string) - The currency suffix for positive amounts. For instance, the empty string for `10` US dollars.
#### Response Example
```
"currency": {
"code": "JPY",
"name": "Japanese Yen",
"name_native": "日本円",
"plural": "Japanese yen",
"plural_native": "円",
"symbol": "¥",
"symbol_native": "¥",
"format": {
"negative": {
"prefix": "-¥",
"suffix": ""
},
"positive": {
"prefix": "¥",
"suffix": ""
}
}
}
```
```
--------------------------------
### GET /?key=YOUR_API_KEY
Source: https://ipregistry.co/docs/endpoints
This endpoint returns details for the calling address. It allows you to look up your own —or a visitor to your site IP address details without knowing the IP address in advance.
```APIDOC
## [GET] /?key=YOUR_API_KEY
### Description
This endpoint returns details for the calling address. It allows you to look up your own —or a visitor to your site IP address details without knowing the IP address in advance.
### Method
GET
### Endpoint
https://api.ipregistry.co/?key=YOUR_API_KEY
### Parameters
#### Query Parameters
- **key** (string) - Required - Your API key.
### Response
#### Success Response (200)
- **IP related data** - Details about the calling IP address.
- **User-Agent data** - Information about the user agent, including application type, operating system, software vendor and revision.
### Notes
- This endpoint is intended for client browser requests. If you call it from a server, the response will reflect the IP of the source, essentially your server's IP.
- Every IP information retrieval via this endpoint consumes 1 credit.
```
--------------------------------
### Example JSON error response
Source: https://ipregistry.co/docs/errors
Shows the structure of an Ipregistry error response, including the error code, message, and resolution fields. Use this to understand the error format when handling API failures.
```json
{
code: "MISSING_API_KEY",
message: "You have not supplied an API key.",
resolution: "Add your API key as a query parameter: https://api.ipregistry.co/?key=YOUR_API_KEY"
}
```
--------------------------------
### JSON response showing in_eu flag
Source: https://ipregistry.co/docs/enforcing-gdpr-compliance
Example response from the Ipregistry API showing the 'location.in_eu' field set to true, indicating the IP address is in the EU.
```json
{
"location": {
"in_eu": true
}
}
```
--------------------------------
### Batch IP Lookup with JSON array POST body
Source: https://ipregistry.co/docs/endpoints
Use this cURL command to perform a batch IP lookup by sending a JSON array in the POST body. The request costs as many credits as IP addresses specified plus one; the example with 3 IPs costs 4 credits. The response includes a `results` field containing a JSON array of IP data objects.
```bash
curl --data '["66.165.2.7", "2a01:e35:2f22:e3d0::2", "1.1.1.1"]' \
--header "Content-Type: application/json" \
--request POST "https://api.ipregistry.co/?key=YOU_API_KEY"
```
--------------------------------
### GET /{ip_addresses}
Source: https://ipregistry.co/docs/endpoints
Retrieves details for several IP addresses in a single request, optimizing bulk IP address search. Supports up to 1024 IP addresses per request, mixing IPv4 and IPv6 addresses.
```APIDOC
## [GET] /{ip_addresses}
### Description
Retrieves details for several IP addresses in a single request, optimizing bulk IP address search. Supports up to 1024 IP addresses per request, mixing IPv4 and IPv6 addresses.
### Method
GET
### Endpoint
https://api.ipregistry.co/{ip_addresses}
### Parameters
#### Path Parameters
- **ip_addresses** (string) - Required - Comma-separated list of IP addresses to look up.
#### Query Parameters
- **key** (string) - Required - Your API key.
### Request Example
```
https://api.ipregistry.co/66.165.2.7,2a01:e35:2f22:e3d0::2,1.1.1.1?key=YOUR_API_KEY
```
### Response
#### Success Response (200)
For JSON outputs, the response includes a `results` field that has for value a JSON Array that contains one IP data object per requested IP address. For XML outputs, a main element `...` wraps `result` elements.
#### Response Example
(Not provided in the source)
### Notes
A batch IP lookup request costs as many credits as IP addresses specified plus one.
```
--------------------------------
### Batch AS Lookup - comma-separated parameter
Source: https://ipregistry.co/docs/endpoints
Use this method to process multiple ASNs in bulk by appending comma-separated ASNs to the base URL with an HTTP GET request. This is one of two supported methods for batch AS lookup.
```http
https://api.ipregistry.co/AS7,AS42?key=YOUR_API_KEY
```
--------------------------------
### Sample ips.txt file
Source: https://ipregistry.co/docs/bulk
Sample input file containing IP addresses, one per line, used with the xargs-based lookup commands.
```text
66.165.2.7
1.1.1.1
8.8.4.4
```
--------------------------------
### Prepare batch JSON with xargs and sed
Source: https://ipregistry.co/docs/bulk
Splits ips.txt into groups of 1024 IPs and transforms each group into a JSON array, saving to ips-batch.txt.
```bash
cat ips.txt | xargs -n 1024 | sed 's/ /","/g' | sed 's/^/["/g' | sed 's/$/"]/g' > ips-batch.txt
```
--------------------------------
### POST /user_agent?key=YOUR_API_KEY
Source: https://ipregistry.co/docs/endpoints
User-Agent parsing allows detecting any browser, device & OS in real-time to bring user experience to perfection (e.g. native app download, tailored advertising, crawler protection, and more).
```APIDOC
## [POST] /user_agent?key=YOUR_API_KEY
### Description
User-Agent parsing allows detecting any browser, device & OS in real-time to bring user experience to perfection (e.g. native app download, tailored advertising, crawler protection, and more).
### Method
POST
### Endpoint
https://api.ipregistry.co/user_agent?key=YOUR_API_KEY
### Parameters
#### Query Parameters
- **key** (string) - Required - Your API key.
#### Request Body
- **list** (array of strings) - Required - A list containing up to 256 user-agent strings to parse.
### Request Example
["Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0"]
### Response
#### Success Response (200)
- **Parsed user-agent data** - Details about the browser, device, and OS for each submitted user-agent.
### Notes
- For every single user-agent value you submit for parsing, it will cost 1 credit. If you provide multiple user-agent values, the cost will be 1 credit plus an additional credit for each user-agent value you submit.
```
--------------------------------
### Authentication via Query Parameter
Source: https://ipregistry.co/docs/mcp
Authenticate using the key query parameter for clients that cannot send custom headers.
```text
https://mcp.ipregistry.co/mcp?key=YOUR_API_KEY
```
--------------------------------
### GET /{ip_address}
Source: https://ipregistry.co/docs/endpoints
Retrieves the information associated with the specified IP address. This is the primary Ipregistry endpoint for looking up any given IPv4 or IPv6 address.
```APIDOC
## [GET] /{ip_address}
### Description
Retrieves the information associated with the specified IP address. This is the primary Ipregistry endpoint for looking up any given IPv4 or IPv6 address.
### Method
GET
### Endpoint
https://api.ipregistry.co/{ip_address}
### Parameters
#### Path Parameters
- **ip_address** (string) - Required - The IPv4 or IPv6 address to look up.
#### Query Parameters
- **key** (string) - Required - Your API key.
### Request Example
```
https://api.ipregistry.co/66.165.2.7?key=YOUR_API_KEY
```
### Response
#### Success Response (200)
Returns the information associated with the specified IP address.
#### Response Example
(Not provided in the source)
### Notes
Every request to the single IP lookup endpoint consumes 1 credit.
```
--------------------------------
### Visual Studio Code MCP Configuration
Source: https://ipregistry.co/docs/mcp
JSON configuration to add the Ipregistry MCP server to the .vscode/mcp.json file.
```json
{
"servers": {
"ipregistry": {
"type": "http",
"url": "https://mcp.ipregistry.co/mcp",
"headers": { "Authorization": "ApiKey YOUR_API_KEY" }
}
}
}
```
--------------------------------
### GET /user_agent
Source: https://ipregistry.co/docs/endpoints
This endpoint parses the user-agent string from the client's request and returns the parsed user-agent data. It is designed for client-side (browser) calls.
```APIDOC
## [GET] /user_agent
### Description
This endpoint parses the user-agent string from the client's request and returns the parsed user-agent data. It is designed for client-side (browser) calls.
### Method
GET
### Endpoint
https://api.ipregistry.co/user_agent?key=YOUR_API_KEY
### Parameters
#### Query Parameters
- **key** (string) - Required - Your API key.
### Request Example
No request body required.
### Response
#### Success Response (200)
Returns parsed user-agent data.
#### Response Example
No example provided in the source.
### Notes
- Each call to this endpoint uses 1 credit.
- If called from a server, the response will be based on the user-agent of the application sending the request from your server.
```
--------------------------------
### Exclude fields after selecting all with **
Source: https://ipregistry.co/docs/filtering
Select all fields first (using **) before applying exclusions, because an empty field value performs an empty selection.
```http
&fields=**,-location
```
--------------------------------
### PHP - Batch IP lookup
Source: https://ipregistry.co/docs/getting-location-from-ip-address
Uses cURL to perform a batch lookup by POSTing a JSON array of IP addresses. Prints the raw response. Replace 'tryout' with your API key.
```php
$curl = curl_init();
$ips = array("66.165.2.7", "1.1.1.1", "8.8.4.4");
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.ipregistry.co/?key=tryout",
CURLOPT_POSTFIELDS => json_encode($ips),
CURLOPT_HTTPHEADER => array('Content-Type:application/json'),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 10,
CURLOPT_CUSTOMREQUEST => "POST",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
```
--------------------------------
### Single ASN Lookup endpoint
Source: https://ipregistry.co/docs/endpoints
Use this endpoint to look up AS data by AS number (ASN) using an HTTP GET request. Each request consumes 1 credit.
```http
https://api.ipregistry.co/AS1?key=YOUR_API_KEY
```
--------------------------------
### POST / (Batch AS Lookup)
Source: https://ipregistry.co/docs/endpoints
This endpoint performs a batch AS lookup by sending a JSON array of ASNs in the request body.
```APIDOC
## [POST] / (Batch AS Lookup)
### Description
This endpoint performs a batch AS lookup by sending a JSON array of ASNs in the request body.
### Method
POST
### Endpoint
https://api.ipregistry.co/?key=YOUR_API_KEY
### Parameters
#### Query Parameters
- **key** (string) - Required - Your API key.
#### Request Body
- **body** (array of strings) - Required - A JSON array containing the ASNs to look up. Example: ["AS1", "AS6", "AS42"].
### Request Example
```json
["AS1", "AS6", "AS42"]
```
### Response
#### Success Response (200)
Returns a JSON object with a `results` field containing an array of AS data objects, one per requested ASN. For XML output, a main element `` wraps `result` elements.
#### Response Example
No example provided in the source.
### Notes
- A batch AS lookup request costs as many credits as ASNs specified plus one.
```
--------------------------------
### Cursor MCP Configuration
Source: https://ipregistry.co/docs/mcp
JSON configuration to add the Ipregistry MCP server to the ~/.cursor/mcp.json file.
```json
{
"mcpServers": {
"ipregistry": {
"url": "https://mcp.ipregistry.co/mcp",
"headers": { "Authorization": "ApiKey YOUR_API_KEY" }
}
}
}
```
--------------------------------
### Swift URLSession request to ipregistry.co API
Source: https://ipregistry.co/docs/getting-location-from-ip-address
Uses URLSession in Swift to make a GET request to ipregistry.co. Prints an error message on failure or the HTTP response on success.
```swift
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "https://api.ipregistry.co/?key=tryout")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print("An error occurred while fetching IP Info " + error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
```
--------------------------------
### Specify Output Format with format Parameter
Source: https://ipregistry.co/docs/format
Append the format query parameter to the API URL to switch between JSON and XML output. The API defaults to JSON if no format is specified.
```text
https://api.ipregistry.co/66.165.2.7?key=YOUR_API_KEY&format=xml
```
--------------------------------
### Batch AS Lookup - JSON array POST body
Source: https://ipregistry.co/docs/endpoints
Use this cURL command to POST a JSON array of ASNs to the batch endpoint. The request costs as many credits as ASNs specified plus one (e.g., 3 ASNs cost 4 credits). The response includes a `results` field containing one AS data object per requested ASN.
```bash
curl --data '["AS1", "AS6", "AS42"]' \
--header "Content-Type: application/json" \
--request POST "https://api.ipregistry.co/?key=YOU_API_KEY"
```
--------------------------------
### Node.js (Vanilla) https request to ipregistry.co API
Source: https://ipregistry.co/docs/getting-location-from-ip-address
Uses Node.js's built-in https module to make a GET request to the ipregistry.co API. Parses the JSON response and logs the country name from the location object.
```javascript
const https = require('https');
https.get('https://api.ipregistry.co/?key=tryout', res => {
let payload = '';
res.on('data', data => {
payload += data;
});
res.on('end', () => {
const json = JSON.parse(payload);
console.log('Your country is ' + json['location']['country']['name']);
});
});
```
--------------------------------
### Select a single field with fields parameter
Source: https://ipregistry.co/docs/filtering
Select a single top-level field (connection) and all its subfields. The output remains a nested JSON document.
```http
https://api.ipregistry.co/66.165.2.7?key=tryout&fields=connection
```
--------------------------------
### GET /223.245.175.3?fields=security
Source: https://ipregistry.co/docs/proxy-tor-threat-detection
Retrieves security threat information for a specific IP address. The response includes boolean flags indicating whether the IP is a proxy, Tor node, VPN, abuser, attacker, or other threat category.
```APIDOC
## GET /223.245.175.3?fields=security
### Description
Retrieves security threat information for a specific IP address. The response includes boolean flags indicating whether the IP is a proxy, Tor node, VPN, abuser, attacker, or other threat category.
### Method
GET
### Endpoint
https://api.ipregistry.co/223.245.175.3?fields=security
### Parameters
#### Query Parameters
- **key** (string) - Required - Your API key for authentication.
- **fields** (string) - Optional - Specifies which fields to include in the response. In this example, it is set to 'security'.
### Request Example
```
curl https://api.ipregistry.co/223.245.175.3?key=YOUR_API_KEY&fields=security
```
### Response
#### Success Response (200)
- **security** (object) - Contains security threat flags.
- **is_abuser** (boolean) - Indicates whether the IP is a known source of abuse.
- **is_attacker** (boolean) - Indicates whether the IP is a known source of malicious activity.
- **is_bogon** (boolean) - Indicates whether the IP is a Bogon (unassigned, unaddressable).
- **is_cloud_provider** (boolean) - Indicates whether the IP is used by a CDN or hosting provider.
- **is_proxy** (boolean) - Indicates whether the IP is a known proxy.
- **is_relay** (boolean) - Indicates whether the IP is a known relay (e.g., Apple Private Relay).
- **is_tor** (boolean) - Indicates whether the IP is a Tor relay.
- **is_tor_exit** (boolean) - Indicates whether the IP is a Tor exit relay node.
- **is_vpn** (boolean) - Indicates whether the IP is used by a VPN.
- **is_anonymous** (boolean) - True if is_proxy OR is_tor is true.
- **is_threat** (boolean) - True if is_abuser OR is_attacker is true.
#### Response Example
```
{
"security": {
"is_abuser": false,
"is_attacker": false,
"is_bogon": false,
"is_cloud_provider": false,
"is_proxy": false,
"is_relay": false,
"is_tor": false,
"is_tor_exit": false,
"is_vpn": false,
"is_anonymous": true,
"is_threat": false
}
}
```
```
--------------------------------
### Authenticate via URL parameter
Source: https://ipregistry.co/docs/authentication
Pass your API key directly in the request URL.
```text
https://api.ipregistry.co?key=YOUR_API_KEY
```
--------------------------------
### Single IP Lookup endpoint URL
Source: https://ipregistry.co/docs/endpoints
Use this endpoint to retrieve information for a single IPv4 or IPv6 address. Attach the IP address to the base URL using an HTTP GET request. Each request consumes 1 credit.
```http
https://api.ipregistry.co/66.165.2.7?key=YOUR_API_KEY
```
--------------------------------
### Origin AS Lookup endpoint URL
Source: https://ipregistry.co/docs/endpoints
Use this endpoint to retrieve Autonomous System details for the calling IP address without needing to know the ASN or IP in advance. Replace YOUR_API_KEY with your actual API key.
```text
https://api.ipregistry.co/AS?key=YOUR_API_KEY
```
--------------------------------
### PHP cURL request to ipregistry.co API
Source: https://ipregistry.co/docs/getting-location-from-ip-address
Uses cURL to fetch IP information from the ipregistry.co API with the tryout key. Prints the results array or an error message if the request fails.
```php
"https://api.ipregistry.co/" . $clientIp . "?key=tryout",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 10,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "An error occurred while retrieving IP info:" . $err;
} else {
$ipinfo = json_decode($response, true);
$countryCode = $ipinfo['location']['country']['code'];
echo $countryCode;
}
```