@notionhq/client
Version:
A simple and easy to use client for the Notion API
1,739 lines • 113 kB
TypeScript
type AnnotationRequest = {
bold?: boolean;
italic?: boolean;
strikethrough?: boolean;
underline?: boolean;
code?: boolean;
color?: ApiColor;
};
type AnnotationResponse = {
bold: boolean;
italic: boolean;
strikethrough: boolean;
underline: boolean;
code: boolean;
color: ApiColor;
};
/**
* One of: `default`, `gray`, `brown`, `orange`, `yellow`, `green`, `blue`, `purple`,
* `pink`, `red`, `default_background`, `gray_background`, `brown_background`,
* `orange_background`, `yellow_background`, `green_background`, `blue_background`,
* `purple_background`, `pink_background`, `red_background`
*/
type ApiColor = "default" | "gray" | "brown" | "orange" | "yellow" | "green" | "blue" | "purple" | "pink" | "red" | "default_background" | "gray_background" | "brown_background" | "orange_background" | "yellow_background" | "green_background" | "blue_background" | "purple_background" | "pink_background" | "red_background";
type ArrayBasedPropertyValueResponse = TitleArrayBasedPropertyValueResponse | RichTextArrayBasedPropertyValueResponse | PeopleArrayBasedPropertyValueResponse | RelationArrayBasedPropertyValueResponse;
type ArrayPartialRollupValueResponse = {
type: "array";
array: Array<SimpleOrArrayPropertyValueResponse>;
};
export type AudioBlockObjectResponse = {
type: "audio";
audio: MediaContentWithFileAndCaptionResponse;
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
type BlockIdCommentParentResponse = {
type: "block_id";
block_id: IdResponse;
};
type BlockIdParentForBlockBasedObjectResponse = {
type: "block_id";
block_id: IdResponse;
};
export type BlockObjectRequest = {
embed: MediaContentWithUrlAndCaptionRequest;
type?: "embed";
object?: "block";
} | {
bookmark: MediaContentWithUrlAndCaptionRequest;
type?: "bookmark";
object?: "block";
} | {
image: MediaContentWithFileAndCaptionRequest;
type?: "image";
object?: "block";
} | {
video: MediaContentWithFileAndCaptionRequest;
type?: "video";
object?: "block";
} | {
pdf: MediaContentWithFileAndCaptionRequest;
type?: "pdf";
object?: "block";
} | {
file: MediaContentWithFileNameAndCaptionRequest;
type?: "file";
object?: "block";
} | {
audio: MediaContentWithFileAndCaptionRequest;
type?: "audio";
object?: "block";
} | {
code: {
rich_text: Array<RichTextItemRequest>;
language: LanguageRequest;
caption?: Array<RichTextItemRequest>;
};
type?: "code";
object?: "block";
} | {
equation: ContentWithExpressionRequest;
type?: "equation";
object?: "block";
} | {
divider: EmptyObject;
type?: "divider";
object?: "block";
} | {
breadcrumb: EmptyObject;
type?: "breadcrumb";
object?: "block";
} | {
table_of_contents: {
color?: ApiColor;
};
type?: "table_of_contents";
object?: "block";
} | {
link_to_page: {
page_id: IdRequest;
type?: "page_id";
} | {
database_id: IdRequest;
type?: "database_id";
} | {
comment_id: IdRequest;
type?: "comment_id";
};
type?: "link_to_page";
object?: "block";
} | {
table_row: ContentWithTableRowRequest;
type?: "table_row";
object?: "block";
} | {
table: TableRequestWithTableRowChildren;
type?: "table";
object?: "block";
} | {
column_list: ColumnListRequest;
type?: "column_list";
object?: "block";
} | {
column: ColumnWithChildrenRequest;
type?: "column";
object?: "block";
} | {
heading_1: {
rich_text: Array<RichTextItemRequest>;
color?: ApiColor;
is_toggleable?: boolean;
children?: Array<BlockObjectWithSingleLevelOfChildrenRequest>;
};
type?: "heading_1";
object?: "block";
} | {
heading_2: {
rich_text: Array<RichTextItemRequest>;
color?: ApiColor;
is_toggleable?: boolean;
children?: Array<BlockObjectWithSingleLevelOfChildrenRequest>;
};
type?: "heading_2";
object?: "block";
} | {
heading_3: {
rich_text: Array<RichTextItemRequest>;
color?: ApiColor;
is_toggleable?: boolean;
children?: Array<BlockObjectWithSingleLevelOfChildrenRequest>;
};
type?: "heading_3";
object?: "block";
} | {
paragraph: {
rich_text: Array<RichTextItemRequest>;
color?: ApiColor;
children?: Array<BlockObjectWithSingleLevelOfChildrenRequest>;
};
type?: "paragraph";
object?: "block";
} | {
bulleted_list_item: {
rich_text: Array<RichTextItemRequest>;
color?: ApiColor;
children?: Array<BlockObjectWithSingleLevelOfChildrenRequest>;
};
type?: "bulleted_list_item";
object?: "block";
} | {
numbered_list_item: {
rich_text: Array<RichTextItemRequest>;
color?: ApiColor;
children?: Array<BlockObjectWithSingleLevelOfChildrenRequest>;
};
type?: "numbered_list_item";
object?: "block";
} | {
quote: {
rich_text: Array<RichTextItemRequest>;
color?: ApiColor;
children?: Array<BlockObjectWithSingleLevelOfChildrenRequest>;
};
type?: "quote";
object?: "block";
} | {
to_do: {
rich_text: Array<RichTextItemRequest>;
color?: ApiColor;
children?: Array<BlockObjectWithSingleLevelOfChildrenRequest>;
checked?: boolean;
};
type?: "to_do";
object?: "block";
} | {
toggle: {
rich_text: Array<RichTextItemRequest>;
color?: ApiColor;
children?: Array<BlockObjectWithSingleLevelOfChildrenRequest>;
};
type?: "toggle";
object?: "block";
} | {
template: {
rich_text: Array<RichTextItemRequest>;
children?: Array<BlockObjectWithSingleLevelOfChildrenRequest>;
};
type?: "template";
object?: "block";
} | {
callout: {
rich_text: Array<RichTextItemRequest>;
color?: ApiColor;
children?: Array<BlockObjectWithSingleLevelOfChildrenRequest>;
icon?: PageIconRequest;
};
type?: "callout";
object?: "block";
} | {
synced_block: {
synced_from: {
block_id: IdRequest;
type?: "block_id";
} | null;
children?: Array<BlockObjectWithSingleLevelOfChildrenRequest>;
};
type?: "synced_block";
object?: "block";
};
export type BlockObjectRequestWithoutChildren = {
embed: MediaContentWithUrlAndCaptionRequest;
type?: "embed";
object?: "block";
} | {
bookmark: MediaContentWithUrlAndCaptionRequest;
type?: "bookmark";
object?: "block";
} | {
image: MediaContentWithFileAndCaptionRequest;
type?: "image";
object?: "block";
} | {
video: MediaContentWithFileAndCaptionRequest;
type?: "video";
object?: "block";
} | {
pdf: MediaContentWithFileAndCaptionRequest;
type?: "pdf";
object?: "block";
} | {
file: MediaContentWithFileNameAndCaptionRequest;
type?: "file";
object?: "block";
} | {
audio: MediaContentWithFileAndCaptionRequest;
type?: "audio";
object?: "block";
} | {
code: {
rich_text: Array<RichTextItemRequest>;
language: LanguageRequest;
caption?: Array<RichTextItemRequest>;
};
type?: "code";
object?: "block";
} | {
equation: ContentWithExpressionRequest;
type?: "equation";
object?: "block";
} | {
divider: EmptyObject;
type?: "divider";
object?: "block";
} | {
breadcrumb: EmptyObject;
type?: "breadcrumb";
object?: "block";
} | {
table_of_contents: {
color?: ApiColor;
};
type?: "table_of_contents";
object?: "block";
} | {
link_to_page: {
page_id: IdRequest;
type?: "page_id";
} | {
database_id: IdRequest;
type?: "database_id";
} | {
comment_id: IdRequest;
type?: "comment_id";
};
type?: "link_to_page";
object?: "block";
} | {
table_row: ContentWithTableRowRequest;
type?: "table_row";
object?: "block";
} | {
heading_1: HeaderContentWithRichTextAndColorRequest;
type?: "heading_1";
object?: "block";
} | {
heading_2: HeaderContentWithRichTextAndColorRequest;
type?: "heading_2";
object?: "block";
} | {
heading_3: HeaderContentWithRichTextAndColorRequest;
type?: "heading_3";
object?: "block";
} | {
paragraph: ContentWithRichTextAndColorRequest;
type?: "paragraph";
object?: "block";
} | {
bulleted_list_item: ContentWithRichTextAndColorRequest;
type?: "bulleted_list_item";
object?: "block";
} | {
numbered_list_item: ContentWithRichTextAndColorRequest;
type?: "numbered_list_item";
object?: "block";
} | {
quote: ContentWithRichTextAndColorRequest;
type?: "quote";
object?: "block";
} | {
to_do: {
rich_text: Array<RichTextItemRequest>;
checked?: boolean;
color?: ApiColor;
};
type?: "to_do";
object?: "block";
} | {
toggle: ContentWithRichTextAndColorRequest;
type?: "toggle";
object?: "block";
} | {
template: ContentWithRichTextRequest;
type?: "template";
object?: "block";
} | {
callout: {
rich_text: Array<RichTextItemRequest>;
icon?: PageIconRequest;
color?: ApiColor;
};
type?: "callout";
object?: "block";
} | {
synced_block: {
synced_from: {
block_id: IdRequest;
type?: "block_id";
} | null;
};
type?: "synced_block";
object?: "block";
};
export type BlockObjectResponse = ParagraphBlockObjectResponse | Heading1BlockObjectResponse | Heading2BlockObjectResponse | Heading3BlockObjectResponse | BulletedListItemBlockObjectResponse | NumberedListItemBlockObjectResponse | QuoteBlockObjectResponse | ToDoBlockObjectResponse | ToggleBlockObjectResponse | TemplateBlockObjectResponse | SyncedBlockBlockObjectResponse | ChildPageBlockObjectResponse | ChildDatabaseBlockObjectResponse | EquationBlockObjectResponse | CodeBlockObjectResponse | CalloutBlockObjectResponse | DividerBlockObjectResponse | BreadcrumbBlockObjectResponse | TableOfContentsBlockObjectResponse | ColumnListBlockObjectResponse | ColumnBlockObjectResponse | LinkToPageBlockObjectResponse | TableBlockObjectResponse | TableRowBlockObjectResponse | EmbedBlockObjectResponse | BookmarkBlockObjectResponse | ImageBlockObjectResponse | VideoBlockObjectResponse | PdfBlockObjectResponse | FileBlockObjectResponse | AudioBlockObjectResponse | LinkPreviewBlockObjectResponse | UnsupportedBlockObjectResponse;
type BlockObjectWithSingleLevelOfChildrenRequest = {
embed: MediaContentWithUrlAndCaptionRequest;
type?: "embed";
object?: "block";
} | {
bookmark: MediaContentWithUrlAndCaptionRequest;
type?: "bookmark";
object?: "block";
} | {
image: MediaContentWithFileAndCaptionRequest;
type?: "image";
object?: "block";
} | {
video: MediaContentWithFileAndCaptionRequest;
type?: "video";
object?: "block";
} | {
pdf: MediaContentWithFileAndCaptionRequest;
type?: "pdf";
object?: "block";
} | {
file: MediaContentWithFileNameAndCaptionRequest;
type?: "file";
object?: "block";
} | {
audio: MediaContentWithFileAndCaptionRequest;
type?: "audio";
object?: "block";
} | {
code: {
rich_text: Array<RichTextItemRequest>;
language: LanguageRequest;
caption?: Array<RichTextItemRequest>;
};
type?: "code";
object?: "block";
} | {
equation: ContentWithExpressionRequest;
type?: "equation";
object?: "block";
} | {
divider: EmptyObject;
type?: "divider";
object?: "block";
} | {
breadcrumb: EmptyObject;
type?: "breadcrumb";
object?: "block";
} | {
table_of_contents: {
color?: ApiColor;
};
type?: "table_of_contents";
object?: "block";
} | {
link_to_page: {
page_id: IdRequest;
type?: "page_id";
} | {
database_id: IdRequest;
type?: "database_id";
} | {
comment_id: IdRequest;
type?: "comment_id";
};
type?: "link_to_page";
object?: "block";
} | {
table_row: ContentWithTableRowRequest;
type?: "table_row";
object?: "block";
} | {
heading_1: HeaderContentWithSingleLevelOfChildrenRequest;
type?: "heading_1";
object?: "block";
} | {
heading_2: HeaderContentWithSingleLevelOfChildrenRequest;
type?: "heading_2";
object?: "block";
} | {
heading_3: HeaderContentWithSingleLevelOfChildrenRequest;
type?: "heading_3";
object?: "block";
} | {
paragraph: ContentWithSingleLevelOfChildrenRequest;
type?: "paragraph";
object?: "block";
} | {
bulleted_list_item: ContentWithSingleLevelOfChildrenRequest;
type?: "bulleted_list_item";
object?: "block";
} | {
numbered_list_item: ContentWithSingleLevelOfChildrenRequest;
type?: "numbered_list_item";
object?: "block";
} | {
quote: ContentWithSingleLevelOfChildrenRequest;
type?: "quote";
object?: "block";
} | {
table: TableRequestWithTableRowChildren;
type?: "table";
object?: "block";
} | {
to_do: {
rich_text: Array<RichTextItemRequest>;
color?: ApiColor;
children?: Array<BlockObjectRequestWithoutChildren>;
checked?: boolean;
};
type?: "to_do";
object?: "block";
} | {
toggle: ContentWithSingleLevelOfChildrenRequest;
type?: "toggle";
object?: "block";
} | {
template: {
rich_text: Array<RichTextItemRequest>;
children?: Array<BlockObjectRequestWithoutChildren>;
};
type?: "template";
object?: "block";
} | {
callout: {
rich_text: Array<RichTextItemRequest>;
color?: ApiColor;
children?: Array<BlockObjectRequestWithoutChildren>;
icon?: PageIconRequest;
};
type?: "callout";
object?: "block";
} | {
synced_block: {
synced_from: {
block_id: IdRequest;
type?: "block_id";
} | null;
children?: Array<BlockObjectRequestWithoutChildren>;
};
type?: "synced_block";
object?: "block";
};
export type BookmarkBlockObjectResponse = {
type: "bookmark";
bookmark: MediaContentWithUrlAndCaptionResponse;
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
type BooleanFormulaPropertyResponse = {
type: "boolean";
boolean: boolean | null;
};
type BooleanFormulaPropertyValueResponse = {
type: "boolean";
boolean: boolean | null;
};
type BotInfoResponse = {
owner: {
type: "user";
user: {
id: IdResponse;
object: "user";
name: string | null;
avatar_url: string | null;
type: "person";
person: {
email?: string;
};
} | PartialUserObjectResponse;
} | {
type: "workspace";
workspace: true;
};
workspace_id: string;
workspace_limits: {
max_file_upload_size_in_bytes: number;
};
workspace_name: string | null;
};
export type BotUserObjectResponse = {
type: "bot";
bot: EmptyObject | BotInfoResponse;
};
export type BreadcrumbBlockObjectResponse = {
type: "breadcrumb";
breadcrumb: EmptyObject;
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
export type BulletedListItemBlockObjectResponse = {
type: "bulleted_list_item";
bulleted_list_item: ContentWithRichTextAndColorResponse;
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
type ButtonPropertyConfigurationRequest = {
type?: "button";
button: EmptyObject;
};
export type ButtonPropertyItemObjectResponse = {
type: "button";
button: EmptyObject;
object: "property_item";
id: string;
};
type ButtonSimplePropertyValueResponse = {
type: "button";
button: EmptyObject;
};
export type CalloutBlockObjectResponse = {
type: "callout";
callout: {
rich_text: Array<RichTextItemResponse>;
color: ApiColor;
icon: PageIconResponse | null;
};
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
type CheckboxDatabasePropertyConfigResponse = {
type: "checkbox";
checkbox: EmptyObject;
};
type CheckboxPropertyConfigurationRequest = {
type?: "checkbox";
checkbox: EmptyObject;
};
type CheckboxPropertyFilter = {
equals: boolean;
} | {
does_not_equal: boolean;
};
export type CheckboxPropertyItemObjectResponse = {
type: "checkbox";
checkbox: boolean;
object: "property_item";
id: string;
};
type CheckboxSimplePropertyValueResponse = {
type: "checkbox";
checkbox: boolean;
};
export type ChildDatabaseBlockObjectResponse = {
type: "child_database";
child_database: TitleObjectResponse;
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
export type ChildPageBlockObjectResponse = {
type: "child_page";
child_page: TitleObjectResponse;
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
export type CodeBlockObjectResponse = {
type: "code";
code: {
rich_text: Array<RichTextItemResponse>;
caption: Array<RichTextItemResponse>;
language: LanguageRequest;
};
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
export type ColumnBlockObjectResponse = {
type: "column";
column: ColumnResponse;
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
type ColumnBlockWithChildrenRequest = {
column: ColumnWithChildrenRequest;
type?: "column";
object?: "block";
};
export type ColumnListBlockObjectResponse = {
type: "column_list";
column_list: EmptyObject;
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
type ColumnListRequest = {
children: Array<ColumnBlockWithChildrenRequest>;
};
type ColumnResponse = {
width_ratio?: number;
};
type ColumnWithChildrenRequest = {
children: Array<BlockObjectWithSingleLevelOfChildrenRequest>;
width_ratio?: number;
};
export type CommentObjectResponse = {
object: "comment";
id: IdResponse;
parent: CommentParentResponse;
discussion_id: IdResponse;
created_time: string;
last_edited_time: string;
created_by: PartialUserObjectResponse;
rich_text: Array<RichTextItemResponse>;
display_name: {
type: "custom" | "user" | "integration";
resolved_name: string | null;
};
attachments?: Array<{
category: "audio" | "image" | "pdf" | "productivity" | "video";
file: InternalFileResponse;
}>;
};
type CommentParentResponse = PageIdCommentParentResponse | BlockIdCommentParentResponse;
type ContentWithExpressionRequest = {
expression: string;
};
type ContentWithRichTextAndColorRequest = {
rich_text: Array<RichTextItemRequest>;
color?: ApiColor;
};
type ContentWithRichTextAndColorResponse = {
rich_text: Array<RichTextItemResponse>;
color: ApiColor;
};
type ContentWithRichTextRequest = {
rich_text: Array<RichTextItemRequest>;
};
type ContentWithSingleLevelOfChildrenRequest = {
rich_text: Array<RichTextItemRequest>;
color?: ApiColor;
children?: Array<BlockObjectRequestWithoutChildren>;
};
type ContentWithTableResponse = {
has_column_header: boolean;
has_row_header: boolean;
table_width: number;
};
type ContentWithTableRowRequest = {
cells: Array<Array<RichTextItemRequest>>;
};
type ContentWithTableRowResponse = {
cells: Array<Array<RichTextItemResponse>>;
};
type CreatedByDatabasePropertyConfigResponse = {
type: "created_by";
created_by: EmptyObject;
};
type CreatedByPropertyConfigurationRequest = {
type?: "created_by";
created_by: EmptyObject;
};
export type CreatedByPropertyItemObjectResponse = {
type: "created_by";
created_by: PartialUserObjectResponse | UserObjectResponse;
object: "property_item";
id: string;
};
type CreatedBySimplePropertyValueResponse = {
type: "created_by";
created_by: UserValueResponse;
};
type CreatedTimeDatabasePropertyConfigResponse = {
type: "created_time";
created_time: EmptyObject;
};
type CreatedTimePropertyConfigurationRequest = {
type?: "created_time";
created_time: EmptyObject;
};
export type CreatedTimePropertyItemObjectResponse = {
type: "created_time";
created_time: string;
object: "property_item";
id: string;
};
type CreatedTimeSimplePropertyValueResponse = {
type: "created_time";
created_time: string;
};
type CustomEmojiPageIconRequest = {
type?: "custom_emoji";
custom_emoji: {
id: IdRequest;
name?: string;
url?: string;
};
};
type CustomEmojiPageIconResponse = {
type: "custom_emoji";
custom_emoji: CustomEmojiResponse;
};
type CustomEmojiResponse = {
id: IdResponse;
name: string;
url: string;
};
export type DataSourceObjectResponse = {
object: "data_source";
id: IdResponse;
title: Array<RichTextItemResponse>;
description: Array<RichTextItemResponse>;
parent: ParentOfDataSourceResponse;
database_parent: ParentOfDatabaseResponse;
is_inline: boolean;
archived: boolean;
in_trash: boolean;
created_time: string;
last_edited_time: string;
created_by: PartialUserObjectResponse;
last_edited_by: PartialUserObjectResponse;
properties: Record<string, DatabasePropertyConfigResponse>;
icon: PageIconResponse | null;
cover: PageCoverResponse | null;
url: string;
public_url: string | null;
};
type DataSourceParentResponse = {
type: "data_source_id";
data_source_id: IdResponse;
database_id: IdResponse;
};
type DataSourceReferenceResponse = {
id: IdResponse;
name: string;
};
export type DatabaseObjectResponse = {
object: "database";
id: IdResponse;
title: Array<RichTextItemResponse>;
description: Array<RichTextItemResponse>;
parent: ParentOfDatabaseResponse;
is_inline: boolean;
in_trash: boolean;
is_locked: boolean;
created_time: string;
last_edited_time: string;
data_sources: Array<DataSourceReferenceResponse>;
icon: PageIconResponse | null;
cover: PageCoverResponse | null;
url: string;
public_url: string | null;
};
type DatabaseParentResponse = {
type: "database_id";
database_id: IdResponse;
};
type DatabasePropertyConfigResponse = DatabasePropertyConfigResponseCommon & (NumberDatabasePropertyConfigResponse | FormulaDatabasePropertyConfigResponse | SelectDatabasePropertyConfigResponse | MultiSelectDatabasePropertyConfigResponse | StatusDatabasePropertyConfigResponse | RelationDatabasePropertyConfigResponse | RollupDatabasePropertyConfigResponse | UniqueIdDatabasePropertyConfigResponse | TitleDatabasePropertyConfigResponse | RichTextDatabasePropertyConfigResponse | UrlDatabasePropertyConfigResponse | PeopleDatabasePropertyConfigResponse | FilesDatabasePropertyConfigResponse | EmailDatabasePropertyConfigResponse | PhoneNumberDatabasePropertyConfigResponse | DateDatabasePropertyConfigResponse | CheckboxDatabasePropertyConfigResponse | CreatedByDatabasePropertyConfigResponse | CreatedTimeDatabasePropertyConfigResponse | LastEditedByDatabasePropertyConfigResponse | LastEditedTimeDatabasePropertyConfigResponse);
type DatabasePropertyConfigResponseCommon = {
id: string;
name: string;
description: PropertyDescriptionRequest | null;
};
type DatabasePropertyRelationConfigResponse = DatabasePropertyRelationConfigResponseCommon & (SinglePropertyDatabasePropertyRelationConfigResponse | DualPropertyDatabasePropertyRelationConfigResponse);
type DatabasePropertyRelationConfigResponseCommon = {
database_id: IdResponse;
data_source_id: IdResponse;
};
type DateDatabasePropertyConfigResponse = {
type: "date";
date: EmptyObject;
};
type DateFormulaPropertyResponse = {
type: "date";
date: DateResponse | null;
};
type DateFormulaPropertyValueResponse = {
type: "date";
date: DateResponse | null;
};
type DatePartialRollupValueResponse = {
type: "date";
date: DateResponse | null;
};
type DatePropertyConfigurationRequest = {
type?: "date";
date: EmptyObject;
};
type DatePropertyFilter = {
equals: string;
} | {
before: string;
} | {
after: string;
} | {
on_or_before: string;
} | {
on_or_after: string;
} | {
this_week: EmptyObject;
} | {
past_week: EmptyObject;
} | {
past_month: EmptyObject;
} | {
past_year: EmptyObject;
} | {
next_week: EmptyObject;
} | {
next_month: EmptyObject;
} | {
next_year: EmptyObject;
} | ExistencePropertyFilter;
export type DatePropertyItemObjectResponse = {
type: "date";
date: DateResponse | null;
object: "property_item";
id: string;
};
type DateRequest = {
start: string;
end?: string | null;
time_zone?: TimeZoneRequest | null;
};
type DateResponse = {
start: string;
end: string | null;
time_zone: TimeZoneRequest | null;
};
type DateSimplePropertyValueResponse = {
type: "date";
date: DateResponse | null;
};
export type DividerBlockObjectResponse = {
type: "divider";
divider: EmptyObject;
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
type DualPropertyDatabasePropertyRelationConfigResponse = {
type?: "dual_property";
dual_property: {
synced_property_id: string;
synced_property_name: string;
};
};
type EmailDatabasePropertyConfigResponse = {
type: "email";
email: EmptyObject;
};
type EmailPropertyConfigurationRequest = {
type?: "email";
email: EmptyObject;
};
export type EmailPropertyItemObjectResponse = {
type: "email";
email: string | null;
object: "property_item";
id: string;
};
type EmailSimplePropertyValueResponse = {
type: "email";
email: string | null;
};
export type EmbedBlockObjectResponse = {
type: "embed";
embed: MediaContentWithUrlAndCaptionResponse;
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
type EmojiPageIconRequest = {
type?: "emoji";
emoji: EmojiRequest;
};
type EmojiPageIconResponse = {
type: "emoji";
emoji: EmojiRequest;
};
type EmojiRequest = string;
type EmptyObject = Record<string, never>;
export type EquationBlockObjectResponse = {
type: "equation";
equation: ExpressionObjectResponse;
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
type EquationRichTextItemRequest = {
type?: "equation";
equation: {
expression: string;
};
};
export type EquationRichTextItemResponse = {
type: "equation";
equation: {
expression: string;
};
};
type ExistencePropertyFilter = {
is_empty: true;
} | {
is_not_empty: true;
};
type ExpressionObjectResponse = {
expression: string;
};
type ExternalFileRequest = {
url: TextRequest;
};
type ExternalInternalOrExternalFileWithNameResponse = {
type: "external";
external: {
url: string;
};
};
type ExternalMediaContentWithFileAndCaptionResponse = {
type: "external";
external: {
url: TextRequest;
};
caption: Array<RichTextItemResponse>;
};
type ExternalMediaContentWithFileNameAndCaptionResponse = {
type: "external";
external: {
url: TextRequest;
};
caption: Array<RichTextItemResponse>;
name: string;
};
type ExternalPageCoverRequest = {
type?: "external";
external: {
url: string;
};
};
type ExternalPageCoverResponse = {
type: "external";
external: {
url: string;
};
};
type ExternalPageIconRequest = {
type?: "external";
external: {
url: string;
};
};
type ExternalPageIconResponse = {
type: "external";
external: {
url: string;
};
};
export type FileBlockObjectResponse = {
type: "file";
file: MediaContentWithFileNameAndCaptionResponse;
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
type FileInternalOrExternalFileWithNameResponse = {
type: "file";
file: InternalFileResponse;
};
type FileMediaContentWithFileAndCaptionResponse = {
type: "file";
file: InternalFileResponse;
caption: Array<RichTextItemResponse>;
};
type FileMediaContentWithFileNameAndCaptionResponse = {
type: "file";
file: InternalFileResponse;
caption: Array<RichTextItemResponse>;
name: string;
};
type FilePageCoverResponse = {
type: "file";
file: InternalFileResponse;
};
type FilePageIconResponse = {
type: "file";
file: InternalFileResponse;
};
type FileUploadIdRequest = {
id: IdRequest;
};
export type FileUploadObjectResponse = {
object: "file_upload";
id: IdResponse;
created_time: string;
created_by: {
id: IdResponse;
type: "person" | "bot" | "agent";
};
last_edited_time: string;
archived: boolean;
expiry_time: string | null;
status: "pending" | "uploaded" | "expired" | "failed";
filename: string | null;
content_type: string | null;
content_length: number | null;
upload_url?: string;
complete_url?: string;
file_import_result?: {
imported_time: string;
} & ({
type: "success";
success: EmptyObject;
} | {
type: "error";
error: {
type: "validation_error" | "internal_system_error" | "download_error" | "upload_error";
code: string;
message: string;
parameter: string | null;
status_code: number | null;
};
});
number_of_parts?: {
total: number;
sent: number;
};
};
type FileUploadPageCoverRequest = {
type?: "file_upload";
file_upload: {
id: string;
};
};
type FileUploadPageIconRequest = {
type?: "file_upload";
file_upload: {
id: string;
};
};
type FileUploadWithOptionalNameRequest = {
file_upload: FileUploadIdRequest;
type?: "file_upload";
name?: StringRequest;
};
type FilesDatabasePropertyConfigResponse = {
type: "files";
files: EmptyObject;
};
type FilesPropertyConfigurationRequest = {
type?: "files";
files: EmptyObject;
};
export type FilesPropertyItemObjectResponse = {
type: "files";
files: Array<InternalOrExternalFileWithNameResponse>;
object: "property_item";
id: string;
};
type FilesSimplePropertyValueResponse = {
type: "files";
files: Array<InternalOrExternalFileWithNameResponse>;
};
type FormulaDatabasePropertyConfigResponse = {
type: "formula";
formula: {
expression: string;
};
};
type FormulaPropertyConfigurationRequest = {
type?: "formula";
formula: {
expression?: string;
};
};
type FormulaPropertyFilter = {
string: TextPropertyFilter;
} | {
checkbox: CheckboxPropertyFilter;
} | {
number: NumberPropertyFilter;
} | {
date: DatePropertyFilter;
};
export type FormulaPropertyItemObjectResponse = {
type: "formula";
formula: FormulaPropertyResponse;
object: "property_item";
id: string;
};
type FormulaPropertyResponse = StringFormulaPropertyResponse | DateFormulaPropertyResponse | NumberFormulaPropertyResponse | BooleanFormulaPropertyResponse;
type FormulaPropertyValueResponse = BooleanFormulaPropertyValueResponse | DateFormulaPropertyValueResponse | NumberFormulaPropertyValueResponse | StringFormulaPropertyValueResponse;
type FormulaSimplePropertyValueResponse = {
type: "formula";
formula: FormulaPropertyValueResponse;
};
type GroupFilterOperatorArray = Array<PropertyOrTimestampFilter | {
or: PropertyOrTimestampFilterArray;
} | {
and: PropertyOrTimestampFilterArray;
}>;
type GroupObjectRequest = {
id: IdRequest;
name?: string | null;
object?: "group";
};
export type GroupObjectResponse = {
id: IdResponse;
object: "group";
name: string | null;
};
type HeaderContentWithRichTextAndColorRequest = {
rich_text: Array<RichTextItemRequest>;
color?: ApiColor;
is_toggleable?: boolean;
};
type HeaderContentWithRichTextAndColorResponse = {
rich_text: Array<RichTextItemResponse>;
color: ApiColor;
is_toggleable: boolean;
};
type HeaderContentWithSingleLevelOfChildrenRequest = {
rich_text: Array<RichTextItemRequest>;
color?: ApiColor;
is_toggleable?: boolean;
children?: Array<BlockObjectRequestWithoutChildren>;
};
export type Heading1BlockObjectResponse = {
type: "heading_1";
heading_1: HeaderContentWithRichTextAndColorResponse;
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
export type Heading2BlockObjectResponse = {
type: "heading_2";
heading_2: HeaderContentWithRichTextAndColorResponse;
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
export type Heading3BlockObjectResponse = {
type: "heading_3";
heading_3: HeaderContentWithRichTextAndColorResponse;
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
type IdObjectResponse = {
id: string;
};
type IdRequest = string;
type IdResponse = string;
export type ImageBlockObjectResponse = {
type: "image";
image: MediaContentWithFileAndCaptionResponse;
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
type InitialDataSourceRequest = {
properties?: Record<string, PropertyConfigurationRequest>;
};
type InternalFileRequest = {
url: string;
expiry_time?: string;
};
type InternalFileResponse = {
url: string;
expiry_time: string;
};
type InternalOrExternalFileWithNameRequest = {
file: InternalFileRequest;
name: StringRequest;
type?: "file";
} | {
external: ExternalFileRequest;
name: StringRequest;
type?: "external";
};
type InternalOrExternalFileWithNameResponse = InternalOrExternalFileWithNameResponseCommon & (FileInternalOrExternalFileWithNameResponse | ExternalInternalOrExternalFileWithNameResponse);
type InternalOrExternalFileWithNameResponseCommon = {
name: string;
};
type LanguageRequest = "abap" | "abc" | "agda" | "arduino" | "ascii art" | "assembly" | "bash" | "basic" | "bnf" | "c" | "c#" | "c++" | "clojure" | "coffeescript" | "coq" | "css" | "dart" | "dhall" | "diff" | "docker" | "ebnf" | "elixir" | "elm" | "erlang" | "f#" | "flow" | "fortran" | "gherkin" | "glsl" | "go" | "graphql" | "groovy" | "haskell" | "hcl" | "html" | "idris" | "java" | "javascript" | "json" | "julia" | "kotlin" | "latex" | "less" | "lisp" | "livescript" | "llvm ir" | "lua" | "makefile" | "markdown" | "markup" | "matlab" | "mathematica" | "mermaid" | "nix" | "notion formula" | "objective-c" | "ocaml" | "pascal" | "perl" | "php" | "plain text" | "powershell" | "prolog" | "protobuf" | "purescript" | "python" | "r" | "racket" | "reason" | "ruby" | "rust" | "sass" | "scala" | "scheme" | "scss" | "shell" | "smalltalk" | "solidity" | "sql" | "swift" | "toml" | "typescript" | "vb.net" | "verilog" | "vhdl" | "visual basic" | "webassembly" | "xml" | "yaml" | "java/c/c++/c#";
type LastEditedByDatabasePropertyConfigResponse = {
type: "last_edited_by";
last_edited_by: EmptyObject;
};
type LastEditedByPropertyConfigurationRequest = {
type?: "last_edited_by";
last_edited_by: EmptyObject;
};
export type LastEditedByPropertyItemObjectResponse = {
type: "last_edited_by";
last_edited_by: PartialUserObjectResponse | UserObjectResponse;
object: "property_item";
id: string;
};
type LastEditedBySimplePropertyValueResponse = {
type: "last_edited_by";
last_edited_by: UserValueResponse;
};
type LastEditedTimeDatabasePropertyConfigResponse = {
type: "last_edited_time";
last_edited_time: EmptyObject;
};
type LastEditedTimePropertyConfigurationRequest = {
type?: "last_edited_time";
last_edited_time: EmptyObject;
};
export type LastEditedTimePropertyItemObjectResponse = {
type: "last_edited_time";
last_edited_time: string;
object: "property_item";
id: string;
};
type LastEditedTimeSimplePropertyValueResponse = {
type: "last_edited_time";
last_edited_time: string;
};
type LastVisitedTimePropertyConfigurationRequest = {
type?: "last_visited_time";
last_visited_time: EmptyObject;
};
type LinkMentionResponse = {
href: string;
title?: string;
description?: string;
link_author?: string;
link_provider?: string;
thumbnail_url?: string;
icon_url?: string;
iframe_url?: string;
height?: number;
padding?: number;
padding_top?: number;
};
export type LinkPreviewBlockObjectResponse = {
type: "link_preview";
link_preview: MediaContentWithUrlResponse;
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
type LinkPreviewMentionResponse = {
url: string;
};
export type LinkToPageBlockObjectResponse = {
type: "link_to_page";
link_to_page: {
type: "page_id";
page_id: IdRequest;
} | {
type: "database_id";
database_id: IdRequest;
} | {
type: "comment_id";
comment_id: IdRequest;
};
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
type LocationPropertyConfigurationRequest = {
type?: "location";
location: EmptyObject;
};
type MediaContentWithFileAndCaptionRequest = {
external: ExternalFileRequest;
type?: "external";
caption?: Array<RichTextItemRequest>;
} | {
file_upload: FileUploadIdRequest;
type?: "file_upload";
caption?: Array<RichTextItemRequest>;
};
type MediaContentWithFileAndCaptionResponse = ExternalMediaContentWithFileAndCaptionResponse | FileMediaContentWithFileAndCaptionResponse;
type MediaContentWithFileNameAndCaptionRequest = {
external: ExternalFileRequest;
type?: "external";
caption?: Array<RichTextItemRequest>;
name?: StringRequest;
} | {
file_upload: FileUploadIdRequest;
type?: "file_upload";
caption?: Array<RichTextItemRequest>;
name?: StringRequest;
};
type MediaContentWithFileNameAndCaptionResponse = ExternalMediaContentWithFileNameAndCaptionResponse | FileMediaContentWithFileNameAndCaptionResponse;
type MediaContentWithUrlAndCaptionRequest = {
url: string;
caption?: Array<RichTextItemRequest>;
};
type MediaContentWithUrlAndCaptionResponse = {
url: string;
caption: Array<RichTextItemResponse>;
};
type MediaContentWithUrlResponse = {
url: TextRequest;
};
type MentionRichTextItemRequest = {
type?: "mention";
mention: {
type?: "user";
user: PartialUserObjectRequest;
} | {
type?: "date";
date: DateRequest;
} | {
type?: "page";
page: {
id: IdRequest;
};
} | {
type?: "database";
database: {
id: IdRequest;
};
} | {
type?: "template_mention";
template_mention: TemplateMentionRequest;
} | {
type?: "custom_emoji";
custom_emoji: {
id: IdRequest;
name?: string;
url?: string;
};
};
};
export type MentionRichTextItemResponse = {
type: "mention";
mention: {
type: "user";
user: UserValueResponse;
} | {
type: "date";
date: DateResponse;
} | {
type: "link_preview";
link_preview: LinkPreviewMentionResponse;
} | {
type: "link_mention";
link_mention: LinkMentionResponse;
} | {
type: "page";
page: {
id: IdResponse;
};
} | {
type: "database";
database: {
id: IdResponse;
};
} | {
type: "template_mention";
template_mention: TemplateMentionResponse;
} | {
type: "custom_emoji";
custom_emoji: CustomEmojiResponse;
};
};
type MultiSelectDatabasePropertyConfigResponse = {
type: "multi_select";
multi_select: {
options: Array<SelectPropertyResponse>;
};
};
type MultiSelectPropertyConfigurationRequest = {
type?: "multi_select";
multi_select: {
options?: Array<{
name: string;
color?: SelectColor;
description?: string | null;
}>;
};
};
type MultiSelectPropertyFilter = {
contains: string;
} | {
does_not_contain: string;
} | ExistencePropertyFilter;
export type MultiSelectPropertyItemObjectResponse = {
type: "multi_select";
multi_select: Array<PartialSelectResponse>;
object: "property_item";
id: string;
};
type MultiSelectSimplePropertyValueResponse = {
type: "multi_select";
multi_select: Array<PartialSelectPropertyValueResponse>;
};
type NumberDatabasePropertyConfigResponse = {
type: "number";
number: {
format: NumberFormat;
};
};
type NumberFormat = string;
type NumberFormulaPropertyResponse = {
type: "number";
number: number | null;
};
type NumberFormulaPropertyValueResponse = {
type: "number";
number: number | null;
};
type NumberPartialRollupValueResponse = {
type: "number";
number: number | null;
};
type NumberPropertyConfigurationRequest = {
type?: "number";
number: {
format?: NumberFormat;
};
};
type NumberPropertyFilter = {
equals: number;
} | {
does_not_equal: number;
} | {
greater_than: number;
} | {
less_than: number;
} | {
greater_than_or_equal_to: number;
} | {
less_than_or_equal_to: number;
} | ExistencePropertyFilter;
export type NumberPropertyItemObjectResponse = {
type: "number";
number: number | null;
object: "property_item";
id: string;
};
type NumberSimplePropertyValueResponse = {
type: "number";
number: number | null;
};
export type NumberedListItemBlockObjectResponse = {
type: "numbered_list_item";
numbered_list_item: ContentWithRichTextAndColorResponse;
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
type PageCoverRequest = FileUploadPageCoverRequest | ExternalPageCoverRequest;
type PageCoverResponse = FilePageCoverResponse | ExternalPageCoverResponse;
type PageIconRequest = FileUploadPageIconRequest | EmojiPageIconRequest | ExternalPageIconRequest | CustomEmojiPageIconRequest;
type PageIconResponse = EmojiPageIconResponse | FilePageIconResponse | ExternalPageIconResponse | CustomEmojiPageIconResponse;
type PageIdCommentParentResponse = {
type: "page_id";
page_id: IdResponse;
};
type PageIdParentForBlockBasedObjectResponse = {
type: "page_id";
page_id: IdResponse;
};
export type PageObjectResponse = {
object: "page";
id: IdResponse;
created_time: string;
last_edited_time: string;
archived: boolean;
in_trash: boolean;
is_locked: boolean;
url: string;
public_url: string | null;
parent: ParentForBlockBasedObjectResponse;
properties: Record<string, PagePropertyValueWithIdResponse>;
icon: PageIconResponse | null;
cover: PageCoverResponse | null;
created_by: PartialUserObjectResponse;
last_edited_by: PartialUserObjectResponse;
};
type PagePropertyValueWithIdResponse = IdObjectResponse & (SimpleOrArrayPropertyValueResponse | PartialRollupPropertyResponse);
export type ParagraphBlockObjectResponse = {
type: "paragraph";
paragraph: ContentWithRichTextAndColorResponse;
parent: ParentForBlockBasedObjectResponse;
object: "block";
id: string;
created_time: string;
created_by: PartialUserObjectResponse;
last_edited_time: string;
last_edited_by: PartialUserObjectResponse;
has_children: boolean;
archived: boolean;
in_trash: boolean;
};
type ParentForBlockBasedObjectResponse = DatabaseParentResponse | DataSourceParentResponse | PageIdParentForBlockBasedObjectResponse | BlockIdParentForBlockBasedObjectResponse | WorkspaceParentForBlockBasedObjectResponse;
type ParentOfDataSourceRequest = {
type?: "database_id";
database_id: IdRequest;
};
/**
* The parent of the data source. This is typically a database (`database_id`), but for
* externally synced data sources, can be another data source (`data_source_id`).
*/
type ParentOfDataSourceResponse = DatabaseParentResponse | DataSourceParentResponse;
type ParentOfDatabaseResponse = PageIdParentForBlockBasedObjectResponse | WorkspaceParentForBlockBasedObjectResponse | DatabaseParentResponse | BlockIdParentForBlockBasedObjectResponse;
export type PartialBlockObjectResponse = {
object: "block";
id: string;
};
export type PartialCommentObjectResponse = {
object: "comment";
id: IdResponse;
};
export type PartialDataSourceObjectResponse = {
object: "data_source";
id: IdResponse;
properties: Record<string, DatabasePropertyConfigResponse>;
};
export type PartialDatabaseObjectResponse = {
object: "database";
id: IdResponse;
};
export type PartialPageObjectResponse = {
object: "page";
id: IdResponse;
};
type PartialRollupPropertyResponse = {
type: "rollup";
rollup: PartialRollupValueResponse;
};
type PartialRollupValueResponse = PartialRollupValueResponseCommon & (NumberPartialRollupValueResponse | DatePartialRollupValueResponse | ArrayPartialRollupValueResponse);
type PartialRollupValueResponseCommon = {
function: RollupFunction;
};
type PartialSelectPropertyValueResponse