Skip to content

Blocks

blocks

Wrapper for Notion API blocks.

Blocks are the base for all Notion content.

Block

A standard block object in Notion.

Calling the block will expose the nested data in the object.

Bookmark

A bookmark block in Notion.

bookmark: TypeData = TypeData() class-attribute instance-attribute

TypeData

caption: list[SerializeAsAny[RichTextBaseObject]] | None = None class-attribute instance-attribute
url: str = None class-attribute instance-attribute

Breadcrumb

A breadcrumb block in Notion.

breadcrumb: TypeData = TypeData() class-attribute instance-attribute

TypeData

BulletedListItem

A bulleted list item in Notion.

bulleted_list_item: TypeData = TypeData() class-attribute instance-attribute

TypeData

children: list[SerializeAsAny[Block]] = Field(default_factory=list) class-attribute instance-attribute
color: Color | BGColor = Color.DEFAULT class-attribute instance-attribute
rich_text: list[SerializeAsAny[RichTextBaseObject]] = None class-attribute instance-attribute

Callout

A callout block in Notion.

callout: TypeData = TypeData() class-attribute instance-attribute

TypeData

children: list[SerializeAsAny[Block]] = Field(default_factory=list) class-attribute instance-attribute
color: Color | BGColor = BGColor.GRAY class-attribute instance-attribute
icon: SerializeAsAny[FileObject] | EmojiObject = None class-attribute instance-attribute
rich_text: list[SerializeAsAny[RichTextBaseObject]] = None class-attribute instance-attribute

ChildDatabase

A child database block in Notion.

child_database: TypeData = TypeData() class-attribute instance-attribute

TypeData

title: str = None class-attribute instance-attribute

ChildPage

A child page block in Notion.

child_page: TypeData = TypeData() class-attribute instance-attribute

TypeData

title: str = None class-attribute instance-attribute

Code

A code block in Notion.

code: TypeData = TypeData() class-attribute instance-attribute

TypeData

caption: list[SerializeAsAny[RichTextBaseObject]] = None class-attribute instance-attribute
language: CodeLang = CodeLang.PLAIN_TEXT class-attribute instance-attribute
rich_text: list[SerializeAsAny[RichTextBaseObject]] = None class-attribute instance-attribute

Column

A column block in Notion.

column: TypeData = TypeData() class-attribute instance-attribute

TypeData

children: list[SerializeAsAny[Block]] = Field(default_factory=list) class-attribute instance-attribute

build() -> Column classmethod

ColumnList

A column list block in Notion.

column_list: TypeData = TypeData() class-attribute instance-attribute

TypeData

children: list[Column] = Field(default_factory=list) class-attribute instance-attribute

DataObject

The base type for all Notion API records.

archived: bool = False class-attribute instance-attribute

created_by: UserRef = None class-attribute instance-attribute

created_time: datetime = None class-attribute instance-attribute

has_children: bool = False class-attribute instance-attribute

id: UUID = None class-attribute instance-attribute

in_trash: bool = False class-attribute instance-attribute

last_edited_by: UserRef = None class-attribute instance-attribute

last_edited_time: datetime = None class-attribute instance-attribute

parent: SerializeAsAny[ParentRef] = None class-attribute instance-attribute

Database

A database record type.

cover: SerializeAsAny[FileObject] | None = None class-attribute instance-attribute

description: list[SerializeAsAny[RichTextBaseObject]] = None class-attribute instance-attribute

icon: SerializeAsAny[FileObject] | EmojiObject | None = None class-attribute instance-attribute

is_inline: bool = False class-attribute instance-attribute

properties: dict[str, PropertyType] = None class-attribute instance-attribute

public_url: str | None = None class-attribute instance-attribute

title: list[SerializeAsAny[RichTextBaseObject]] = None class-attribute instance-attribute

url: str = None class-attribute instance-attribute

build_mention(style: Annotations | None = None) -> MentionObject

Divider

A divider block in Notion.

divider: TypeData = TypeData() class-attribute instance-attribute

TypeData

Embed

An embed block in Notion.

embed: TypeData = TypeData() class-attribute instance-attribute

TypeData

caption: list[SerializeAsAny[RichTextBaseObject]] | None = None class-attribute instance-attribute
url: str = None class-attribute instance-attribute

Equation

An equation block in Notion.

equation: TypeData = TypeData() class-attribute instance-attribute

TypeData

expression: str | None = None class-attribute instance-attribute

File

A file block in Notion.

file: SerializeAsAny[FileObject] = None class-attribute instance-attribute

FileBase

A abstract block referencing a FileObject.

Heading

Abstract Heading block.

TypeData

color: Color | BGColor = Color.DEFAULT class-attribute instance-attribute
is_toggleable: bool = False class-attribute instance-attribute
rich_text: list[SerializeAsAny[RichTextBaseObject]] = None class-attribute instance-attribute

Heading1

A heading_1 block in Notion.

heading_1: Heading.TypeData = Heading.TypeData() class-attribute instance-attribute

Heading2

A heading_2 block in Notion.

