Skip to content

API endpoints

Notion API endpoints.

BlocksChildrenEndpoint

Bases: Endpoint

Source code in notion_client/api_endpoints.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
class BlocksChildrenEndpoint(Endpoint):
    def append(self, block_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Create and append new children blocks to the block using the ID specified.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/patch-block-children)*
        """  # noqa: E501
        return self.parent.request(
            path=f"blocks/{block_id}/children",
            method="PATCH",
            body=pick(kwargs, "children", "after", "position"),
            auth=kwargs.get("auth"),
        )

    def list(self, block_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Return a paginated array of child [block objects](https://developers.notion.com/reference/block) contained in the block.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/get-block-children)*
        """  # noqa: E501
        return self.parent.request(
            path=f"blocks/{block_id}/children",
            method="GET",
            query=pick(kwargs, "start_cursor", "page_size"),
            auth=kwargs.get("auth"),
        )

append(block_id, **kwargs)

Create and append new children blocks to the block using the ID specified.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
18
19
20
21
22
23
24
25
26
27
28
def append(self, block_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Create and append new children blocks to the block using the ID specified.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/patch-block-children)*
    """  # noqa: E501
    return self.parent.request(
        path=f"blocks/{block_id}/children",
        method="PATCH",
        body=pick(kwargs, "children", "after", "position"),
        auth=kwargs.get("auth"),
    )

list(block_id, **kwargs)

Return a paginated array of child block objects contained in the block.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
30
31
32
33
34
35
36
37
38
39
40
def list(self, block_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Return a paginated array of child [block objects](https://developers.notion.com/reference/block) contained in the block.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/get-block-children)*
    """  # noqa: E501
    return self.parent.request(
        path=f"blocks/{block_id}/children",
        method="GET",
        query=pick(kwargs, "start_cursor", "page_size"),
        auth=kwargs.get("auth"),
    )

BlocksEndpoint

Bases: Endpoint

