Handle all views operations in the Notion API
Note: Access this endpoint through the client instance, e.g., notion$views. Not to be instantiated directly.
Methods
Method new()
Initialise views endpoint.
Not to be called directly, e.g., use notion$views instead.
Usage
ViewsEndpoint$new(client)Method create()
Create a view
Usage
ViewsEndpoint$create(
data_source_id,
name,
type,
database_id = NULL,
view_id = NULL,
filter = NULL,
sorts = NULL,
quick_filters = NULL,
create_database = NULL,
configuration = NULL,
position = NULL,
placement = NULL
)Arguments
data_source_idCharacter (required). The ID of the data source this view is scoped to.
nameCharacter (required). The name of the view.
typeCharacter (required). The type of view to create.
database_idCharacter. The ID of the database to create a view in. Mutually exclusive with
view_idandcreate_databaseview_idCharacter. The ID of a dashboard view to add this view to as a widget. Mutually exclusive with
database_idandcreate_database.filterNamed list (JSON object). Filter to apply to the view.
sortsList of lists (JSON array). Sorts to apply to the view.
quick_filtersNamed list (JSON object). Key-value pairs of quick filters to pin in the view's filter bar.
create_databaseNamed list (JSON object). Create a new linked database block and add the view to it. Mutually exclusive with
database_idandview_idconfigurationNamed list (JSON object). View presentation configuration.
positionNamed list (JSON object). Where to place the new view in the database's view tab bar. Only applicable when
database_idis provided. Defaults to "end" (append).placementNamed list (JSON object). Where to place the new widget in a dashboard view. Only applicable when
view_idis provided. Defaults to creating a new row at the end.
Method update()
Update a view
Usage
ViewsEndpoint$update(
view_id,
name = NULL,
filter = NULL,
sorts = NULL,
quick_filters = NULL,
configuration = NULL
)Arguments
view_idID of a Notion view.
nameCharacter. New name for the view.
filterNamed list (JSON object). Filter to apply to the view.
sortsList of lists (JSON array). Property sorts to apply to the view.
quick_filtersNamed list (JSON object). Key-value pairs of quick filters to add/update.
configurationNamed list (JSON object). View presentation configuration.
Method list()
List all views in a database
Usage
ViewsEndpoint$list(
database_id = NULL,
data_source_id = NULL,
start_cursor = NULL,
page_size = NULL
)Arguments
database_idCharacter. ID of a Notion database to list views for. At least one of
database_idordata_source_idis required.data_source_idCharacter. ID of a data source to list all views for, including linked views across the workspace. At least one of
database_idordata_source_idis required.start_cursorCharacter. For pagination. If provided, returns results starting from this cursor. If NULL, returns the first page of results.
page_sizeInteger. Number of items to return per page (1-100). Defaults to 100
Examples
notion <- notion_client()
# ----- Create a view
notion$views$create(
"34033ea0-c1e4-8112-bc3a-000bc940aa45",
"Test view",
"table",
"ffec20ee-1450-4da8-9904-f4babba0e9c0"
)
#> {
#> "object": "view",
#> "id": "34033ea0-c1e4-8192-ac14-000cdad096ce",
#> "parent": {
#> "type": "database_id",
#> "database_id": "ffec20ee-1450-4da8-9904-f4babba0e9c0"
#> },
#> "data_source_id": "34033ea0-c1e4-8112-bc3a-000bc940aa45",
#> "name": "Test view",
#> "type": "table",
#> "created_time": "2026-04-12T21:18:58.550+00:00",
#> "created_by": {
#> "object": "user",
#> "id": "6b786605-e456-4237-9c61-5efaff23c081"
#> },
#> "last_edited_time": "2026-04-12T21:18:58.550+00:00",
#> "last_edited_by": {
#> "object": "user",
#> "id": "6b786605-e456-4237-9c61-5efaff23c081"
#> },
#> "url": "https://www.notion.so/ffec20ee14504da89904f4babba0e9c0?v=34033ea0c1e48192ac14000cdad096ce",
#> "filter": {},
#> "sorts": {},
#> "quick_filters": {},
#> "configuration": {
#> "type": "table"
#> },
#> "request_id": "9df04e44-b651-4065-b650-7e7c46b01fb2"
#> }
# ----- Retrieve a view
notion$views$retrieve("34033ea0-c1e4-8192-ac14-000cdad096ce")
#> {
#> "object": "view",
#> "id": "34033ea0-c1e4-8192-ac14-000cdad096ce",
#> "parent": {
#> "type": "database_id",
#> "database_id": "ffec20ee-1450-4da8-9904-f4babba0e9c0"
#> },
#> "data_source_id": "34033ea0-c1e4-8112-bc3a-000bc940aa45",
#> "name": "Test view",
#> "type": "table",
#> "created_time": "2026-04-12T21:18:58.550+00:00",
#> "created_by": {
#> "object": "user",
#> "id": "6b786605-e456-4237-9c61-5efaff23c081"
#> },
#> "last_edited_time": "2026-04-12T21:18:58.550+00:00",
#> "last_edited_by": {
#> "object": "user",
#> "id": "6b786605-e456-4237-9c61-5efaff23c081"
#> },
#> "url": "https://www.notion.so/ffec20ee14504da89904f4babba0e9c0?v=34033ea0c1e48192ac14000cdad096ce",
#> "filter": {},
#> "sorts": {},
#> "quick_filters": {},
#> "configuration": {
#> "type": "table"
#> },
#> "request_id": "8586abdb-5f05-4f2a-ae69-0861525ccca5"
#> }
# ----- List views
notion$views$list(data_source_id = "34033ea0-c1e4-8112-bc3a-000bc940aa45")
#> {
#> "object": "list",
#> "results": [
#> {
#> "object": "view",
#> "id": "34033ea0-c1e4-818e-9c98-000c019044bd"
#> },
#> {
#> "object": "view",
#> "id": "34033ea0-c1e4-8192-ac14-000cdad096ce"
#> }
#> ],
#> "next_cursor": {},
#> "has_more": false,
#> "type": "view",
#> "view": {},
#> "request_id": "2f24742c-6e72-4599-abc3-4232451dc7be"
#> }
# ----- Update a view
notion$views$update("34033ea0-c1e4-8192-ac14-000cdad096ce", "Updated view name")
#> {
#> "object": "view",
#> "id": "34033ea0-c1e4-8192-ac14-000cdad096ce",
#> "parent": {
#> "type": "database_id",
#> "database_id": "ffec20ee-1450-4da8-9904-f4babba0e9c0"
#> },
#> "data_source_id": "34033ea0-c1e4-8112-bc3a-000bc940aa45",
#> "name": "Updated view name",
#> "type": "table",
#> "created_time": "2026-04-12T21:18:58.550+00:00",
#> "created_by": {
#> "object": "user",
#> "id": "6b786605-e456-4237-9c61-5efaff23c081"
#> },
#> "last_edited_time": "2026-04-12T21:18:59.977+00:00",
#> "last_edited_by": {
#> "object": "user",
#> "id": "6b786605-e456-4237-9c61-5efaff23c081"
#> },
#> "url": "https://www.notion.so/ffec20ee14504da89904f4babba0e9c0?v=34033ea0c1e48192ac14000cdad096ce",
#> "filter": {},
#> "sorts": {},
#> "quick_filters": {},
#> "configuration": {
#> "type": "table"
#> },
#> "request_id": "1396db86-43d6-43f5-8f9c-a24d72815839"
#> }
# ----- Delete a view
notion$views$delete("34033ea0-c1e4-8192-ac14-000cdad096ce")
#> {
#> "object": "view",
#> "id": "34033ea0-c1e4-8192-ac14-000cdad096ce",
#> "parent": {
#> "type": "database_id",
#> "database_id": "ffec20ee-1450-4da8-9904-f4babba0e9c0"
#> },
#> "type": "table",
#> "request_id": "b3ac0c2a-64a7-4102-b4a6-e5a066003751"
#> }
