Skip to main content

Overview

Updates the properties of an existing database. You can modify the title, description, icon, cover, parent, inline status, trash status, and lock status.
const database = await notion.databases.update({
  database_id: '897e5a76-ae52-4b48-a6d4-0b46543ebcda',
  title: [
    {
      type: 'text',
      text: { content: 'Updated Database Title' }
    }
  ],
  description: [
    {
      type: 'text',
      text: { content: 'New description' }
    }
  ]
})

Parameters

database_id
string
required
The ID of the database to update.
title
array
The updated title of the database as an array of rich text objects. If not provided, the title will not be updated.
description
array
The updated description of the database as an array of rich text objects. If not provided, the description will not be updated.
is_inline
boolean
Whether the database should be displayed inline in the parent page. If not provided, the inline status will not be updated.
icon
object
The updated icon for the database. Can be an emoji, external URL, or file upload. If not provided, the icon will not be updated.
cover
object
The updated cover image for the database. Can be an external URL or file upload. If not provided, the cover will not be updated.
in_trash
boolean
Whether the database should be moved to or from the trash. If not provided, the trash status will not be updated.
is_locked
boolean
Whether the database should be locked from editing in the Notion app UI. If not provided, the locked state will not be updated.
parent
object
The parent page or workspace to move the database to. If not provided, the database will not be moved.
auth
string
Optional authentication token to override the client’s default token for this request.

Response

Returns a DatabaseObjectResponse or PartialDatabaseObjectResponse with the updated properties.
object
string
Always database.
id
string
The ID of the database.
title
array
The updated title of the database.
description
array
The updated description of the database.
is_inline
boolean
The updated inline status.
in_trash
boolean
The updated trash status.
is_locked
boolean
The updated locked status.
parent
object
The updated parent of the database.
icon
object
The updated icon.
cover
object
The updated cover image.
last_edited_time
string
ISO 8601 timestamp when the database was last edited (updated).

Examples

Update database title and description

const database = await notion.databases.update({
  database_id: '897e5a76-ae52-4b48-a6d4-0b46543ebcda',
  title: [
    {
      type: 'text',
      text: { content: 'Project Tasks - 2024' }
    }
  ],
  description: [
    {
      type: 'text',
      text: { content: 'All tasks for the current year' }
    }
  ]
})

console.log('Updated:', database.title[0].plain_text)

Update database icon and cover

const database = await notion.databases.update({
  database_id: 'database-id',
  icon: {
    type: 'emoji',
    emoji: '📊'
  },
  cover: {
    type: 'external',
    external: {
      url: 'https://images.unsplash.com/photo-1557682250-33bd709cbe85'
    }
  }
})

Move database to trash

const database = await notion.databases.update({
  database_id: 'database-id',
  in_trash: true
})

console.log('Database moved to trash')

Restore database from trash

const database = await notion.databases.update({
  database_id: 'database-id',
  in_trash: false
})

console.log('Database restored from trash')

Lock database

const database = await notion.databases.update({
  database_id: 'database-id',
  is_locked: true
})

console.log('Database is now locked')

Move database to different parent

const database = await notion.databases.update({
  database_id: 'database-id',
  parent: {
    type: 'page_id',
    page_id: 'new-parent-page-id'
  }
})

console.log('Database moved to new parent')

Toggle inline status

const current = await notion.databases.retrieve({
  database_id: 'database-id'
})

const updated = await notion.databases.update({
  database_id: 'database-id',
  is_inline: !current.is_inline
})

console.log(`Inline status changed to: ${updated.is_inline}`)
All update parameters are optional. Only the properties you specify will be updated.

Build docs developers (and LLMs) love