Source code in notion_client/api_endpoints.py
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
class BlocksEndpoint(Endpoint):
    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.children = BlocksChildrenEndpoint(*args, **kwargs)
        self.meeting_notes = BlocksMeetingNotesEndpoint(*args, **kwargs)

    def retrieve(self, block_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Retrieve a [Block object](https://developers.notion.com/reference/block) using the ID specified.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-a-block)*
        """  # noqa: E501
        return self.parent.request(
            path=f"blocks/{block_id}", method="GET", auth=kwargs.get("auth")
        )

    def update(self, block_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Update the content for the specified `block_id` based on the block type.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/update-a-block)*
        """  # noqa: E501
        return self.parent.request(
            path=f"blocks/{block_id}",
            method="PATCH",
            body=pick(
                kwargs,
                "embed",
                "type",
                "archived",
                "in_trash",
                "bookmark",
                "image",
                "video",
                "pdf",
                "file",
                "audio",
                "code",
                "equation",
                "divider",
                "breadcrumb",
                "tab",
                "table_of_contents",
                "link_to_page",
                "table_row",
                "heading_1",
                "heading_2",
                "heading_3",
                "heading_4",
                "paragraph",
                "bulleted_list_item",
                "numbered_list_item",
                "quote",
                "to_do",
                "toggle",
                "template",
                "callout",
                "synced_block",
                "table",
                "column",
            ),
            auth=kwargs.get("auth"),
        )

    def delete(self, block_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Set a [Block object](https://developers.notion.com/reference/block), including page blocks, to `archived: true`.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/delete-a-block)*
        """  # noqa: E501
        return self.parent.request(
            path=f"blocks/{block_id}",
            method="DELETE",
            auth=kwargs.get("auth"),
        )

delete(block_id, **kwargs)

Set a Block object, including page blocks, to archived: true.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
119
120
121
122
123
124
125
126
127
128
def delete(self, block_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Set a [Block object](https://developers.notion.com/reference/block), including page blocks, to `archived: true`.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/delete-a-block)*
    """  # noqa: E501
    return self.parent.request(
        path=f"blocks/{block_id}",
        method="DELETE",
        auth=kwargs.get("auth"),
    )

retrieve(block_id, **kwargs)

Retrieve a Block object using the ID specified.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
63
64
65
66
67
68
69
70
def retrieve(self, block_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Retrieve a [Block object](https://developers.notion.com/reference/block) using the ID specified.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-a-block)*
    """  # noqa: E501
    return self.parent.request(
        path=f"blocks/{block_id}", method="GET", auth=kwargs.get("auth")
    )

update(block_id, **kwargs)

Update the content for the specified block_id based on the block type.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
def update(self, block_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Update the content for the specified `block_id` based on the block type.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/update-a-block)*
    """  # noqa: E501
    return self.parent.request(
        path=f"blocks/{block_id}",
        method="PATCH",
        body=pick(
            kwargs,
            "embed",
            "type",
            "archived",
            "in_trash",
            "bookmark",
            "image",
            "video",
            "pdf",
            "file",
            "audio",
            "code",
            "equation",
            "divider",
            "breadcrumb",
            "tab",
            "table_of_contents",
            "link_to_page",
            "table_row",
            "heading_1",
            "heading_2",
            "heading_3",
            "heading_4",
            "paragraph",
            "bulleted_list_item",
            "numbered_list_item",
            "quote",
            "to_do",
            "toggle",
            "template",
            "callout",
            "synced_block",
            "table",
            "column",
        ),
        auth=kwargs.get("auth"),
    )

BlocksMeetingNotesEndpoint

Bases: Endpoint

Source code in notion_client/api_endpoints.py
43
44
45
46
47
48
49
50
51
52
53
54
class BlocksMeetingNotesEndpoint(Endpoint):
    def query(self, **kwargs: Any) -> SyncAsync[Any]:
        """Query meeting notes.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/query-meeting-notes)*
        """  # noqa: E501
        return self.parent.request(
            path="blocks/meeting_notes/query",
            method="POST",
            body=pick(kwargs, "filter", "sort", "limit"),
            auth=kwargs.get("auth"),
        )

query(**kwargs)

Query meeting notes.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
44
45
46
47
48
49
50
51
52
53
54
def query(self, **kwargs: Any) -> SyncAsync[Any]:
    """Query meeting notes.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/query-meeting-notes)*
    """  # noqa: E501
    return self.parent.request(
        path="blocks/meeting_notes/query",
        method="POST",
        body=pick(kwargs, "filter", "sort", "limit"),
        auth=kwargs.get("auth"),
    )

CommentsEndpoint

Bases: Endpoint

Source code in notion_client/api_endpoints.py
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
class CommentsEndpoint(Endpoint):
    def create(self, **kwargs: Any) -> SyncAsync[Any]:
        """Create a new comment in the specified page or existing discussion thread.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/create-a-comment)*
        """  # noqa: E501
        return self.parent.request(
            path="comments",
            method="POST",
            body=pick(
                kwargs,
                "attachments",
                "display_name",
                "parent",
                "rich_text",
                "markdown",
                "discussion_id",
            ),
            auth=kwargs.get("auth"),
        )

    def list(self, **kwargs: Any) -> SyncAsync[Any]:
        """Retrieve a list of un-resolved [Comment objects](https://developers.notion.com/reference/comment-object) from the specified block.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/list-comments)*
        """  # noqa: E501
        return self.parent.request(
            path="comments",
            method="GET",
            query=pick(kwargs, "block_id", "start_cursor", "page_size"),
            auth=kwargs.get("auth"),
        )

    def retrieve(self, comment_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Retrieve a [Comment object](https://developers.notion.com/reference/comment-object) from its `comment_id`.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-comment)*
        """  # noqa: E501
        return self.parent.request(
            path=f"comments/{comment_id}",
            method="GET",
            auth=kwargs.get("auth"),
        )

    def update(self, comment_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Update a [Comment object](https://developers.notion.com/reference/comment-object) using its `comment_id`.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/update-comment)*
        """  # noqa: E501
        return self.parent.request(
            path=f"comments/{comment_id}",
            method="PATCH",
            body=pick(kwargs, "rich_text", "markdown"),
            auth=kwargs.get("auth"),
        )

    def delete(self, comment_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Delete a [Comment object](https://developers.notion.com/reference/comment-object) using its `comment_id`.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/delete-comment)*
        """  # noqa: E501
        return self.parent.request(
            path=f"comments/{comment_id}",
            method="DELETE",
            auth=kwargs.get("auth"),
        )

create(**kwargs)

Create a new comment in the specified page or existing discussion thread.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
def create(self, **kwargs: Any) -> SyncAsync[Any]:
    """Create a new comment in the specified page or existing discussion thread.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/create-a-comment)*
    """  # noqa: E501
    return self.parent.request(
        path="comments",
        method="POST",
        body=pick(
            kwargs,
            "attachments",
            "display_name",
            "parent",
            "rich_text",
            "markdown",
            "discussion_id",
        ),
        auth=kwargs.get("auth"),
    )

delete(comment_id, **kwargs)

Delete a Comment object using its comment_id.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
618
619
620
621
622
623
624
625
626
627
def delete(self, comment_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Delete a [Comment object](https://developers.notion.com/reference/comment-object) using its `comment_id`.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/delete-comment)*
    """  # noqa: E501
    return self.parent.request(
        path=f"comments/{comment_id}",
        method="DELETE",
        auth=kwargs.get("auth"),
    )

list(**kwargs)

Retrieve a list of un-resolved Comment objects from the specified block.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
583
584
585
586
587
588
589
590
591
592
593
def list(self, **kwargs: Any) -> SyncAsync[Any]:
    """Retrieve a list of un-resolved [Comment objects](https://developers.notion.com/reference/comment-object) from the specified block.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/list-comments)*
    """  # noqa: E501
    return self.parent.request(
        path="comments",
        method="GET",
        query=pick(kwargs, "block_id", "start_cursor", "page_size"),
        auth=kwargs.get("auth"),
    )

retrieve(comment_id, **kwargs)

Retrieve a Comment object from its comment_id.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
595
596
597
598
599
600
601
602
603
604
def retrieve(self, comment_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Retrieve a [Comment object](https://developers.notion.com/reference/comment-object) from its `comment_id`.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-comment)*
    """  # noqa: E501
    return self.parent.request(
        path=f"comments/{comment_id}",
        method="GET",
        auth=kwargs.get("auth"),
    )

update(comment_id, **kwargs)

Update a Comment object using its comment_id.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
606
607
608
609
610
611
612
613
614
615
616
def update(self, comment_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Update a [Comment object](https://developers.notion.com/reference/comment-object) using its `comment_id`.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/update-comment)*
    """  # noqa: E501
    return self.parent.request(
        path=f"comments/{comment_id}",
        method="PATCH",
        body=pick(kwargs, "rich_text", "markdown"),
        auth=kwargs.get("auth"),
    )

CustomEmojisEndpoint

Bases: Endpoint

Source code in notion_client/api_endpoints.py
548
549
550
551
552
553
554
555
556
557
558
559
class CustomEmojisEndpoint(Endpoint):
    def list(self, **kwargs: Any) -> SyncAsync[Any]:
        """List custom emojis.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/list-custom-emojis)*
        """  # noqa: E501
        return self.parent.request(
            path="custom_emojis",
            method="GET",
            query=pick(kwargs, "start_cursor", "page_size", "name"),
            auth=kwargs.get("auth"),
        )

list(**kwargs)

List custom emojis.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
549
550
551
552
553
554
555
556
557
558
559
def list(self, **kwargs: Any) -> SyncAsync[Any]:
    """List custom emojis.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/list-custom-emojis)*
    """  # noqa: E501
    return self.parent.request(
        path="custom_emojis",
        method="GET",
        query=pick(kwargs, "start_cursor", "page_size", "name"),
        auth=kwargs.get("auth"),
    )

DataSourcesEndpoint

Bases: Endpoint

Source code in notion_client/api_endpoints.py
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
class DataSourcesEndpoint(Endpoint):
    def retrieve(self, data_source_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Retrieve a [data source](https://developers.notion.com/reference/data-source) object for a provided data source ID.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-a-data-source)*
        """  # noqa: E501
        return self.parent.request(
            path=f"data_sources/{data_source_id}", method="GET", auth=kwargs.get("auth")
        )

    def query(self, data_source_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Get a list of [Pages](https://developers.notion.com/reference/page) and/or [Data Sources](https://developers.notion.com/reference/data-source) contained in the data source.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/query-a-data-source)*
        """  # noqa: E501
        return self.parent.request(
            path=f"data_sources/{data_source_id}/query",
            method="POST",
            query=pick(kwargs, "filter_properties"),
            body=pick(
                kwargs,
                "sorts",
                "filter",
                "start_cursor",
                "page_size",
                "archived",
                "in_trash",
                "result_type",
            ),
            auth=kwargs.get("auth"),
        )

    def create(self, **kwargs: Any) -> SyncAsync[Any]:
        """Add an additional [data source](https://developers.notion.com/reference/data-source) to an existing [database](https://developers.notion.com/reference/database).

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/create-a-data-source)*
        """  # noqa: E501
        return self.parent.request(
            path="data_sources",
            method="POST",
            body=pick(kwargs, "parent", "properties", "title", "icon"),
            auth=kwargs.get("auth"),
        )

    def update(self, data_source_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Updates the [data source](https://developers.notion.com/reference/data-source) object of a specified data source under a database.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/update-a-data-source)*
        """  # noqa: E501
        return self.parent.request(
            path=f"data_sources/{data_source_id}",
            method="PATCH",
            body=pick(
                kwargs, "title", "icon", "properties", "in_trash", "archived", "parent"
            ),
            auth=kwargs.get("auth"),
        )

    def list_templates(self, data_source_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """List page templates that are available for a data source.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/list-data-source-templates)*
        """  # noqa: E501
        return self.parent.request(
            path=f"data_sources/{data_source_id}/templates",
            method="GET",
            query=pick(kwargs, "name", "start_cursor", "page_size"),
            auth=kwargs.get("auth"),
        )

create(**kwargs)

Add an additional data source to an existing database.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
219
220
221
222
223
224
225
226
227
228
229
def create(self, **kwargs: Any) -> SyncAsync[Any]:
    """Add an additional [data source](https://developers.notion.com/reference/data-source) to an existing [database](https://developers.notion.com/reference/database).

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/create-a-data-source)*
    """  # noqa: E501
    return self.parent.request(
        path="data_sources",
        method="POST",
        body=pick(kwargs, "parent", "properties", "title", "icon"),
        auth=kwargs.get("auth"),
    )

list_templates(data_source_id, **kwargs)

List page templates that are available for a data source.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
245
246
247
248
249
250
251
252
253
254
255
def list_templates(self, data_source_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """List page templates that are available for a data source.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/list-data-source-templates)*
    """  # noqa: E501
    return self.parent.request(
        path=f"data_sources/{data_source_id}/templates",
        method="GET",
        query=pick(kwargs, "name", "start_cursor", "page_size"),
        auth=kwargs.get("auth"),
    )

query(data_source_id, **kwargs)

Get a list of Pages and/or Data Sources contained in the data source.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
def query(self, data_source_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Get a list of [Pages](https://developers.notion.com/reference/page) and/or [Data Sources](https://developers.notion.com/reference/data-source) contained in the data source.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/query-a-data-source)*
    """  # noqa: E501
    return self.parent.request(
        path=f"data_sources/{data_source_id}/query",
        method="POST",
        query=pick(kwargs, "filter_properties"),
        body=pick(
            kwargs,
            "sorts",
            "filter",
            "start_cursor",
            "page_size",
            "archived",
            "in_trash",
            "result_type",
        ),
        auth=kwargs.get("auth"),
    )

retrieve(data_source_id, **kwargs)

Retrieve a data source object for a provided data source ID.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
188
189
190
191
192
193
194
195
def retrieve(self, data_source_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Retrieve a [data source](https://developers.notion.com/reference/data-source) object for a provided data source ID.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-a-data-source)*
    """  # noqa: E501
    return self.parent.request(
        path=f"data_sources/{data_source_id}", method="GET", auth=kwargs.get("auth")
    )

update(data_source_id, **kwargs)

Updates the data source object of a specified data source under a database.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
231
232
233
234
235
236
237
238
239
240
241
242
243
def update(self, data_source_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Updates the [data source](https://developers.notion.com/reference/data-source) object of a specified data source under a database.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/update-a-data-source)*
    """  # noqa: E501
    return self.parent.request(
        path=f"data_sources/{data_source_id}",
        method="PATCH",
        body=pick(
            kwargs, "title", "icon", "properties", "in_trash", "archived", "parent"
        ),
        auth=kwargs.get("auth"),
    )

DatabasesEndpoint

Bases: Endpoint

Source code in notion_client/api_endpoints.py
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
class DatabasesEndpoint(Endpoint):
    def retrieve(self, database_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Retrieves a [database object](https://developers.notion.com/reference/database) for a provided database ID.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/database-retrieve)*
        """  # noqa: E501
        return self.parent.request(
            path=f"databases/{database_id}",
            method="GET",
            auth=kwargs.get("auth"),
        )

    def update(self, database_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Update the title or properties of an existing database.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/update-a-database)*
        """  # noqa: E501
        return self.parent.request(
            path=f"databases/{database_id}",
            method="PATCH",
            body=pick(
                kwargs,
                "parent",
                "title",
                "description",
                "is_inline",
                "icon",
                "cover",
                "in_trash",
                "is_locked",
            ),
            auth=kwargs.get("auth"),
        )

    def create(self, **kwargs: Any) -> SyncAsync[Any]:
        """Create a new database.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/create-a-database)*
        """  # noqa: E501
        return self.parent.request(
            path="databases",
            method="POST",
            body=pick(
                kwargs,
                "parent",
                "title",
                "description",
                "is_inline",
                "initial_data_source",
                "icon",
                "cover",
            ),
            auth=kwargs.get("auth"),
        )

create(**kwargs)

Create a new database.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
def create(self, **kwargs: Any) -> SyncAsync[Any]:
    """Create a new database.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/create-a-database)*
    """  # noqa: E501
    return self.parent.request(
        path="databases",
        method="POST",
        body=pick(
            kwargs,
            "parent",
            "title",
            "description",
            "is_inline",
            "initial_data_source",
            "icon",
            "cover",
        ),
        auth=kwargs.get("auth"),
    )

retrieve(database_id, **kwargs)

Retrieves a database object for a provided database ID.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
132
133
134
135
136
137
138
139
140
141
def retrieve(self, database_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Retrieves a [database object](https://developers.notion.com/reference/database) for a provided database ID.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/database-retrieve)*
    """  # noqa: E501
    return self.parent.request(
        path=f"databases/{database_id}",
        method="GET",
        auth=kwargs.get("auth"),
    )

update(database_id, **kwargs)

Update the title or properties of an existing database.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
def update(self, database_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Update the title or properties of an existing database.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/update-a-database)*
    """  # noqa: E501
    return self.parent.request(
        path=f"databases/{database_id}",
        method="PATCH",
        body=pick(
            kwargs,
            "parent",
            "title",
            "description",
            "is_inline",
            "icon",
            "cover",
            "in_trash",
            "is_locked",
        ),
        auth=kwargs.get("auth"),
    )

FileUploadsEndpoint

Bases: Endpoint

Source code in notion_client/api_endpoints.py
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
class FileUploadsEndpoint(Endpoint):
    def create(self, **kwargs: Any) -> SyncAsync[Any]:
        """Create a file upload.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/create-a-file-upload)*
        """  # noqa: E501
        return self.parent.request(
            path="file_uploads",
            method="POST",
            body=pick(
                kwargs,
                "mode",
                "filename",
                "content_type",
                "number_of_parts",
                "external_url",
            ),
            auth=kwargs.get("auth"),
        )

    def complete(self, file_upload_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Complete the file upload process.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/complete-a-file-upload)*
        """  # noqa: E501
        return self.parent.request(
            path=f"file_uploads/{file_upload_id}/complete",
            method="POST",
            auth=kwargs.get("auth"),
        )

    def retrieve(self, file_upload_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Retrieve a file upload object using the ID specified.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-a-file-upload)*
        """  # noqa: E501
        return self.parent.request(
            path=f"file_uploads/{file_upload_id}",
            method="GET",
            auth=kwargs.get("auth"),
        )

    def list(self, **kwargs: Any) -> SyncAsync[Any]:
        """List all file uploads.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/list-file-uploads)*
        """  # noqa: E501
        return self.parent.request(
            path="file_uploads",
            method="GET",
            query=pick(kwargs, "status", "start_cursor", "page_size"),
            auth=kwargs.get("auth"),
        )

    def send(self, file_upload_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Send a file upload

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/send-a-file-upload)*
        """  # noqa: E501
        return self.parent.request(
            path=f"file_uploads/{file_upload_id}/send",
            method="POST",
            form_data=pick(kwargs, "file", "part_number"),
            auth=kwargs.get("auth"),
        )

complete(file_upload_id, **kwargs)

Complete the file upload process.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
650
651
652
653
654
655
656
657
658
659
def complete(self, file_upload_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Complete the file upload process.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/complete-a-file-upload)*
    """  # noqa: E501
    return self.parent.request(
        path=f"file_uploads/{file_upload_id}/complete",
        method="POST",
        auth=kwargs.get("auth"),
    )

create(**kwargs)

Create a file upload.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
def create(self, **kwargs: Any) -> SyncAsync[Any]:
    """Create a file upload.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/create-a-file-upload)*
    """  # noqa: E501
    return self.parent.request(
        path="file_uploads",
        method="POST",
        body=pick(
            kwargs,
            "mode",
            "filename",
            "content_type",
            "number_of_parts",
            "external_url",
        ),
        auth=kwargs.get("auth"),
    )

list(**kwargs)

List all file uploads.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
672
673
674
675
676
677
678
679
680
681
682
def list(self, **kwargs: Any) -> SyncAsync[Any]:
    """List all file uploads.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/list-file-uploads)*
    """  # noqa: E501
    return self.parent.request(
        path="file_uploads",
        method="GET",
        query=pick(kwargs, "status", "start_cursor", "page_size"),
        auth=kwargs.get("auth"),
    )

retrieve(file_upload_id, **kwargs)

Retrieve a file upload object using the ID specified.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
661
662
663
664
665
666
667
668
669
670
def retrieve(self, file_upload_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Retrieve a file upload object using the ID specified.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-a-file-upload)*
    """  # noqa: E501
    return self.parent.request(
        path=f"file_uploads/{file_upload_id}",
        method="GET",
        auth=kwargs.get("auth"),
    )

send(file_upload_id, **kwargs)

Send a file upload

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
684
685
686
687
688
689
690
691
692
693
694
def send(self, file_upload_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Send a file upload

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/send-a-file-upload)*
    """  # noqa: E501
    return self.parent.request(
        path=f"file_uploads/{file_upload_id}/send",
        method="POST",
        form_data=pick(kwargs, "file", "part_number"),
        auth=kwargs.get("auth"),
    )

OAuthEndpoint

Bases: Endpoint

Source code in notion_client/api_endpoints.py
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
class OAuthEndpoint(Endpoint):
    def token(
        self, client_id: str, client_secret: str, **kwargs: Any
    ) -> SyncAsync[Any]:
        """Create an access token that a third-party service can use to authenticate with Notion.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/create-a-token)*
        """  # noqa: E501
        return self.parent.request(
            path="oauth/token",
            method="POST",
            body=pick(
                kwargs,
                "grant_type",
                "code",
                "redirect_uri",
                "external_account",
                "refresh_token",
            ),
            auth={"client_id": client_id, "client_secret": client_secret},
        )

    def introspect(
        self, client_id: str, client_secret: str, **kwargs: Any
    ) -> SyncAsync[Any]:
        """Get a token's active status, scope, and issued time.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/introspect-token)*
        """  # noqa: E501
        return self.parent.request(
            path="oauth/introspect",
            method="POST",
            body=pick(kwargs, "token"),
            auth={"client_id": client_id, "client_secret": client_secret},
        )

    def revoke(
        self, client_id: str, client_secret: str, **kwargs: Any
    ) -> SyncAsync[Any]:
        """Revoke an access token.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/revoke-token)*
        """  # noqa: E501
        return self.parent.request(
            path="oauth/revoke",
            method="POST",
            body=pick(kwargs, "token"),
            auth={"client_id": client_id, "client_secret": client_secret},
        )

introspect(client_id, client_secret, **kwargs)

Get a token's active status, scope, and issued time.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
719
720
721
722
723
724
725
726
727
728
729
730
731
def introspect(
    self, client_id: str, client_secret: str, **kwargs: Any
) -> SyncAsync[Any]:
    """Get a token's active status, scope, and issued time.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/introspect-token)*
    """  # noqa: E501
    return self.parent.request(
        path="oauth/introspect",
        method="POST",
        body=pick(kwargs, "token"),
        auth={"client_id": client_id, "client_secret": client_secret},
    )

revoke(client_id, client_secret, **kwargs)

Revoke an access token.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
733
734
735
736
737
738
739
740
741
742
743
744
745
def revoke(
    self, client_id: str, client_secret: str, **kwargs: Any
) -> SyncAsync[Any]:
    """Revoke an access token.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/revoke-token)*
    """  # noqa: E501
    return self.parent.request(
        path="oauth/revoke",
        method="POST",
        body=pick(kwargs, "token"),
        auth={"client_id": client_id, "client_secret": client_secret},
    )

token(client_id, client_secret, **kwargs)

Create an access token that a third-party service can use to authenticate with Notion.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
def token(
    self, client_id: str, client_secret: str, **kwargs: Any
) -> SyncAsync[Any]:
    """Create an access token that a third-party service can use to authenticate with Notion.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/create-a-token)*
    """  # noqa: E501
    return self.parent.request(
        path="oauth/token",
        method="POST",
        body=pick(
            kwargs,
            "grant_type",
            "code",
            "redirect_uri",
            "external_account",
            "refresh_token",
        ),
        auth={"client_id": client_id, "client_secret": client_secret},
    )

PagesEndpoint

Bases: Endpoint

Source code in notion_client/api_endpoints.py
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
class PagesEndpoint(Endpoint):
    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.properties = PagesPropertiesEndpoint(*args, **kwargs)

    def create(self, **kwargs: Any) -> SyncAsync[Any]:
        """Create a new page in the specified database or as a child of an existing page.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/post-page)*
        """  # noqa: E501
        return self.parent.request(
            path="pages",
            method="POST",
            body=pick(
                kwargs,
                "parent",
                "properties",
                "icon",
                "cover",
                "content",
                "children",
                "markdown",
                "template",
                "position",
            ),
            auth=kwargs.get("auth"),
        )

    def retrieve(self, page_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Retrieve a [Page object](https://developers.notion.com/reference/page) using the ID specified.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-a-page)*
        """  # noqa: E501
        return self.parent.request(
            path=f"pages/{page_id}",
            method="GET",
            query=pick(kwargs, "filter_properties"),
            auth=kwargs.get("auth"),
        )

    def update(self, page_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Update [page property values](https://developers.notion.com/reference/page#property-value-object) for the specified page.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/patch-page)*
        """  # noqa: E501
        return self.parent.request(
            path=f"pages/{page_id}",
            method="PATCH",
            body=pick(
                kwargs,
                "properties",
                "icon",
                "cover",
                "is_locked",
                "template",
                "erase_content",
                "archived",
                "in_trash",
            ),
            auth=kwargs.get("auth"),
        )

    def retrieve_markdown(self, page_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Retrieve a page as markdown.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-page-markdown)*
        """  # noqa: E501
        return self.parent.request(
            path=f"pages/{page_id}/markdown",
            method="GET",
            query=pick(kwargs, "include_transcript"),
            auth=kwargs.get("auth"),
        )

    def update_markdown(self, page_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Update a page's content as markdown.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/update-page-markdown)*
        """  # noqa: E501
        return self.parent.request(
            path=f"pages/{page_id}/markdown",
            method="PATCH",
            body=pick(
                kwargs,
                "type",
                "insert_content",
                "replace_content_range",
                "update_content",
                "replace_content",
            ),
            auth=kwargs.get("auth"),
        )

    def move(self, page_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Use this API to move an existing Notion page to a new parent.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/move-page)*
        """  # noqa: E501
        return self.parent.request(
            path=f"pages/{page_id}/move",
            method="POST",
            body=pick(kwargs, "parent"),
            auth=kwargs.get("auth"),
        )

create(**kwargs)

Create a new page in the specified database or as a child of an existing page.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
def create(self, **kwargs: Any) -> SyncAsync[Any]:
    """Create a new page in the specified database or as a child of an existing page.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/post-page)*
    """  # noqa: E501
    return self.parent.request(
        path="pages",
        method="POST",
        body=pick(
            kwargs,
            "parent",
            "properties",
            "icon",
            "cover",
            "content",
            "children",
            "markdown",
            "template",
            "position",
        ),
        auth=kwargs.get("auth"),
    )

move(page_id, **kwargs)

Use this API to move an existing Notion page to a new parent.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
365
366
367
368
369
370
371
372
373
374
375
def move(self, page_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Use this API to move an existing Notion page to a new parent.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/move-page)*
    """  # noqa: E501
    return self.parent.request(
        path=f"pages/{page_id}/move",
        method="POST",
        body=pick(kwargs, "parent"),
        auth=kwargs.get("auth"),
    )

retrieve(page_id, **kwargs)

Retrieve a Page object using the ID specified.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
300
301
302
303
304
305
306
307
308
309
310
def retrieve(self, page_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Retrieve a [Page object](https://developers.notion.com/reference/page) using the ID specified.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-a-page)*
    """  # noqa: E501
    return self.parent.request(
        path=f"pages/{page_id}",
        method="GET",
        query=pick(kwargs, "filter_properties"),
        auth=kwargs.get("auth"),
    )

retrieve_markdown(page_id, **kwargs)

Retrieve a page as markdown.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
334
335
336
337
338
339
340
341
342
343
344
def retrieve_markdown(self, page_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Retrieve a page as markdown.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-page-markdown)*
    """  # noqa: E501
    return self.parent.request(
        path=f"pages/{page_id}/markdown",
        method="GET",
        query=pick(kwargs, "include_transcript"),
        auth=kwargs.get("auth"),
    )

update(page_id, **kwargs)

Update page property values for the specified page.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
def update(self, page_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Update [page property values](https://developers.notion.com/reference/page#property-value-object) for the specified page.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/patch-page)*
    """  # noqa: E501
    return self.parent.request(
        path=f"pages/{page_id}",
        method="PATCH",
        body=pick(
            kwargs,
            "properties",
            "icon",
            "cover",
            "is_locked",
            "template",
            "erase_content",
            "archived",
            "in_trash",
        ),
        auth=kwargs.get("auth"),
    )

update_markdown(page_id, **kwargs)

Update a page's content as markdown.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
def update_markdown(self, page_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Update a page's content as markdown.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/update-page-markdown)*
    """  # noqa: E501
    return self.parent.request(
        path=f"pages/{page_id}/markdown",
        method="PATCH",
        body=pick(
            kwargs,
            "type",
            "insert_content",
            "replace_content_range",
            "update_content",
            "replace_content",
        ),
        auth=kwargs.get("auth"),
    )

PagesPropertiesEndpoint

Bases: Endpoint

Source code in notion_client/api_endpoints.py
258
259
260
261
262
263
264
265
266
267
268
269
class PagesPropertiesEndpoint(Endpoint):
    def retrieve(self, page_id: str, property_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Retrieve a `property_item` object for a given `page_id` and `property_id`.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-a-page-property)*
        """  # noqa: E501
        return self.parent.request(
            path=f"pages/{page_id}/properties/{property_id}",
            method="GET",
            auth=kwargs.get("auth"),
            query=pick(kwargs, "start_cursor", "page_size"),
        )

retrieve(page_id, property_id, **kwargs)

Retrieve a property_item object for a given page_id and property_id.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
259
260
261
262
263
264
265
266
267
268
269
def retrieve(self, page_id: str, property_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Retrieve a `property_item` object for a given `page_id` and `property_id`.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-a-page-property)*
    """  # noqa: E501
    return self.parent.request(
        path=f"pages/{page_id}/properties/{property_id}",
        method="GET",
        auth=kwargs.get("auth"),
        query=pick(kwargs, "start_cursor", "page_size"),
    )

SearchEndpoint

Bases: Endpoint

Source code in notion_client/api_endpoints.py
534
535
536
537
538
539
540
541
542
543
544
545
class SearchEndpoint(Endpoint):
    def __call__(self, **kwargs: Any) -> SyncAsync[Any]:
        """Search all pages and child pages that are shared with the integration.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/post-search)*
        """  # noqa: E501
        return self.parent.request(
            path="search",
            method="POST",
            body=pick(kwargs, "query", "sort", "filter", "start_cursor", "page_size"),
            auth=kwargs.get("auth"),
        )

__call__(**kwargs)

Search all pages and child pages that are shared with the integration.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
535
536
537
538
539
540
541
542
543
544
545
def __call__(self, **kwargs: Any) -> SyncAsync[Any]:
    """Search all pages and child pages that are shared with the integration.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/post-search)*
    """  # noqa: E501
    return self.parent.request(
        path="search",
        method="POST",
        body=pick(kwargs, "query", "sort", "filter", "start_cursor", "page_size"),
        auth=kwargs.get("auth"),
    )

UsersEndpoint

Bases: Endpoint

Source code in notion_client/api_endpoints.py
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
class UsersEndpoint(Endpoint):
    def list(self, **kwargs: Any) -> SyncAsync[Any]:
        """Return a paginated list of [Users](https://developers.notion.com/reference/user) for the workspace.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/get-users)*
        """  # noqa: E501
        return self.parent.request(
            path="users",
            method="GET",
            query=pick(kwargs, "start_cursor", "page_size"),
            auth=kwargs.get("auth"),
        )

    def retrieve(self, user_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Retrieve a [User](https://developers.notion.com/reference/user) using the ID specified.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/get-user)*
        """  # noqa: E501
        return self.parent.request(
            path=f"users/{user_id}", method="GET", auth=kwargs.get("auth")
        )

    def me(self, **kwargs: Any) -> SyncAsync[Any]:
        """Retrieve the bot [User](https://developers.notion.com/reference/user) associated with the API token.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/get-self)*
        """  # noqa: E501
        return self.parent.request(
            path="users/me", method="GET", auth=kwargs.get("auth")
        )

list(**kwargs)

Return a paginated list of Users for the workspace.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
379
380
381
382
383
384
385
386
387
388
389
def list(self, **kwargs: Any) -> SyncAsync[Any]:
    """Return a paginated list of [Users](https://developers.notion.com/reference/user) for the workspace.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/get-users)*
    """  # noqa: E501
    return self.parent.request(
        path="users",
        method="GET",
        query=pick(kwargs, "start_cursor", "page_size"),
        auth=kwargs.get("auth"),
    )

me(**kwargs)

Retrieve the bot User associated with the API token.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
400
401
402
403
404
405
406
407
def me(self, **kwargs: Any) -> SyncAsync[Any]:
    """Retrieve the bot [User](https://developers.notion.com/reference/user) associated with the API token.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/get-self)*
    """  # noqa: E501
    return self.parent.request(
        path="users/me", method="GET", auth=kwargs.get("auth")
    )

retrieve(user_id, **kwargs)

Retrieve a User using the ID specified.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
391
392
393
394
395
396
397
398
def retrieve(self, user_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Retrieve a [User](https://developers.notion.com/reference/user) using the ID specified.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/get-user)*
    """  # noqa: E501
    return self.parent.request(
        path=f"users/{user_id}", method="GET", auth=kwargs.get("auth")
    )

ViewsEndpoint

Bases: Endpoint

Source code in notion_client/api_endpoints.py
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
class ViewsEndpoint(Endpoint):
    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.queries = ViewsQueriesEndpoint(*args, **kwargs)

    def create(self, **kwargs: Any) -> SyncAsync[Any]:
        """Create a view.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/create-view)*
        """  # noqa: E501
        return self.parent.request(
            path="views",
            method="POST",
            body=pick(
                kwargs,
                "data_source_id",
                "name",
                "type",
                "database_id",
                "view_id",
                "filter",
                "sorts",
                "quick_filters",
                "create_database",
                "configuration",
                "position",
                "placement",
            ),
            auth=kwargs.get("auth"),
        )

    def retrieve(self, view_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Retrieve a view.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-a-view)*
        """  # noqa: E501
        return self.parent.request(
            path=f"views/{view_id}",
            method="GET",
            auth=kwargs.get("auth"),
        )

    def update(self, view_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Update a view.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/update-a-view)*
        """  # noqa: E501
        return self.parent.request(
            path=f"views/{view_id}",
            method="PATCH",
            body=pick(
                kwargs,
                "name",
                "filter",
                "sorts",
                "quick_filters",
                "configuration",
            ),
            auth=kwargs.get("auth"),
        )

    def delete(self, view_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Delete a view.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/delete-view)*
        """  # noqa: E501
        return self.parent.request(
            path=f"views/{view_id}",
            method="DELETE",
            auth=kwargs.get("auth"),
        )

    def list(self, **kwargs: Any) -> SyncAsync[Any]:
        """List views for a database.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/list-views)*
        """  # noqa: E501
        return self.parent.request(
            path="views",
            method="GET",
            query=pick(
                kwargs, "database_id", "data_source_id", "start_cursor", "page_size"
            ),
            auth=kwargs.get("auth"),
        )

create(**kwargs)

Create a view.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
def create(self, **kwargs: Any) -> SyncAsync[Any]:
    """Create a view.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/create-view)*
    """  # noqa: E501
    return self.parent.request(
        path="views",
        method="POST",
        body=pick(
            kwargs,
            "data_source_id",
            "name",
            "type",
            "database_id",
            "view_id",
            "filter",
            "sorts",
            "quick_filters",
            "create_database",
            "configuration",
            "position",
            "placement",
        ),
        auth=kwargs.get("auth"),
    )

delete(view_id, **kwargs)

Delete a view.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
508
509
510
511
512
513
514
515
516
517
def delete(self, view_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Delete a view.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/delete-view)*
    """  # noqa: E501
    return self.parent.request(
        path=f"views/{view_id}",
        method="DELETE",
        auth=kwargs.get("auth"),
    )

list(**kwargs)

List views for a database.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
519
520
521
522
523
524
525
526
527
528
529
530
531
def list(self, **kwargs: Any) -> SyncAsync[Any]:
    """List views for a database.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/list-views)*
    """  # noqa: E501
    return self.parent.request(
        path="views",
        method="GET",
        query=pick(
            kwargs, "database_id", "data_source_id", "start_cursor", "page_size"
        ),
        auth=kwargs.get("auth"),
    )

retrieve(view_id, **kwargs)

Retrieve a view.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
478
479
480
481
482
483
484
485
486
487
def retrieve(self, view_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Retrieve a view.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-a-view)*
    """  # noqa: E501
    return self.parent.request(
        path=f"views/{view_id}",
        method="GET",
        auth=kwargs.get("auth"),
    )

update(view_id, **kwargs)

Update a view.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
def update(self, view_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Update a view.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/update-a-view)*
    """  # noqa: E501
    return self.parent.request(
        path=f"views/{view_id}",
        method="PATCH",
        body=pick(
            kwargs,
            "name",
            "filter",
            "sorts",
            "quick_filters",
            "configuration",
        ),
        auth=kwargs.get("auth"),
    )

ViewsQueriesEndpoint

Bases: Endpoint

Source code in notion_client/api_endpoints.py
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
class ViewsQueriesEndpoint(Endpoint):
    def create(self, view_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Create a view query.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/create-view-query)*
        """  # noqa: E501
        return self.parent.request(
            path=f"views/{view_id}/queries",
            method="POST",
            body=pick(kwargs, "page_size"),
            auth=kwargs.get("auth"),
        )

    def results(self, view_id: str, query_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Get view query results.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/get-view-query-results)*
        """  # noqa: E501
        return self.parent.request(
            path=f"views/{view_id}/queries/{query_id}",
            method="GET",
            query=pick(kwargs, "start_cursor", "page_size"),
            auth=kwargs.get("auth"),
        )

    def delete(self, view_id: str, query_id: str, **kwargs: Any) -> SyncAsync[Any]:
        """Delete a view query.

        *[🔗 Endpoint documentation](https://developers.notion.com/reference/delete-view-query)*
        """  # noqa: E501
        return self.parent.request(
            path=f"views/{view_id}/queries/{query_id}",
            method="DELETE",
            auth=kwargs.get("auth"),
        )

create(view_id, **kwargs)

Create a view query.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
411
412
413
414
415
416
417
418
419
420
421
def create(self, view_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Create a view query.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/create-view-query)*
    """  # noqa: E501
    return self.parent.request(
        path=f"views/{view_id}/queries",
        method="POST",
        body=pick(kwargs, "page_size"),
        auth=kwargs.get("auth"),
    )

delete(view_id, query_id, **kwargs)

Delete a view query.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
435
436
437
438
439
440
441
442
443
444
def delete(self, view_id: str, query_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Delete a view query.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/delete-view-query)*
    """  # noqa: E501
    return self.parent.request(
        path=f"views/{view_id}/queries/{query_id}",
        method="DELETE",
        auth=kwargs.get("auth"),
    )

results(view_id, query_id, **kwargs)

Get view query results.

🔗 Endpoint documentation

Source code in notion_client/api_endpoints.py
423
424
425
426
427
428
429
430
431
432
433
def results(self, view_id: str, query_id: str, **kwargs: Any) -> SyncAsync[Any]:
    """Get view query results.

    *[🔗 Endpoint documentation](https://developers.notion.com/reference/get-view-query-results)*
    """  # noqa: E501
    return self.parent.request(
        path=f"views/{view_id}/queries/{query_id}",
        method="GET",
        query=pick(kwargs, "start_cursor", "page_size"),
        auth=kwargs.get("auth"),
    )