# Search risk

URL: https://docs.hanzo.ai/docs/openapi/risk/risksearch

> Runs an exhaustive search for the model shape that best fits the caller organisation's own history, and answers 202 with the run to read back.

`POST /v1/risk/search`

> [Risk →](https://docs.hanzo.ai/docs/openapi/risk) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                        |
| ------------- | -------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/risk/search`  |
| **Method**    | `POST`                                 |
| **Operation** | `riskSearch`                           |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY` |

Runs an exhaustive search for the model shape that best fits the caller
organisation's own history, and answers 202 with the run to read back.

Every candidate is replayed over that organisation's OWN feature surface in its
own sandbox — its own aggregates, its own model, neither of them the live one —
so a run cannot move a live threshold and cannot see another organisation's
data. The result is the learning curve for each shape and the one that fit
best, ranked on how closely it honoured the stated appetite, whether it warmed
at all, whether it saturated, and how much of the coordinate space it left
blind.

An empty history is REFUSED rather than reported as zero alerts, because "no
alerts" is exactly what a quiet model looks like.

## Request

1 field, body `application/json` (required).

| Field  | In   | Type            | Required | Description                                                             |
| ------ | ---- | --------------- | -------- | ----------------------------------------------------------------------- |
| `days` | body | integer (int64) | —        | Days is how much of the organisation's own history to replay, 1 to 400. |

## Response

| Status    | Body               | Meaning  |
| --------- | ------------------ | -------- |
| `202`     | risk.riskSearchRun | accepted |
| `default` | problem-details    | refused  |

`202` body — 3 fields.

| Field        | In   | Type            | Always | Description                                                               |
| ------------ | ---- | --------------- | ------ | ------------------------------------------------------------------------- |
| `candidates` | body | integer (int64) | —      | Candidates is how many model shapes will be tried.                        |
| `events`     | body | integer (int64) | —      | Events is how much of the organisation's own history the run will replay. |
| `id`         | body | string          | —      | ID addresses the run.                                                     |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo risk search create
```

**SDK**

**.ts**

```ts
import { Configuration, RiskApi } from 'hanzoai';

const api = new RiskApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.riskSearch({ days: 0 });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import RiskApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = RiskApi(client).risk_search(days=0)
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.RiskAPI.RiskSearch(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, risk_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = risk_api::risk_search(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.RiskApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new RiskApi(client).riskSearch();
```

**HTTP**

```bash
curl -X POST https://api.hanzo.ai/v1/risk/search \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "days": 0
     }'
```

**MCP**

Tool `risk`, op `riskSearch` — POST the JSON-RPC envelope to `https://api.hanzo.ai/v1/mcp`.

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "risk",
         "arguments": {
           "op": "riskSearch",
           "input": {
             "days": 0
           }
         }
       }
     }'
```

---

[Risk API](https://docs.hanzo.ai/docs/openapi/risk) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
