---
title: "Create a data table view"
method: POST
path: "/v1/projects/{project_id}/tables/{id}/views"
tags: ["DataTable"]
---

# Create a data table view

`POST /v1/projects/{project_id}/tables/{id}/views`

## Request

- Base URL: `https://api.telerivet.com`
- URL: `https://api.telerivet.com/v1/projects/{project_id}/tables/{id}/views`
- Auth: one of:
  - HTTP basic
  - OAuth 2 (authorization code, authorization URL `https://telerivet.com/oauth/authorize`, token URL `https://api.telerivet.com/oauth/token`)

Creates a new view of this data table, defined by a filter on its rows. The view's filter conditions cannot be changed after the view is created (although the view can be renamed or deleted).

 Telerivet will automatically store the count of rows matching each data view once a day, making it possible to retrieve historical statistics for the number of rows matching the filter, but only for dates after the view is created.

## Path parameters

- `project_id` string, required
- `id` string, required

## Request body

- object
  - `name` string, required: Name of the view (must be unique within the data table)
  - `filters` object, required: Key-value pairs of conditions that rows must match to be included in the view. To filter by a custom variable, precede the variable name with 'vars.' (conditions on custom variables may also be provided as a nested object under a `vars` key, e.g. `{"vars": {"q1": "yes"}}`); other supported keys are `id`, `time_created`, `time_updated`, `contact_id`, `contact_name`, and `from_number`. Each value is either a value to match exactly, or an object with an operator such as `ne`, `prefix`, `gte`, `gt`, `lte`, `lt`, `exists`, or `not_exists` as the key (e.g. `{"gte": 10}`).
  - `vars` object: Custom variables to store with the data view

## Response `200`

Successful response

- DataView: Represents a view of a data table, defined by a saved filter on the table's rows. The view's filter conditions cannot be changed after the view is created (although the view can be renamed or deleted). Telerivet will automatically store the count of rows matching each data view once a day, making it possible to retrieve historical statistics for the number of rows matching the filter.
  - `id` string: ID of the data view
  - `name` string: Name of the data view
  - `num_rows` integer: Number of rows matching the view filter. For performance reasons, this number may sometimes be out-of-date.
  - `filters` object: Key-value pairs of conditions that rows must match to be included in the view, in the same format as the `filters` parameter of table.createView
  - `vars` object: Custom variables stored for this data view. Variable names may be up to 32 characters in length and can contain the characters a-z, A-Z, 0-9, and _. Values may be strings, numbers, or boolean (true/false). String values may be up to 4096 bytes in length when encoded as UTF-8. Up to 100 variables are supported per object. Setting a variable to null will delete the variable.
  - `table_id` string: ID of the table this view belongs to
  - `project_id` string: ID of the project this view belongs to
  - `url` string: URL to this view in the Telerivet web app

## Other responses

- `400`: Invalid request parameters
- `401`: Invalid or missing API key or Bearer token
- `404`: Resource not found

---

[API](https://skmtc.dev/telerivet/apis/telerivet-api.md) · [All operations](https://skmtc.dev/telerivet/apis/telerivet-api/llms.txt) · [OpenAPI document](https://skmtc.dev/telerivet/apis/telerivet-api/revisions/4e14b1c8d917?raw)
