---
title: "table.views.update: Update a view — Table kit command — Kition"
description: "Renames a view, changes its type, or replaces its configuration."
canonical: "https://developer.kition.ai/docs/kits/table/commands/table.views.update"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/table/commands/table.views.update](https://developer.kition.ai/docs/kits/table/commands/table.views.update)

# table.views.update

**Update a view.** Renames a view, changes its type, or replaces its configuration.

- Kit: Table 0.4.0 (.ktable); reference: [Table kit commands](https://developer.kition.ai/docs/kits/table.md)
- Changes the document: yes

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `asOrigin` | `string` | no | system:<name> writes as a host feature, outside the undo history. Agents leave it out. |
| `config` | `any` | no | The view's configuration object. |
| `tableId` | `integer \| string` | yes | The table's id. |
| `title` | `string` | no |  |
| `type` | `"grid" \| "kanban" \| "calendar" \| "gallery"` | no | The view's type (default grid). grid: Rows and columns. kanban: Cards in columns, one per choice of a single_select field (config group_field_name, else the first single_select) or per checkbox value. calendar: Records placed on the table's first date or datetime field. gallery: Cards with a cover picture (config cover_field_name, else the first attachment or url field). |
| `viewId` | `integer \| string` | yes | The view's id. |

## Call through table_run

```text
table_run {
  "path": "<file>.ktable",
  "steps": [{ "command": "table.views.update", "params": { "tableId": <integer | string>, "viewId": <integer | string> } }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `asOrigin`, `config`, `title`, `type`. table_run answers the step’s result in `completed[i].result`.

## Result

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `change` | `object \| null` | no | What the call changed, or null. |
| `error` | `object` | no | Why the call failed (A18); the file is as it was. |
| `result` | `object` | no | A view of a table. |

```json
{
  "additionalProperties": false,
  "description": "The request's own answer is in `result`, beside `change`: what the call changed in the document (null when nothing changed). A failed call answers `error` instead (A18).",
  "properties": {
    "change": {
      "description": "What the call changed, or null.",
      "oneOf": [
        {
          "additionalProperties": false,
          "description": "What one projection changed in the relational tables, by integer id. Every list is sorted and\nholds no repeats.",
          "properties": {
            "dashboards": {
              "description": "A dashboard, or the base's list of them, changed.",
              "type": "boolean"
            },
            "documentId": {
              "type": "string"
            },
            "origin": {
              "description": "Who wrote it: kind:principal, or a system origin's label.",
              "type": "string"
            },
            "recordsDeleted": {
              "description": "[tableId, rowKey] pairs.",
              "items": {
                "items": {},
                "type": "array"
              },
              "type": "array"
            },
            "recordsReordered": {
              "description": "Tables whose records' positions changed.",
              "items": {
                "type": "integer"
              },
              "type": "array"
            },
            "recordsUpserted": {
              "description": "[tableId, rowKey] pairs.",
              "items": {
                "items": {},
                "type": "array"
              },
              "type": "array"
            },
            "schema": {
              "description": "Tables whose fields were added, removed, updated, or reordered.",
              "items": {
                "type": "integer"
              },
              "type": "array"
            },
            "tables": {
              "description": "Tables whose own row changed: created, deleted, renamed, moved, or given a new primary\nfield.",
              "items": {
                "type": "integer"
              },
              "type": "array"
            },
            "views": {
              "description": "Views created, deleted, updated, or reordered, or whose column widths or visibility\nchanged.",
              "items": {
                "type": "integer"
              },
              "type": "array"
            }
          },
          "required": [
            "tables",
            "schema",
            "views",
            "recordsReordered",
            "dashboards"
          ],
          "type": "object"
        },
        {
          "type": "null"
        }
      ]
    },
    "error": {
      "additionalProperties": false,
      "description": "Why the call failed (A18); the file is as it was.",
      "properties": {
        "code": {
          "enum": [
            "invalid-params",
            "invalid-op",
            "invalid-value",
            "not-found",
            "read-only",
            "unknown-command",
            "command-failed",
            "not-open",
            "draft-required",
            "not-allowed",
            "unsupported",
            "unavailable",
            "failed"
          ],
          "type": "string"
        },
        "index": {
          "description": "The failing step or operation.",
          "type": "integer"
        },
        "message": {
          "type": "string"
        },
        "retryable": {
          "type": "boolean"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object"
    },
    "result": {
      "additionalProperties": true,
      "description": "A view of a table.",
      "properties": {
        "config": {
          "additionalProperties": true,
          "description": "Its filters, sorts, groups and display settings.",
          "type": "object"
        },
        "created_at": {
          "description": "When it was created, in Unix milliseconds.",
          "type": "integer"
        },
        "document_id": {
          "description": "Always 1: the document's id.",
          "type": "integer"
        },
        "id": {
          "description": "The view's local projection address (viewId).",
          "type": "integer"
        },
        "locked": {
          "description": "The view is locked against changes in the editor.",
          "type": "boolean"
        },
        "order": {
          "description": "Its position among the table's views, from 1.",
          "type": "integer"
        },
        "table_id": {
          "description": "The table's id.",
          "type": "integer"
        },
        "title": {
          "description": "The view's title.",
          "type": "string"
        },
        "tool_id": {
          "description": "The stable UUID accepted by viewId and used by receipts and conflicts.",
          "type": "string"
        },
        "type": {
          "description": "The view type.",
          "enum": [
            "grid",
            "kanban",
            "calendar",
            "gallery"
          ],
          "type": "string"
        },
        "updated_at": {
          "description": "When it last changed, in Unix milliseconds.",
          "type": "integer"
        },
        "user_id": {
          "description": "Always 0: the document's own user.",
          "type": "integer"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
```

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "asOrigin": {
      "description": "system:<name> writes as a host feature, outside the undo history. Agents leave it out.",
      "type": "string"
    },
    "config": {
      "description": "The view's configuration object."
    },
    "tableId": {
      "description": "The table's id.",
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "string"
        }
      ],
      "x-khp-types": [
        "Table"
      ]
    },
    "title": {
      "type": "string"
    },
    "type": {
      "description": "The view's type (default grid).\ngrid: Rows and columns.\nkanban: Cards in columns, one per choice of a single_select field (config group_field_name, else the first single_select) or per checkbox value.\ncalendar: Records placed on the table's first date or datetime field.\ngallery: Cards with a cover picture (config cover_field_name, else the first attachment or url field).",
      "enum": [
        "grid",
        "kanban",
        "calendar",
        "gallery"
      ],
      "type": "string"
    },
    "viewId": {
      "description": "The view's id.",
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "string"
        }
      ],
      "x-khp-types": [
        "View"
      ]
    }
  },
  "required": [
    "tableId",
    "viewId"
  ],
  "type": "object"
}
```

Generated from kition-sdk packages/script/kits/table.ts and the kit itself (kition-table@ee73209).
