---
title: "Data preview"
method: GET
path: "/v2/storage/tables/{tableId}/data-preview"
tags: ["Tables"]
---

# Data preview

`GET /v2/storage/tables/{tableId}/data-preview`

## Request

- Base URL: `https://connection.keboola.com`
- URL: `https://connection.keboola.com/v2/storage/tables/{tableId}/data-preview`
- Auth: one of:
  - API key in header `X-StorageApi-Token`
  - API key in header `X-KBC-ManageApiToken`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/keboola/apis/keboola-storage-api/docs/v2/storage/tables/:tableId/data-preview/get.ts> (a function with typed inputs; its response is checked against the schema)

Returns up to 1000 rows from a table in CSV (RFC) or JSON format. Rows can be filtered by the same filters as the asynchronous export
(`changedSince`, `changedUntil`, `columns`, `whereFilters`, `orderBy`, `fulltextSearch`).
For a full table download use the asynchronous export.

The `isTruncated` flag is `true` if the value is >16k chars and the response type is JSON.

#### HTTP Compression

To enable compression of the API response traffic, include the HTTP header `Accept-encoding: gzip` with the request.

## Path parameters

- `tableId` string, required

## Query parameters

- `limit` integer: Limit the number of returned rows. Maximum allowed value is `1000`.
- `changedSince` string, nullable: Filtering by import date - the import timestamp is stored within each row. Accepts a unix timestamp or any date accepted by strtotime.
- `changedUntil` string, nullable: Filtering by import date - the import timestamp is stored within each row. Accepts a unix timestamp or any date accepted by strtotime.
- `columns` string, nullable: Comma separated list of columns to export; by default all columns are exported.
- `whereColumn` string, nullable: Deprecated (use `whereFilters` instead). Column for exporting only matching rows.
- `whereValues[]` string[], nullable: Deprecated (use `whereFilters` instead). Values for exporting only matching rows.
- `whereOperator` 'eq' | 'ne', nullable: Deprecated (use `whereFilters` instead). Operator for value comparison: `eq` (can be used with multiple values) or `ne`.
- `format` 'rfc' | 'json', nullable: Output format of the preview: `rfc` returns CSV, `json` returns JSON.
- `whereFilters[]` WhereFiltersObject[], nullable: Row filters (see the asynchronous export for the filter description). Sent as `whereFilters[0][column]=...`.
  - `column` string, required: Column to filter by.
  - `operator` 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le': `eq`/`ne` support multiple `values` (IN/NOT IN semantics); `gt`/`ge`/`lt`/`le` accept a single value only.
  - `values` string[], required: Values to compare against.
  - `dataType` string, nullable: Cast the column to this data type before comparing (`INTEGER` or `DOUBLE` on Snowflake; `STRING`, `INTEGER`, `DOUBLE`, `BIGINT`, `REAL`, `DECIMAL` or `TIMESTAMP` on BigQuery). Required for `gt`/`ge`/`lt`/`le` on numeric values; must be empty or `TIMESTAMP` when `type` is `TIME_STRING`.
  - `type` 'SCALAR' | 'TIME_STRING': How `values` are interpreted. `SCALAR` compares raw values; `TIME_STRING` interprets them as date/time strings or unix timestamps.
- `orderBy[]` OrderByObject[], nullable: Sort specification. Sent as `orderBy[0][column]=...`.
  - `column` string, required: Column to sort by.
  - `order` 'ASC' | 'DESC': Sort direction.
  - `dataType` string, nullable: Cast the column to this data type before sorting (`INTEGER` or `DOUBLE` on Snowflake; `STRING`, `INTEGER`, `DOUBLE`, `BIGINT`, `REAL`, `DECIMAL` or `TIMESTAMP` on BigQuery). Required when sorting a numeric column; disallowed for typed tables.
- `fulltextSearch` string, nullable: Fulltext search over all data in the table. Cannot be combined with `whereFilters`. Snowflake/BigQuery only.
- `cache` boolean: A JSON preview requested without any other parameter is served from a cache that is refreshed whenever the table changes. Set to `0` to always read the data from the backend.

## Response `200`

Table data in the requested format (CSV or JSON).

- object: Each row is an array of cells aligned to "columns".
  - `columns` string[], required
  - `rows` array[], required
    - object[]
      - `columnName` string, required
      - `value` union, required
        - string
        - number
        - boolean
      - `isTruncated` boolean, required

## Other responses

- `400`: Invalid request parameters, or BigQuery denied reading a column protected by a policy tag (`storage.backend.policyTagAccessDenied`).
- `403`: Token does not have read access to the bucket.
- `404`: Table not found (`storage.tables.notFound`).

---

[API](https://skmtc.dev/keboola/apis/keboola-storage-api.md) - [All operations](https://skmtc.dev/keboola/apis/keboola-storage-api/llms.txt) - [OpenAPI document](https://skmtc.dev/keboola/apis/keboola-storage-api/revisions/34b5ceac0317?raw)
