DatabasesAPI
Defined in: src/api/databases.api.ts:147
Databases API client for working with Notion databases.
Extends
Section titled “Extends”BaseAPI<NotionDatabase,Database>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new DatabasesAPI(
client):DatabasesAPI
Defined in: src/api/databases.api.ts:154
Parameters
Section titled “Parameters”client
Section titled “client”NotionClient
Returns
Section titled “Returns”DatabasesAPI
Overrides
Section titled “Overrides”BaseAPI<NotionDatabase, Database>.constructor
Methods
Section titled “Methods”archive()
Section titled “archive()”archive(
databaseId):Promise<Database>
Defined in: src/api/databases.api.ts:287
Move a database to trash (convenience method).
Parameters
Section titled “Parameters”databaseId
Section titled “databaseId”string
The ID of the database to trash
Returns
Section titled “Returns”Promise<Database>
The trashed database wrapped in a Database model
create()
Section titled “create()”create(
options):Promise<Database>
Defined in: src/api/databases.api.ts:223
Create a new database.
Parameters
Section titled “Parameters”options
Section titled “options”CreateDatabaseOptions
Options for creating the database
Returns
Section titled “Returns”Promise<Database>
The created database wrapped in a Database model
Throws
Section titled “Throws”If not exactly one of database_type/initial_data_source is provided
https://developers.notion.com/reference/create-a-database
query()
Section titled “query()”query(
databaseId,options?):Promise<PaginatedList<Page>>
Defined in: src/api/databases.api.ts:185
Query a database with optional filters and sorts. Returns pages that match the query.
Parameters
Section titled “Parameters”databaseId
Section titled “databaseId”string
The ID of the database to query
options?
Section titled “options?”QueryDatabaseOptions
Query options (filter, sorts, pagination)
Returns
Section titled “Returns”Promise<PaginatedList<Page>>
Paginated list of pages from the database
https://developers.notion.com/reference/post-database-query
restore()
Section titled “restore()”restore(
databaseId):Promise<Database>
Defined in: src/api/databases.api.ts:276
Restore a trashed database (convenience method).
Parameters
Section titled “Parameters”databaseId
Section titled “databaseId”string
The ID of the database to restore
Returns
Section titled “Returns”Promise<Database>
The restored database wrapped in a Database model
retrieve()
Section titled “retrieve()”retrieve(
databaseId,options?):Promise<Database>
Defined in: src/api/databases.api.ts:167
Retrieve a database by ID.
Parameters
Section titled “Parameters”databaseId
Section titled “databaseId”string
The ID of the database to retrieve (with or without dashes)
options?
Section titled “options?”RetrieveDatabaseOptions
Options for filtering properties
Returns
Section titled “Returns”Promise<Database>
The database wrapped in a Database model
https://developers.notion.com/reference/retrieve-a-database
trash()
Section titled “trash()”trash(
databaseId):Promise<Database>
Defined in: src/api/databases.api.ts:266
Move a database to trash (convenience method).
Parameters
Section titled “Parameters”databaseId
Section titled “databaseId”string
The ID of the database to trash
Returns
Section titled “Returns”Promise<Database>
The trashed database wrapped in a Database model
update()
Section titled “update()”update(
databaseId,options):Promise<Database>
Defined in: src/api/databases.api.ts:252
Update a database’s properties, title, description, or trash status.
Parameters
Section titled “Parameters”databaseId
Section titled “databaseId”string
The ID of the database to update
options
Section titled “options”UpdateDatabaseOptions
Options for updating the database
Returns
Section titled “Returns”Promise<Database>
The updated database wrapped in a Database model