---
title: "Create a view"
method: POST
path: "/views"
tags: ["views"]
---

# Create a view

`POST /views`

Create a view, this can be against an internal or external table.

## Headers

- `x-budibase-app-id` string, required

## Request body

- View — The view to be created/updated.
  - `name` string, required — The name of the view.
  - `tableId` string, required — The ID of the table this view is based on.
  - `type` 'calculation' — The type of view - standard (empty value) or calculation.
  - `primaryDisplay` string — A column used to display rows from this view - usually used when rendered in tables.
  - `query` object — Search parameters for view
    - `logicalOperator` 'all' | 'any' — When using groups this defines whether all of the filters must match, or only one of them.
    - `onEmptyFilter` 'all' | 'none' — If no filters match, should the view return all rows, or no rows.
    - `groups` object[] — A grouping of filters to be applied.
      - `logicalOperator` 'all' | 'any' — When using groups this defines whether all of the filters must match, or only one of them.
      - `filters` object[] — A list of filters to apply
        - `operator` 'equal' | 'notEqual' | 'empty' | 'notEmpty' | 'fuzzy' | 'string' | 'contains' | 'notContains' | 'containsAny' | 'oneOf' | 'range' — The type of search operation which is being performed.
        - `field` string — The field in the view to perform the search on.
        - `value` union — The value to search for - the type will depend on the operator in use.
          - string
          - number
          - boolean
          - object
      - `groups` object[] — A grouping of filters to be applied.
        - `logicalOperator` 'all' | 'any' — When using groups this defines whether all of the filters must match, or only one of them.
        - `filters` object[] — A list of filters to apply
          - `operator` 'equal' | 'notEqual' | 'empty' | 'notEmpty' | 'fuzzy' | 'string' | 'contains' | 'notContains' | 'containsAny' | 'oneOf' | 'range' — The type of search operation which is being performed.
          - `field` string — The field in the view to perform the search on.
          - `value` union — The value to search for - the type will depend on the operator in use.
            - string
            - number
            - boolean
            - object
  - `sort` object
    - `field` string, required — The field from the table/view schema to sort on.
    - `order` 'ascending' | 'descending' — The order in which to sort.
    - `type` 'string' | 'number' — The type of sort to perform (by number, or by alphabetically).
  - `schema` object, required

## Response `200`

Returns the created view, including the ID which has been generated for it.

- ViewOutput
  - `data` object, required — The view to be created/updated.
    - `name` string, required — The name of the view.
    - `tableId` string, required — The ID of the table this view is based on.
    - `type` 'calculation' — The type of view - standard (empty value) or calculation.
    - `primaryDisplay` string — A column used to display rows from this view - usually used when rendered in tables.
    - `query` object — Search parameters for view
      - `logicalOperator` 'all' | 'any' — When using groups this defines whether all of the filters must match, or only one of them.
      - `onEmptyFilter` 'all' | 'none' — If no filters match, should the view return all rows, or no rows.
      - `groups` object[] — A grouping of filters to be applied.
        - `logicalOperator` 'all' | 'any' — When using groups this defines whether all of the filters must match, or only one of them.
        - `filters` object[] — A list of filters to apply
          - `operator` 'equal' | 'notEqual' | 'empty' | 'notEmpty' | 'fuzzy' | 'string' | 'contains' | 'notContains' | 'containsAny' | 'oneOf' | 'range' — The type of search operation which is being performed.
          - `field` string — The field in the view to perform the search on.
          - `value` union — The value to search for - the type will depend on the operator in use.
            - string
            - number
            - boolean
            - object
        - `groups` object[] — A grouping of filters to be applied.
          - `logicalOperator` 'all' | 'any' — When using groups this defines whether all of the filters must match, or only one of them.
          - `filters` object[] — A list of filters to apply
            - `operator` 'equal' | 'notEqual' | 'empty' | 'notEmpty' | 'fuzzy' | 'string' | 'contains' | 'notContains' | 'containsAny' | 'oneOf' | 'range' — The type of search operation which is being performed.
            - `field` string — The field in the view to perform the search on.
            - `value` union — The value to search for - the type will depend on the operator in use.
              - …
    - `sort` object
      - `field` string, required — The field from the table/view schema to sort on.
      - `order` 'ascending' | 'descending' — The order in which to sort.
      - `type` 'string' | 'number' — The type of sort to perform (by number, or by alphabetically).
    - `schema` object, required
    - `id` string, required — The ID of the view.

## Changes

- **2024-11-15** `a2256b3493f2` — 24 warning, 6 info
  - removed the request property `query/allOr`
  - removed the request property `query/contains`
  - removed the request property `query/containsAny`
  - removed the request property `query/empty`
  - …26 more
- **2024-11-08** `0ea5917c2882` — 1 breaking, 1 info
  - added the new required request property `tableId`
  - added the required property `data/tableId` to the response with the `200` status
- **2024-11-01** `18cb3dd9f35e` — 4 info
  - added the new optional request property `query`
  - added the new optional request property `sort`
  - added the optional property `data/query` to the response with the `200` status
  - added the optional property `data/sort` to the response with the `200` status
- **2024-10-31** `40cbb279838d` — 3 breaking, 8 warning, 3 info
  - the `schema/additionalProperties/` request property type changed from `object` to no type
  - added `subschema #1, subschema #2` to the `data/schema/additionalProperties/` response property `oneOf` list for the response status `200`
  - the `data/schema/additionalProperties/` response's property type changed from `object` to no type for status `200`
  - removed the request property `schema/additionalProperties/order`
  - …10 more
- **2024-10-30** `ac3872ebf1f7` — 1 info
  - endpoint added

[Full history](https://skmtc.dev/budibase/apis/budibase-api/changes/views/post.md)

---

[API](https://skmtc.dev/budibase/apis/budibase-api.md) · [All operations](https://skmtc.dev/budibase/apis/budibase-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/budibase/budibase-api/revisions/b823f37532cc/schema)
