Skip to main content

Method

client.dataSources.update(parameters: UpdateDataSourceParameters): Promise<DataSourceObjectResponse | PartialDataSourceObjectResponse>
Updates the properties, title, icon, or parent of a data source.

Parameters

data_source_id
string
required
The ID of the data source to update (with or without dashes)
title
RichTextItemRequest[]
New title of the data source as it appears in Notion. Array of rich text objects.
icon
PageIconRequest | null
New icon for the data source. Set to null to remove the icon.
properties
Record<string, PropertyConfiguration | { name: string } | null>
The property schema updates for the data source.
  • To add or update a property, provide its configuration
  • To rename a property, provide { name: "New Name" }
  • To remove a property, set it to null
Each property can have a name and description field along with its type-specific configuration.
archived
boolean
Whether to move the data source to or from the trash. Equivalent to in_trash.
in_trash
boolean
Whether to move the data source to or from the trash. Equivalent to archived.
parent
object
The parent of the data source, when moving it to a different database.
parent.type
string
default:"database_id"
Always database_id
parent.database_id
string
required
The ID of the new parent database
auth
string
Bearer token for authentication. Overrides the client-level auth if provided.

Response

Returns the updated DataSourceObjectResponse or PartialDataSourceObjectResponse.
object
string
Always "data_source"
id
string
The unique identifier of the data source
title
RichTextItemResponse[]
The updated title of the data source
properties
Record<string, DatabasePropertyConfigResponse>
The updated property schema
icon
PageIconResponse | null
The updated icon
last_edited_time
string
ISO 8601 timestamp when the data source was last edited (updated)
last_edited_by
PartialUserObjectResponse
The user who last edited the data source

Examples

Update title and icon

import { Client } from "@notionhq/client"

const notion = new Client({ auth: process.env.NOTION_API_KEY })

const updated = await notion.dataSources.update({
  data_source_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  title: [
    {
      type: "text",
      text: { content: "Updated Data Source" }
    }
  ],
  icon: {
    type: "emoji",
    emoji: "🔄"
  }
})

Add a new property

const updated = await notion.dataSources.update({
  data_source_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  properties: {
    "Priority": {
      select: {
        options: [
          { name: "High", color: "red" },
          { name: "Medium", color: "yellow" },
          { name: "Low", color: "green" }
        ]
      }
    }
  }
})

Rename a property

const updated = await notion.dataSources.update({
  data_source_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  properties: {
    "OldName": {
      name: "NewName"
    }
  }
})

Remove a property

const updated = await notion.dataSources.update({
  data_source_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  properties: {
    "PropertyToRemove": null
  }
})

Move to trash

const archived = await notion.dataSources.update({
  data_source_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  in_trash: true
})

Build docs developers (and LLMs) love