//native
/**
* Retrieve Database
* Get a database by the ID in its URL. Its `data_sources` list gives the data source IDs that Query Data Source and Create Page need.
*/
export async function main(auth: RT.Notion, database_id: string) {
const response = await fetch(
`https://api.notion.com/v1/databases/${database_id}`,
{
headers: {
Authorization: `Bearer ${auth.token}`,
Accept: "application/json",
"Notion-Version": "2026-03-11",
},
}
)
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 4 hours ago