# Saved views API

> Saved list filters and columns. Every route, its parameters and fields.

Saved list filters and columns. 7 routes; send a bearer token with each (see [Authentication](/api/authentication.md)).

| Route | What it does |
| --- | --- |
| `GET /v1/saved-views` | Saved views you can open |
| `POST /v1/saved-views` | Save a view |
| `GET /v1/saved-views/{id}` | Get a saved view |
| `PATCH /v1/saved-views/{id}` | Change a saved view (owner or admin) |
| `DELETE /v1/saved-views/{id}` | Delete a saved view (owner or admin) |
| `POST /v1/saved-views/{id}/copy` | Copy a saved view as your own private view |
| `POST /v1/saved-views/{id}/restore` | Restore a deleted saved view (admins) |

## Saved views you can open

`GET https://staging-api.naruskacrm.com/v1/saved-views`

Your own views, your teams' views and the company's views, in your order.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `limit` | query | integer |  | 1–200, default `50` |
| `cursor` | query | string |  | next_cursor of the previous page. 1–400 characters |
| `object_type` | query | `contact`, `account`, `opportunity`, `activity`, `quote`, `product`, `case`, `campaign` |  |  |

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `data` | array of [SavedView](/api/reference/objects.md#savedview) | yes |  |
| `next_cursor` | string or null | yes |  |

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Save a view

`POST https://staging-api.naruskacrm.com/v1/saved-views`

Filters, sort and columns are checked against the object's declared list (GET /v1/data-model); filters that hold record ids are refused. Counts toward saved_views.total.

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `object_type` | `contact`, `account`, `opportunity`, `activity`, `quote`, `product`, `case`, `campaign` | yes |  |
| `name` | string | yes | 1–200 characters |
| `visibility` | `private`, `team`, `company` |  |  |
| `team_id` | string (uuid) or null |  |  |
| `layout` | `list`, `board` |  |  |
| `definition` | object | yes |  |
| `definition.version` | `1` | yes |  |
| `definition.filters` | object | yes |  |
| `definition.sort` | array of string | yes | at most 1 items |
| `definition.columns` | array of string | yes | at most 30 items |
| `sort_order` | integer |  |  |

### Response 201

Returns: [SavedView](/api/reference/objects.md#savedview).

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Get a saved view

`GET https://staging-api.naruskacrm.com/v1/saved-views/{id}`

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Response 200

Returns: [SavedView](/api/reference/objects.md#savedview).

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Change a saved view (owner or admin)

`PATCH https://staging-api.naruskacrm.com/v1/saved-views/{id}`

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `name` | string |  | 1–200 characters |
| `visibility` | `private`, `team`, `company` |  |  |
| `team_id` | string (uuid) or null |  |  |
| `layout` | `list`, `board` |  |  |
| `definition` | object |  |  |
| `definition.version` | `1` | yes |  |
| `definition.filters` | object | yes |  |
| `definition.sort` | array of string | yes | at most 1 items |
| `definition.columns` | array of string | yes | at most 30 items |
| `sort_order` | integer |  |  |

### Response 200

Returns: [SavedView](/api/reference/objects.md#savedview).

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Delete a saved view (owner or admin)

`DELETE https://staging-api.naruskacrm.com/v1/saved-views/{id}`

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Response 204

Done.
No body.

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Copy a saved view as your own private view

`POST https://staging-api.naruskacrm.com/v1/saved-views/{id}/copy`

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `name` | string |  | 1–200 characters |

### Response 201

Returns: [SavedView](/api/reference/objects.md#savedview).

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Restore a deleted saved view (admins)

`POST https://staging-api.naruskacrm.com/v1/saved-views/{id}/restore`

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Response 200

Returns: [SavedView](/api/reference/objects.md#savedview).

Errors are problem details with a stable `code`: see [Errors](/errors.md).

