Developer API
Create Database View
V2

Create Database View

Create a view on a database; the type is fixed at creation.

POST /v2/databases/:database_id/views

Create Database View

Use Case

Use this endpoint to add another view to a database (for example another board or calendar). The view type is determined at creation and cannot be changed afterwards; create another view to switch types.

Endpoint

Item Value
Method POST
Path /v2/databases/:database_id/views
Request body CreateDatabaseViewRequest
Returns database_view
Scope databases.write
Idempotency Supports the Idempotency-Key header

Permissions

Requires databases.write and write access to the database.

Parameters

Parameter Type Required Description
title string No View title, at most 200 characters, defaults to 默认视图.
type string No table (default) / board / gallery / list / calendar / timeline / form.
property_layout array No Ordered column layout, set in full. When omitted: table starts with all properties visible, other types start with only the title column visible (matching views created in the product). Not supported for timeline/form.
filter object | null No Web-client filter group; see Get Database View.
sorts array | null No Web-client sorter array.
group_by object | null No Only table/board support grouping.
config object | null No Type-validated per-type config.

All property references should use the exact property id returned by the database or view API, otherwise the request fails with 400. For backward compatibility, only property_layout[].property_id additionally accepts the literal title; when the schema has no exact title key, the API resolves it to the sole title property and stores its exact id. For select and multi_select filters, use the option id returned by Retrieve a database. A unique option name is also accepted for backward compatibility and normalized to its id; unknown or ambiguous names return 400.

Request Example

curl -X POST https://api.buildin.ai/v2/databases/66666666-6666-4666-8666-666666666666/views \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Status board",
    "type": "board",
    "group_by": { "property_id": "88888888-8888-4888-8888-888888888888", "hide_empty_groups": false },
    "config": { "card_size": "medium" }
  }'

Behavior

  • The view record and the database block's views array are written in one transaction.
  • Initial manual order: when the database holds at most 500 records, the current record order is copied; otherwise the order starts empty (queries fall back to the natural record order, and the web client self-heals it).
  • Filter limits: at most 100 conditions and nesting depth 2; unknown or ambiguous select options are rejected; formula/rollup properties are not allowed in conditions (including isEmpty/isNotEmpty, because the server-side evaluator cannot evaluate them and such a condition would be silently dropped at query time).
  • mode is rejected on write: the server-side evaluator always applies any semantics, so accepting it would silently mislead callers.
  • Width limit: property_layout.width is an integer between 80 and 800.
  • created_time / last_edited_time in the response come from the persisted row, so the weak ETag on the response headers can be used directly as If-Match on a later PATCH.

Type-specific defaults

Filled from the existing schema, matching how the product creates views:

Type Filled automatically When the schema cannot satisfy it
board First select property as the group property, with group buckets 400 — add a select property first, or pass group_by explicitly
calendar First two date properties as start/end 400 — add a date property first, or pass config.date_property_id explicitly
timeline First two date properties as start/end 400 — add a date property first, or pass config.start_property_id explicitly
gallery Cover page_content, card medium —
form Serial number and description enabled —

Unlike the web client, this endpoint does not create the missing property for you; it rejects the request instead of leaving behind a view the product cannot render.

Errors

Status Code Description
400 validation_error Unknown property reference, incompatible type, exceeded limits, formula/rollup conditions, mode on write, and so on.
400 validation_error board without a group property, or calendar/timeline without an axis property (reason is board_group_property_required / calendar_date_property_required / timeline_date_property_required).
403 forbidden Missing scope or no write access to the database.
404 not_found Database does not exist.
409 idempotency_conflict The idempotency key was reused with a different request body.