# Read Dataset Rows

`POST /analytics/{datasetSlug}/read` · Core · Analytics & Intelligence

Pages through a dataset's rows. Body: optional `partitionFilter` (constraints on declared partition keys), `cursor` and `limit` (clamped to a page maximum). Each row carries a stable `_k9o_row_id`; `meta.cursor.next` continues, and the first page includes `meta.schema`.

Requires the PROJECT_ADMIN, PROJECT_AUTHOR or PROJECT_EDITOR role and the `datasets:query` permission on every dataset it reads.

Callers must be members of the project (an organization role alone does not grant access); project service tokens and extension tokens cannot call it.

Returns `503 K9O_ANALYTICS_UNAVAILABLE` until the region's analytics storage is provisioned.

## Parameters

| Name | In | Required | Description |
|---|---|---|---|
| `datasetSlug` | path | yes | The Dataset's slug. Example: `"orders"`. |
| `projectSlug` | path | yes | The project's slug: the path segment after `@`. It is unique within the org. Example: `"storefront"`. |

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `partitionFilter` | object | no | Keys are declared partition columns. |
| `cursor` | string | no | `meta.cursor.next` from the previous page. |
| `limit` | integer | no | Default 1000; above 10000 is clamped (with a `query_limit_clamped` warning). |

## Responses

- **200**: Success

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | array of object | yes | One page of rows. `meta.cursor.next` holds the cursor for the next page, or null on the last page. |
| `data.[]_k9o_row_id` | string | yes | Stable id over the row's rendered values. |
| `meta` | object | yes |  |
| `meta.cost` | object | yes | Metered usage for this request; empty when nothing was metered. |
| `meta.timing` | object | yes |  |
| `meta.timing.gatewayMs` | number | yes |  |
| `meta.timing.totalMs` | number | yes |  |
| `meta.context` | object | yes |  |
| `meta.context.requestId` | string | yes |  |
| `meta.context.traceId` | string | yes |  |
| `meta.context.projectId` | string | no |  |
| `meta.warnings` | array of object | no |  |
| `meta.warnings.[]code` | string | yes |  |
| `meta.warnings.[]message` | string | yes |  |
| `meta.cursor` | object | yes |  |
| `meta.cursor.next` | object | yes |  |
| _one of_ | | |  |
| _or_ | | |  |
| `meta.schema` | array of object | no | The declared columns; on the first page only. |
| `meta.schema.[]name` | string | yes | The column's name. |
| `meta.schema.[]type` | string | yes | `string`, `int32`, `int64`, `float64`, `bool`, `date`, `timestamp`, `json`, `bytes`, or `decimal(p,s)`. |


## Errors

| HTTP | Code | When |
|---|---|---|
| 401 | `K9O_UNAUTHENTICATED` | The caller is not signed in. |
| 403 | `K9O_ACCESS_DENIED` | The caller is not a member of this project; an organization role alone does not grant access. |
| 403 | `K9O_RBAC_DENY` | Only PROJECT_ADMIN, PROJECT_AUTHOR and PROJECT_EDITOR may query datasets. |
| 403 | `K9O_IAM_POLICY_DENIED` | The caller's role or IAM policy does not grant datasets:query. |
| 400 | `K9O_ANALYTICS_READ_INVALID` | The dataset slug or the body (`limit`, `cursor`, `partitionFilter`) is malformed. |
| 400 | `K9O_ANALYTICS_UNKNOWN_PARTITION_KEY` | `partitionFilter` names a key the dataset does not partition on. |
| 400 | `K9O_ANALYTICS_CURSOR_INVALID` | The cursor is invalid, expired, or was issued for another request. |
| 403 | `K9O_FORBIDDEN` | Extension tokens cannot read datasets through this endpoint. |
| 404 | `K9O_DATASET_NOT_FOUND` | No active dataset with this slug exists in the project. |
| 500 | `K9O_QUERY_EXECUTION_FAILED` | The query failed while running. |
| 503 | `K9O_ANALYTICS_UNAVAILABLE` | The region's analytics storage is not available yet; retry later. |

## Code samples

### cURL

```bash
curl -X POST 'https://<org>.api-<region>.k9o.io/@storefront/analytics/<datasetSlug>/read' \
  -H 'Authorization: Bearer $K9O_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{}'
```

### fetch

```javascript
const res = await fetch('https://<org>.api-<region>.k9o.io/@storefront/analytics/<datasetSlug>/read', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.K9O_TOKEN}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({}),
});
const { data, meta } = await res.json();
```

### k9o CLI

```bash
k9o analytics read <slug>
```

### @k9o/core

```typescript
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.analytics.read('<datasetSlug>', {})
```

### k9o

```python
# k9o = create_client(org_slug="playground", project_slug="storefront", api_key="k9o_…")
response = k9o.analytics.read("<datasetSlug>", {})
```

### sdk-go

```go
// ctx := context.Background()
// client, _ := k9o.NewClient(k9o.ClientOpts{OrgSlug: "playground", ProjectSlug: "storefront", APIKey: "k9o_…"})
data, _, kerr := client.Analytics.Read(ctx, "<datasetSlug>", map[string]any{})
```

### k9o

```rust
// let k9o = Client::new(ClientOpts { org_slug: "playground".into(), project_slug: "storefront".into(), api_key: "k9o_…".into() })?;
let resp = k9o.analytics.read("<datasetSlug>", json!({})).await?
```

### dev.k9o:core

```java
// K9o k9o = K9o.createClient(K9o.Opts.builder().orgSlug("playground").projectSlug("storefront").apiKey("k9o_…").build());
var response = k9o.analytics().read("<datasetSlug>", Map.of())
```

### K9o.Core

```c#
// var k9o = K9oClient.Create(new K9oOptions { OrgSlug = "playground", ProjectSlug = "storefront", ApiKey = "k9o_…" });
var response = await k9o.Analytics.ReadAsync("<datasetSlug>", new Dictionary<string, object> {  })
```

### k9o

```ruby
# k9o = K9o.create_client(org_slug: "playground", project_slug: "storefront", api_key: "k9o_…")
response = k9o.analytics.read("<datasetSlug>", {  })
```

### k9o/sdk

```php
// $k9o = K9oClient::create(['org_slug' => 'playground', 'project_slug' => 'storefront', 'api_key' => 'k9o_…']);
$response = $k9o->analytics->read('<datasetSlug>', [])
```


Canonical page: https://docs.kilimanjaro.dev/api-playground/core/read-dataset-rows
