Notion: Retrieve a database
Notion databases.retrieveDatabase: arguments, response, policy and SDK examples.
← Databases operations · Get started
Operation notion.retrieve_database
Provider route: GET /v1/databases/{database_id}. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/notion with npm, or alter-sdk-notion with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { NotionIntegration } from "@alter-ai/notion";
async function execute(input: Parameters<NotionIntegration["databases"]["retrieveDatabase"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new NotionIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.databases.retrieveDatabase(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_notion import NotionIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = NotionIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.databases.retrieve_database(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.database_id | string | Required within parent | ID of a Notion database, a container for one or more data sources. |
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | |
$ (anyOf 1) | Model | Alternative | Expand Create a database — response body — object database — partial Database Object Response |
$ (anyOf 2) | Model | Alternative | Expand Create a database — response body — object database — database Object Response |
Referenced models: Create a database — response body — object database — database Object Response, Create a database — response body — object database — partial Database Object Response
Schemas
Section titled “Schemas”35 more schemas are linked from the tables above, on the schema pages.
Create a database — response body — object database — database Object Response
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: allowed |
cover | JSON | Required within parent | The cover of the database. |
cover (anyOf 1) | Model | Alternative | Expand Update page — response body — object page cover value |
cover (anyOf 2) | null | Alternative | |
created_time | string | Required within parent | The time when the database was created. Format: date-time |
data_sources | array | Required within parent | The data sources of the database. Maximum items: 100 |
data_sources[] | Model | Each item | Expand Create a database — response body — object database data sources item |
database_type | JSON | Required within parent | The type of typed database, such as `tasks`, `projects`, or `skills`, or `null` for a regular database. Create a database accepts `tasks`, `projects`, and `skills`. |
database_type (anyOf 1) | string | Alternative | One of: `tasks`, `projects`, `sprints`, `docs`, `wiki`, `meetings`, `meeting_notes`, `skills`, `github_prs` Known values: tasks, projects, sprints, docs, wiki, meetings, meeting_notes, skills, github_prs |
database_type (anyOf 2) | null | Alternative | |
description | array | Required within parent | The description of the database. Maximum items: 100 |
description[] | Model | Each item | Expand Retrieve a page property item — response body — value Title title |
icon | JSON | Required within parent | The icon of the database. |
icon (anyOf 1) | Model | Alternative | Expand Get agent — response body — icon value |
icon (anyOf 2) | null | Alternative | |
id | string | Required within parent | The ID of the database. Format: uuid |
in_trash | boolean | Required within parent | Whether the database is in the trash. |
is_inline | boolean | Required within parent | Whether the database is inline. |
is_locked | boolean | Required within parent | Whether the database is locked from editing in the Notion app UI. |
last_edited_time | string | Required within parent | The time when the database was last edited. Format: date-time |
object | string | Required within parent | The database object type name. Must equal: database |
parent | Model | Required within parent | Expand Create a database — response body — object database parent The parent of the database. This is typically a page, block, or workspace, but can be another database in the case of wikis. |
public_url | JSON | Required within parent | The public URL of the database if it is publicly accessible. |
public_url (anyOf 1) | string | Alternative | |
public_url (anyOf 2) | null | Alternative | |
show_data_source_title | boolean | Required within parent | Whether the data source title is shown above the database's views, matching the Show data source title toggle in the Notion app. Full-page databases with one data source don't show this title even when this is `true`. |
title | array | Required within parent | The title of the database. Maximum items: 100 |
title[] | Model | Each item | Expand Retrieve a page property item — response body — value Title title |
url | string | Required within parent | The URL of the database. |
Referenced models: Create a database — response body — object database data sources item, Update page — response body — object page cover value, Get agent — response body — icon value, Create a database — response body — object database parent, Retrieve a page property item — response body — value Title title
Create a database — response body — object database — partial Database Object Response
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: allowed |
id | string | Required within parent | The ID of the database. Format: uuid |
object | string | Required within parent | The database object type name. Must equal: database |
Create a database — response body — object database data sources item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: allowed |
id | string | Required within parent | The ID of the data source. Format: uuid |
name | string | Required within parent | The name of the data source. |
sync_metadata | object | Optional | Sync identity and available health, included when retrieving a database. Additional keys: allowed |
sync_metadata.external_collection_type | string | Optional | The provider of a legacy synced data source: Jira or Salesforce. Values are case-sensitive. Known values: Jira, Salesforce |
sync_metadata.external_database_sync | object | Optional | Stored identity of an external database sync. Additional keys: allowed |
sync_metadata.external_database_sync.provider | string | Required within parent | The sync provider: github (GitHub), jira (Jira), or salesforce (Salesforce). Known values: github, jira, salesforce |
sync_metadata.external_database_sync.sync_id | string | Required within parent | The stored sync ID. This is not a credential. Format: uuid |
sync_metadata.health | JSON | Optional | Live collection sync health. Null means unavailable, not unhealthy. Missing timestamps are unknown. |
sync_metadata.health (anyOf 1) | null | Alternative | |
sync_metadata.health (anyOf 2) | Model | Alternative | Expand Create a data source — response body — object data_source / sync_metadata / health / ok False, stage: backfilling, initializing, steady |
sync_metadata.health (anyOf 3) | Model | Alternative | Expand Create a data source — response body — object data_source / sync_metadata / health / ok True, stage: backfilling, initializing, steady |
sync_metadata.health (anyOf 4) | object | Alternative | Additional keys: allowed |
sync_metadata.health (anyOf 4).paused | boolean | Required within parent | Must equal: true |
sync_metadata.owner_user_id | string | Optional | Notion user who owns the sync credential, included when health is available. Format: uuid |
sync_metadata.resource | string | Optional | Provider resource synced to this data source, when available. |
sync_metadata.sync_id | string | Optional | The stored sync ID when provider details are unavailable. This is not a credential. Format: uuid |
sync_metadata.sync_state | Model | Optional | Expand Create a data source — response body — object data source sync metadata sync state |
sync_metadata.synced_collection_key | string | Optional | Opaque, developer-defined collection key for a worker sync. It is not a globally unique ID or a credential. Worker status is not included. |
Referenced models: Create a data source — response body — object data_source / sync_metadata / health / ok False, stage: backfilling, initializing, steady, Create a data source — response body — object data_source / sync_metadata / health / ok True, stage: backfilling, initializing, steady, Create a data source — response body — object data source sync metadata sync state
Update page — response body — object page cover value
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | |
$ (anyOf 1) | Model | Alternative | Expand Update page — response body — object page cover value File |
$ (anyOf 2) | Model | Alternative | Expand Update page — response body — object page cover value External |
Referenced models: Update page — response body — object page cover value External, Update page — response body — object page cover value File
Get agent — response body — icon value
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | |
$ (anyOf 1) | Model | Alternative | Expand Get agent — response body — icon value Emoji |
$ (anyOf 2) | Model | Alternative | Expand Get agent — response body — icon value File |
$ (anyOf 3) | Model | Alternative | Expand Get agent — response body — icon value External |
$ (anyOf 4) | Model | Alternative | Expand Get agent — response body — icon value Custom Emoji |
$ (anyOf 5) | Model | Alternative | Expand Get agent — response body — icon value Icon |
Referenced models: Get agent — response body — icon value Custom Emoji, Get agent — response body — icon value Emoji, Get agent — response body — icon value External, Get agent — response body — icon value File, Get agent — response body — icon value Icon
Get agent — response body — icon value Emoji
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: allowed |
emoji | string | Required within parent | The emoji character used as the icon. |
type | string | Required within parent | Type of icon. In this case, an emoji. Must equal: emoji |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: notion.retrieve_database. Catalog operation: retrieve_database. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Pinned headers: {"Notion-Version": "2026-03-11"}