# Update a view

Source: https://docs.maylee.app/api-reference/views/update-view

`PATCH https://api.maylee.app/api/v1/views/{viewId}`

Scope: `write`.

`filters` replaces the whole tree. At least one field is required.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `viewId` | path | string | yes |  |

## Request body

`application/json`, required.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `filters` | object or object or object | no | Filter tree in the public DSL, or `{}` for no filter. |
| `icon` | string or null | no | 0 to 32 characters. |
| `name` | string | no | 1 to 100 characters. |

## Example request

```bash
curl -X PATCH "https://api.maylee.app/api/v1/views/<viewId>" \
  -H "Authorization: Bearer $MAYLEE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Hot leads"
}'
```

## Responses

### 200

The updated view.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `view` | View | yes |  |
| `view.createdAt` | string (date-time) | yes |  |
| `view.filters` | object or object or object | yes | Filter tree in the public DSL, or `{}` for no filter. |
| `view.icon` | string or null | yes |  |
| `view.id` | string | yes |  |
| `view.mailboxIds` | array of string | yes | Mailboxes the view is restricted to. Empty means all. |
| `view.name` | string | yes |  |

```json
{
  "view": {
    "createdAt": "2026-07-01T10:00:00.000Z",
    "filters": {
      "_and": [
        {
          "id": "c1",
          "label": "ai_label",
          "type": "contains",
          "value": "cmtgai1b2c3d4e5f6g7h8i9j"
        },
        {
          "id": "c2",
          "label": "read_status",
          "type": "is_false",
          "value": ""
        }
      ],
      "id": "g1"
    },
    "icon": "🎯",
    "id": "cmvw1a2b3c4d5e6f7g8h9i0j",
    "mailboxIds": [],
    "name": "Leads to answer"
  }
}
```

### 400

Invalid or empty payload, invalid filter tree, or a bound was exceeded.

### 401

Missing, malformed, revoked or expired API key.

### 403

Key lacks the required scope, or outbound sending is not enabled on it.

### 404

Not found, or belongs to another workspace.

### 429

Per-minute rate limit (`RATE_LIMIT_EXCEEDED`) or monthly quota (`QUOTA_EXCEEDED`) exhausted.

Errors use the format `{ "code", "error", "details" }`: see [Errors](/errors.md).
