# Dataset

URL: https://docs.hanzo.ai/docs/openapi/dataset

> The per-org dataset plane of /v1/risk: a dataset is a VERSIONED, IMMUTABLE snapshot of one tenant's own event surface, and this is where it is declared, materialised, described, exported and disposed of.

Also for this capability: **API** · [CLI](https://docs.hanzo.ai/docs/cli/dataset) · [MCP](https://docs.hanzo.ai/docs/mcp-tools/dataset) · [SDKs](https://docs.hanzo.ai/docs/sdks)

The per-org dataset plane of /v1/risk: a dataset is a VERSIONED, IMMUTABLE snapshot of one tenant's own event surface, and this is where it is declared, materialised, described, exported and disposed of.

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

|                |                                        |
| -------------- | -------------------------------------- |
| **Base URL**   | `https://api.hanzo.ai`                 |
| **Operations** | 7                                      |
| **Auth**       | `Authorization: Bearer $HANZO_API_KEY` |

## Specification

Specification pending — no HIP in [hanzoai/hips](https://github.com/hanzoai/hips) declares `capability: dataset` yet. What this capability serves is below, from the API document; what it is — the store it owns, how it meters, what it publishes — is written as a HIP under HIP-0139.

## Four surfaces

| Surface  | Reaches this capability as                      | Coverage     |
| -------- | ----------------------------------------------- | ------------ |
| **REST** | `dataset` at its own prefix                     | 7 operations |
| **CLI**  | `hanzo dataset …`                               | 7 of 7       |
| **SDK**  | `DatasetApi` in every published client          | 7 methods    |
| **MCP**  | tool `dataset` on `https://api.hanzo.ai/v1/mcp` | 7 operations |

## Quickstart

```bash
export HANZO_API_KEY=sk-...   # console.hanzo.ai → API keys
```

Then the first call — a read that needs nothing but the key. `GET /v1/dataset`, operation `riskDatasets`:

**CLI**

```bash
hanzo dataset list
```

**SDK**

**.ts**

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

const api = new DatasetApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.riskDatasets();
```

**.py**

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

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = DatasetApi(client).risk_datasets()
```

**.go**

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

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

**.rs**

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

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

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

**.java**

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

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

var result = new DatasetApi(client).riskDatasets();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/dataset \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

Tool `dataset`, op `riskDatasets` — 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": "dataset",
         "arguments": {
           "op": "riskDatasets",
           "input": {}
         }
       }
     }'
```

Answers `200` with `object` — ok.

## Endpoints

| Endpoint                                                                                                   | What it does                                                                      |
| ---------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| [`GET /v1/dataset/{name}/export`](https://docs.hanzo.ai/docs/openapi/dataset/riskexportdataset)            | Read a version's rows back, one page at a time                                    |
| [`GET /v1/dataset/{name}/lineage`](https://docs.hanzo.ai/docs/openapi/dataset/riskdatasetlineage)          | Show where a version's rows came from, and whether that can still be demonstrated |
| [`POST /v1/dataset/{name}/materialize`](https://docs.hanzo.ai/docs/openapi/dataset/riskmaterializedataset) | Materialise the declared version into immutable rows                              |
| [`GET /v1/dataset/{name}`](https://docs.hanzo.ai/docs/openapi/dataset/riskdataset)                         | Describe every version of one dataset                                             |
| [`DELETE /v1/dataset/{name}`](https://docs.hanzo.ai/docs/openapi/dataset/riskdeletedataset)                | Dispose of one dataset and every version of it                                    |
| [`GET /v1/dataset`](https://docs.hanzo.ai/docs/openapi/dataset/riskdatasets)                               | List this org's datasets                                                          |
| [`POST /v1/dataset`](https://docs.hanzo.ai/docs/openapi/dataset/riskcreatedataset)                         | Declare the next version of a dataset                                             |

---

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