Skip to content
GitHubnpm

Schema Types

This reference covers all supported Notion property types and their available conversion methods.

All property types include these default methods:

MethodDescription
raw()Return the native Notion property value
rawWithDefault(value)Return raw value with a default for null/undefined
handleUsing(handler)Custom handler function (makes mutable types immutable)
handleAndComposeUsing({handler, composer})Custom handler + composer (mutable types only)

Mutability: Mutable

checkbox().boolean()       // Returns boolean
checkbox("Is Done").raw()  // Custom property name
MethodReturn TypeDescription
boolean()booleanCheckbox state (same as raw)

Mutability: Mutable

title().plainText()        // Returns string
title("Name").raw()        // Returns RichTextItemResponse[]
MethodReturn TypeDescription
plainText()stringConcatenated plain text of all rich text items

Mutability: Mutable

rich_text().plainText()           // Returns string
rich_text("Description").raw()    // Returns RichTextItemResponse[]
MethodReturn TypeDescription
plainText()stringConcatenated plain text

Mutability: Mutable

number().numberDefaultZero()    // Returns number (0 if null)
number("Count").raw()           // Returns number | null
MethodReturn TypeDescription
numberDefaultZero()numberNumber with 0 as default

Mutability: Mutable

select().optionalString()                     // Returns string | undefined
select().stringEnum('draft', 'published')     // Returns 'draft' | 'published'
select("Priority").raw()                      // Custom property name
MethodReturn TypeDescription
optionalString()string | undefinedSelected option name or undefined
stringEnum(...values)Union of valuesType-safe enum of allowed values

Mutability: Mutable

multi_select().strings()                              // Returns string[]
multi_select().stringEnums('tag1', 'tag2', 'tag3')    // Returns ('tag1' | 'tag2' | 'tag3')[]
MethodReturn TypeDescription
strings()string[]Array of selected option names
stringEnums(...values)T[]Type-safe array of allowed values

Mutability: Mutable

status().string()                                     // Returns string
status().stringEnum('todo', 'in-progress', 'done')    // Returns 'todo' | 'in-progress' | 'done'
MethodReturn TypeDescription
string()stringStatus name
stringEnum(...values)Union of valuesType-safe enum of allowed values

Mutability: Mutable

date().startDate()      // Returns string
date().dateRange()      // Returns { start: string, end: string }
MethodReturn TypeDescription
startDate()stringOnly the start date string
dateRange(){ start: string, end: string }Object with start and end dates (empty strings if not set)

Mutability: Partial (read-only for some features)

files().urls()                     // Returns string[]
files().singleUrl()                // Returns string
files().notionImageUrls()          // Returns string[] (optimized URLs)
files().singleNotionImageUrl()     // Returns string (optimized URL)
MethodReturn TypeDescription
urls()string[]Array of file URLs
singleUrl()stringFirst file URL only
notionImageUrls()string[]URLs using Notion’s image optimization
singleNotionImageUrl()stringFirst URL with Notion’s image optimization

Mutability: Mutable

url().string()    // Returns string (empty string if null)
MethodReturn TypeDescription
string()stringURL string with empty string default

Mutability: Mutable

email().string()    // Returns string (empty string if null)
MethodReturn TypeDescription
string()stringEmail string with empty string default

Mutability: Mutable

phone_number().string()    // Returns string (empty string if null)
MethodReturn TypeDescription
string()stringPhone number string with empty string default

Mutability: Mutable

relation().ids()          // Returns string[]
relation().singleId()     // Returns string
relation().objects()      // Returns related objects (with rollup fields)
MethodReturn TypeDescription
ids()string[]Array of related page IDs
singleId()stringFirst related page ID
objects()Object arrayConstructed objects from rollup fields

Mutability: Immutable

formula().string()                // Returns string
formula().numberDefaultZero()     // Returns number
formula().booleanDefaultFalse()   // Returns boolean
formula().dateRange()             // Returns { start: string, end: string }
MethodReturn TypeDescription
string()stringFormula result as string
numberDefaultZero()numberNumeric result with 0 default
booleanDefaultFalse()booleanBoolean result with false default
dateRange(){ start: string, end: string }Date range if formula returns date

Mutability: Immutable

rollup().numberDefaultZero()              // Returns number
rollup().dateRange()                      // Returns { start: string, end: string }
rollup().handleSingleUsing(handler)       // Custom handler for first item
rollup().handleArrayUsing(handler)        // Custom handler for all items
MethodReturn TypeDescription
numberDefaultZero()numberNumeric rollup with 0 default
dateRange(){ start: string, end: string }Date range rollup
handleSingleUsing(handler)CustomHandle first array item
handleArrayUsing(handler)CustomHandle full rollup array

Mutability: Immutable

unique_id().number()             // Returns number
unique_id().stringWithPrefix()   // Returns string (e.g., "PROJ-123")
MethodReturn TypeDescription
number()numberOnly the numeric part
stringWithPrefix()stringFull ID with prefix

Mutability: Immutable

created_time().timeString()        // Returns string (ISO timestamp)
last_edited_time().timeString()    // Returns string (ISO timestamp)
MethodReturn TypeDescription
timeString()stringISO timestamp string

Mutability: Immutable

created_by().name()        // Returns string (user or bot name)
last_edited_by().name()    // Returns string (user or bot name)
MethodReturn TypeDescription
name()stringName of user or bot

Mutability: Partial (read-only)

people().names()    // Returns string[]
MethodReturn TypeDescription
names()string[]Array of user/bot names

Mutability: Immutable

Only supports default conversions (raw(), rawWithDefault()).

Use metadata() to access page metadata:

metadata("id")                // Page ID (immutable)
metadata("created_time")      // Creation timestamp (immutable)
metadata("last_edited_time")  // Last edit timestamp (immutable)
metadata("url")               // Page URL (immutable)
metadata("icon")              // Page icon (mutable)
metadata("cover")             // Page cover (mutable)
metadata("in_trash")          // Trash status (mutable)
  • icon
  • cover
  • in_trash
  • is_locked
  • id
  • created_time
  • last_edited_time
  • url
  • public_url
  • parent
  • created_by
  • last_edited_by
  • archived

For complex conversions, use custom handlers:

// Immutable custom handler
rollup().handleArrayUsing((items) => {
  return items.reduce((acc, item) => {
    if (item.type === 'status' && item.status) {
      return acc.concat(item.status.name);
    }
    return acc;
  }, [] as string[]);
})

// Mutable custom handler with composer
rich_text().handleAndComposeUsing({
  handler: (items) => items.map(i => i.plain_text).join('').toUpperCase(),
  composer: (value) => [{ type: 'text', text: { content: value.toLowerCase() } }],
})