FabricFabricSDK
Plugins

Notion

Create, update, and query pages, databases, and blocks in Notion workspaces.

Authentication

TypeDefaultDetails
api_keyInternal Integration Token
oauth_2Public integration OAuth flow

Notion requires the Notion-Version: 2022-06-28 header on every request. The plugin sets this automatically.

Endpoints

PathRiskDescription
pages.getreadRetrieve a page.
pages.createwriteCreate a page.
pages.updatewriteUpdate a page (archived:true soft-deletes).
databases.getreadRetrieve a database.
databases.queryreadQuery a database.
blocks.children.listreadList children of a block.
blocks.children.appendwriteAppend children to a block.
blocks.deletedestructiveDelete a block (recoverable from trash).
searchreadSearch pages and databases.

pages.get

Retrieve a page by ID.

Input:

FieldTypeRequiredDescription
page_idstringPage UUID

Output: NotionPage

pages.create

Create a new page as a child of a database or another page.

Input:

FieldTypeRequiredDescription
parentobject{ database_id?: string; page_id?: string }
propertiesobjectPage properties keyed by property name
childrenarrayInitial block children

Output: NotionPage

pages.update

Update page properties or archive a page.

Input:

FieldTypeRequiredDescription
page_idstringPage UUID
propertiesobjectProperties to update
archivedbooleanSet true to archive (soft-delete)

Output: NotionPage

databases.get

Get a database's schema and metadata.

Input:

FieldTypeRequiredDescription
database_idstringDatabase UUID

Output: NotionDatabase

databases.query

Query a database with filters, sorts, and pagination.

Input:

FieldTypeDescription
database_idstring✅ Database UUID
filterobjectNotion filter object
sortsarraySort configurations
page_sizenumberMax results per page
start_cursorstringPagination cursor

Output: { results: NotionPage[]; next_cursor: string | null; has_more: boolean }

blocks.children.list

List the children blocks of a page or block.

Input:

FieldTypeDescription
block_idstring✅ Block/page UUID
start_cursorstringPagination cursor
page_sizenumberMax results

Output: { results: NotionBlock[]; next_cursor: string | null; has_more: boolean }

blocks.children.append

Append new blocks to a parent block.

Input:

FieldTypeRequiredDescription
block_idstringParent block/page UUID
childrenarrayBlock objects to append

Output: { results: NotionBlock[] }

blocks.delete

Delete a block.

Input:

FieldTypeRequiredDescription
block_idstringBlock UUID

Output: NotionBlock

Search pages and databases by title.

Input:

FieldTypeDescription
querystringSearch text
page_sizenumberMax results
start_cursorstringPagination cursor
filterobject{ value: "page" | "database"; property: "object" }

Output: { results: Array<NotionPage \| NotionDatabase>; next_cursor: string | null; has_more: boolean }

Usage

import { createFabric } from "@fabricorg/integrations";
import { notion } from "@fabricorg/integrations/plugins";

const fabric = createFabric({
  plugins: [notion({ apiKey: process.env.NOTION_API_KEY })],
});

// Create a page in a database
const page = await fabric.notion.api.pages.create({
  parent: { database_id: "a1b2c3d4-..." },
  properties: {
    Name: { title: [{ text: { content: "New Task" } }] },
    Status: { select: { name: "In Progress" } },
  },
});

// Query a database
const { results } = await fabric.notion.api.databases.query({
  database_id: "a1b2c3d4-...",
  filter: { property: "Status", select: { equals: "Done" } },
});

Webhooks

Notion webhooks are not yet implemented in this plugin.

Types

interface NotionPage {
  object: "page";
  id: string;
  created_time: string;
  last_edited_time: string;
  archived: boolean;
  url: string;
  properties: Record<string, unknown>;
  parent?: { type: string; database_id?: string; page_id?: string };
}

interface NotionDatabase {
  object: "database";
  id: string;
  created_time: string;
  last_edited_time: string;
  url: string;
  title: unknown[];
  properties: Record<string, unknown>;
}

interface NotionBlock {
  object: "block";
  id: string;
  type: string;
  created_time: string;
  last_edited_time: string;
  archived: boolean;
  has_children: boolean;
}