Corsair
PluginsNotion

Notion Database Schema

Database entities and querying synced Notion data

The Notion plugin syncs workspace data to your database for fast queries.

New to Corsair? Learn about database operations, data synchronization, and multi-tenancy.

Full Implementation: See the Notion plugin source code.

Synced Entities

  • databases - Notion database definitions
  • pages - Page metadata and properties
  • users - Workspace user profiles

Database API

const pages = await corsair.notion.db.pages.search({
    data: { title: "Meeting Notes" },
});

Databases

Schema

{
    id: string;                 // Notion database ID
    title: string;
    description?: string;
    url: string;
    created_time: string;       // ISO timestamp
    last_edited_time: string;   // ISO timestamp
    is_inline: boolean;
    archived: boolean;
    properties_schema?: Record<string, unknown>;
}

Querying Databases

const databases = await corsair.notion.db.databases.search({
    data: { archived: false }, 
});

Pages

Schema

{
    id: string;                 // Notion page ID
    title?: string;
    url: string;
    created_time: string;       // ISO timestamp
    last_edited_time: string;   // ISO timestamp
    parent_type: string;        // database | page | workspace
    parent_id?: string;
    archived: boolean;
    properties?: Record<string, unknown>;
}

Querying Pages

const pages = await corsair.notion.db.pages.search({
    data: { parent_type: "database" }, 
});

Users

Schema

{
    id: string;                 // Notion user ID
    name: string;
    avatar_url?: string;
    type: string;               // person | bot
    email?: string;             // Only for person type
}

Example: Multi-Tenancy Query

const tenant = corsair.withTenant("workspace-123");

const users = await tenant.notion.db.users.search({
    data: { type: "person" }, 
});