# List rules (/docs/api-reference/risk/list-risk-rules)

Every rule of the API key's environment, in evaluation order.

`GET https://api.coss.com/v1/risk/rules`

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).

## 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.rules.list();
```

HTTP:

```sh
curl -X GET "https://api.coss.com/v1/risk/rules" \
  -H "Authorization: Bearer $COSS_API_KEY"
```

Python:

```python
from coss import Coss

client = Coss()  # api_key= or COSS_API_KEY

client.risk.rules.list()
```

Go:

```go
import (
	"context"

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

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

client.Risk.Rules.List(
    context.TODO(),
)
```

Ruby:

```ruby
require "coss"

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

client.risk.rules.list
```

PHP:

```php
<?php

use Coss\Coss;

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

$client->risk->rules->list();
```

Java:

```java
import com.coss.Coss;

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

client.risk().rules().list();
```

.NET:

```csharp
using Coss;

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

await client.Risk.Rules.ListAsync();
```

## Response 200

The rules.

- `object` ("list", required)
- `data` (object[], required)
  - `object` ("risk_rule", required)
  - `id` (string, required)
  - `name` (string, required): Your name for the rule, returned with reasons when it decides.
  - `enabled` (boolean, required): `false`: it's kept, and no assessment applies it.
  - `position` (integer, required): Rules are tried in ascending order.
  - `events` (("signup" | "login" | "message" | "checkout" | "custom")[], required): Events it applies to; empty: every event.
  - `match` ("all" | "any", required): `all`: every condition must hold. `any`: one is enough.
  - `conditions` (object[], required): What must hold, by `match`.
    - `field` (string, required, one of "email.valid", "email.disposable", "email.undeliverable", "email.role_account", "email.free_provider", "email.typo", "email.domain_new", "email.domain", "email.domain_age_days", "ip.tor", "ip.hosting", "ip.vpn", "ip.proxy", "ip.relay", "ip.private", "ip.country", "ip.asn", "ip.hosting_provider", "captcha.passed", "duplicate.canonical_mailbox", "duplicate.device", "history.fraud", "login.new_country", "login.new_network", "content.spam", "content.phishing", "content.malware", "content.fraud", "checkout.amount", "checkout.currency", "checkout.card_country", "checkout.card_funding", "checkout.billing_country", "checkout.shipping_country", "device.automation", "device.timezone", "device.language", "score", "velocity.ip_1h", "velocity.ip_24h", "velocity.subnet_1h", "velocity.subnet_24h", "velocity.email_domain_1h", "velocity.email_domain_24h", "velocity.mailbox_1h", "velocity.mailbox_24h", "velocity.user_1h", "velocity.user_24h", "velocity.card_1h", "velocity.card_24h", "velocity.device_1h", "velocity.device_24h"): The signal to test, such as `email.disposable` or `ip.country`.
    - `operator` ("is" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "in" | "not_in", required): How to compare. Booleans use `is`, numbers `eq` to `lte`, and strings `eq`, `neq`, `in` and `not_in`.
    - `value` (boolean | number | string | string[], required, at most 320 characters, 1-100 items): What to compare it with: its type follows the field, and `in` and `not_in` take a list of strings.
  - `action` ("allow" | "review" | "block", required): `allow`: go ahead. `review`: suspicious; let it through with limits, or hold it for a person. `block`: refuse it.
  - `created_at` (string, required, date-time)
  - `updated_at` (string, required, date-time)
- `has_more` (false, required)

Example:

```json
{
  "object": "list",
  "data": [
    {
      "object": "risk_rule",
      "id": "rskrule_01k7c8m4q2f3e9v6t5r1n0p8yz",
      "name": "Disposable email from a data center",
      "enabled": true,
      "position": 0,
      "events": [
        "signup"
      ],
      "match": "all",
      "conditions": [
        {
          "field": "email.disposable",
          "operator": "is",
          "value": true
        },
        {
          "field": "ip.hosting",
          "operator": "is",
          "value": true
        }
      ],
      "action": "block",
      "created_at": "2026-01-15T09:30:00.000Z",
      "updated_at": "2026-01-15T09:30:00.000Z"
    }
  ],
  "has_more": false
}
```

## Errors

- `400`: 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`).
- `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`).