heading_2: Heading.TypeData = Heading.TypeData() class-attribute instance-attribute

Heading3

A heading_3 block in Notion.

heading_3: Heading.TypeData = Heading.TypeData() class-attribute instance-attribute

Image

An image block in Notion.

image: SerializeAsAny[FileObject] = None class-attribute instance-attribute

LinkPreview

A link_preview block in Notion.

TypeData

url: str = None class-attribute instance-attribute

LinkToPage

A link_to_page block in Notion.

NumberedListItem

A numbered list item in Notion.

numbered_list_item: TypeData = TypeData() class-attribute instance-attribute

TypeData

children: list[SerializeAsAny[Block]] = Field(default_factory=list) class-attribute instance-attribute
color: Color | BGColor = Color.DEFAULT class-attribute instance-attribute
rich_text: list[SerializeAsAny[RichTextBaseObject]] = None class-attribute instance-attribute

PDF

A pdf block in Notion.

pdf: SerializeAsAny[FileObject] = None class-attribute instance-attribute

Page

A standard Notion page object.

cover: SerializeAsAny[FileObject] | None = None class-attribute instance-attribute

icon: SerializeAsAny[FileObject] | EmojiObject | None = None class-attribute instance-attribute

properties: dict[str, PropertyValue] = None class-attribute instance-attribute

public_url: str | None = None class-attribute instance-attribute

title: list[RichTextBaseObject] property

Retrieve the title of the page from page properties.

url: str = None class-attribute instance-attribute

build_mention(style: Annotations | None = None) -> MentionObject

Paragraph

A paragraph block in Notion.

paragraph: TypeData = TypeData() class-attribute instance-attribute

TypeData

children: list[SerializeAsAny[Block]] = Field(default_factory=list) class-attribute instance-attribute
color: Color | BGColor = Color.DEFAULT class-attribute instance-attribute
rich_text: list[SerializeAsAny[RichTextBaseObject]] = None class-attribute instance-attribute

Quote

A quote block in Notion.

quote: TypeData = TypeData() class-attribute instance-attribute

TypeData

children: list[SerializeAsAny[Block]] = Field(default_factory=list) class-attribute instance-attribute
color: Color | Color = Color.DEFAULT class-attribute instance-attribute
rich_text: list[SerializeAsAny[RichTextBaseObject]] = None class-attribute instance-attribute

SyncedBlock

A synced_block block in Notion - either original or synced.

synced_block: TypeData = TypeData() class-attribute instance-attribute

TypeData

children: list[SerializeAsAny[Block]] = Field(default_factory=list) class-attribute instance-attribute
synced_from: BlockRef | None = None class-attribute instance-attribute

serialize_for_api() -> dict[str, Any]

Serialize the object for sending it to the Notion API.

Table

A table block in Notion.

table: TypeData = TypeData() class-attribute instance-attribute

TypeData

children: list[TableRow] = Field(default_factory=list) class-attribute instance-attribute
has_column_header: bool = False class-attribute instance-attribute
has_row_header: bool = False class-attribute instance-attribute
table_width: int = 0 class-attribute instance-attribute

TableOfContents

A table_of_contents block in Notion.

table_of_contents: TypeData = TypeData() class-attribute instance-attribute

TypeData

color: Color | BGColor = Color.DEFAULT class-attribute instance-attribute

TableRow

A table_row block in Notion.

table_row: TypeData = TypeData() class-attribute instance-attribute

TypeData

cells: list[list[SerializeAsAny[RichTextBaseObject]]] = Field(default_factory=list) class-attribute instance-attribute

build(n_cells: int) -> TableRow classmethod

Template

A template block in Notion.

template: TypeData = TypeData() class-attribute instance-attribute

TypeData

children: list[SerializeAsAny[Block]] = Field(default_factory=list) class-attribute instance-attribute
rich_text: list[SerializeAsAny[RichTextBaseObject]] | None = None class-attribute instance-attribute

TextBlock

A standard abstract text block object in Notion.

ToDo

A todo list item in Notion.

to_do: TypeData = TypeData() class-attribute instance-attribute

TypeData

checked: bool = False class-attribute instance-attribute
children: list[SerializeAsAny[Block]] = Field(default_factory=list) class-attribute instance-attribute
color: Color | BGColor = Color.DEFAULT class-attribute instance-attribute
rich_text: list[SerializeAsAny[RichTextBaseObject]] = None class-attribute instance-attribute

Toggle

A toggle list item in Notion.

toggle: TypeData = TypeData() class-attribute instance-attribute

TypeData

children: list[SerializeAsAny[Block]] = Field(default_factory=list) class-attribute instance-attribute
color: Color | BGColor = Color.DEFAULT class-attribute instance-attribute
rich_text: list[SerializeAsAny[RichTextBaseObject]] = None class-attribute instance-attribute

UnsupportedBlock

A placeholder for unsupported blocks in the API.

unsupported: TypeData | None = None class-attribute instance-attribute

TypeData

Video

A video block in Notion.

video: SerializeAsAny[FileObject] = None class-attribute instance-attribute