# Check an IP address (/docs/api-reference/risk/check-risk-ip)

IP intelligence on its own: Tor exit nodes, cloud and hosting networks, networks mostly used by VPN and proxy services, the network (ASN) and its country. Stateless. Missing IP data is reported in `degraded`. Sandbox keys see the documentation addresses (`192.0.2.1` Tor, `.2` cloud, `.3` VPN, the rest residential).

`POST https://api.coss.com/v1/risk/ip/check`

Authenticate with your API key as a bearer token (`Authorization: Bearer coss_test_…`). Responses are JSON with snake_case fields; errors are `{ error: { type, code, message, param?, issues?, request_id } }` (https://coss.com/docs/api-reference/errors.md).

## Request body

- `ip` (string, required, ip): The address to check.

## Example request

TypeScript (the `coss` package):

```ts
import { Coss } from "coss";

const coss = new Coss({
  apiKey: process.env.COSS_API_KEY,
  baseUrl: "https://api.coss.com",
});

const { data, error } = await coss.risk.checkIp("185.220.101.1");
```

HTTP:

```sh
curl -X POST "https://api.coss.com/v1/risk/ip/check" \
  -H "Authorization: Bearer $COSS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ip": "185.220.101.1"
}'
```

Python:

```python
from coss import Coss

client = Coss()  # api_key= or COSS_API_KEY

client.risk.check_ip(
    ip="185.220.101.1",
)
```

Go:

```go
import (
	"context"

	coss "github.com/cosscom/coss-go"
	cossclient "github.com/cosscom/coss-go/client"
)

client := cossclient.NewClient() // option.WithAPIKey(…) or COSS_API_KEY

request := &coss.RiskIPCheckRequest{
    IP: "185.220.101.1",
}
client.Risk.CheckIP(
    context.TODO(),
    request,
)
```

Ruby:

```ruby
require "coss"

client = Coss::Client.new # api_key: or COSS_API_KEY

client.risk.check_ip(ip: "185.220.101.1")
```

PHP:

```php
<?php

use Coss\Coss;
use Coss\Risk\Requests\RiskIpCheckRequest;

$client = new Coss(); // apiKey: or COSS_API_KEY

$client->risk->checkIp(
    new RiskIpCheckRequest([
        'ip' => '185.220.101.1',
    ]),
);
```

Java:

```java
import com.coss.Coss;
import com.coss.resources.risk.requests.RiskIpCheckRequest;

Coss client = Coss.builder().build(); // .apiKey(…) or COSS_API_KEY

client.risk().checkIp(
    RiskIpCheckRequest
        .builder()
        .ip("185.220.101.1")
        .build()
);
```

.NET:

```csharp
using Coss;

var client = new CossClient(); // apiKey: or COSS_API_KEY

await client.Risk.CheckIpAsync(new RiskIpCheckRequest { Ip = "185.220.101.1" });
```

## Response 200

What coss.com knows about the address.

- `version` (4 | 6, required): IPv4 or IPv6.
- `private` (boolean, required): Whether it's a private or reserved address.
- `tor` (boolean, required): Whether it's a Tor exit.
- `hosting` (boolean, required): Whether it's in a cloud, hosting or VPN network.
- `hosting_provider` (string | null, required): That network's operator. `null` when it isn't one.
- `hosting_kind` ("cloud" | "hosting" | "vpn" | null, required): `cloud`, `hosting` or `vpn`. `null` when it isn't one.
- `asn` (integer | null, required): The network's autonomous system number. `null` when unknown.
- `as_name` (string | null, required): The network's name. `null` when unknown.
- `country` (string | null, required): ISO 3166-1 alpha-2.
- `privacy` (object | null, required): From coss.com's IP privacy data provider (VPNs, proxies, relays). `null` when it isn't available or was not asked (private addresses).
  - `vpn` (boolean, required): Whether it's a VPN exit.
  - `proxy` (boolean, required): Whether it's a proxy.
  - `relay` (boolean, required): Whether it's a privacy relay.
  - `service` (string | null, required): The VPN or proxy service.
- `object` ("risk_ip_check", required)
- `ip` (string, required): The address checked.
- `degraded` (("ip_data" | "ip_privacy")[], required): `ip_data` when some IP data (Tor exits, cloud ranges, networks and countries) is unavailable at the moment; `ip_privacy` when the privacy data provider failed or timed out.

Example:

```json
{
  "object": "risk_ip_check",
  "ip": "185.220.101.1",
  "version": 4,
  "private": false,
  "tor": true,
  "hosting": false,
  "hosting_provider": null,
  "hosting_kind": null,
  "asn": 60729,
  "as_name": "Stiftung Erneuerbare Freiheit",
  "country": "DE",
  "privacy": null,
  "degraded": []
}
```

## Errors

- `400`: The body is not valid JSON (`invalid_json`). Also when the `Coss-Version` header names an unknown API version (`invalid_api_version`).
- `401`: The API key is missing, invalid, revoked or expired (`authentication_error`).
- `403`: The API key lacks the permission this endpoint needs (`permission_error`), or its organization is suspended (`organization_suspended`).
- `413`: The request body is larger than 5 MB (`payload_too_large`).
- `415`: The body is not sent as `application/json` (`unsupported_media_type`).
- `422`: The body failed validation (`validation_error`, see `issues`).
- `429`: Too many requests with this API key (`rate_limited`), or too many requests with invalid keys from this address (`too_many_failed_authentications`). Retry after `Retry-After` seconds. Successful responses carry `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` (seconds until the limit is fully restored).
- `500`: Unexpected server error (`api_error` / `internal_error`).
- `503`: The API key could not be verified right now; retry (`service_unavailable`).