Basic Usage
Fetch all items from a database:Type Safety
NotCMS provides full type inference for list results:Next Steps
Get Single Item
Learn to fetch individual items
Client API
Explore the complete Client API
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Query and list multiple items from your Notion databases
const [posts, error] = await nc.query.blog.list();
if (!error) {
posts.forEach(post => {
console.log(post.title);
});
}
// Infer array type
type BlogPosts = typeof nc.query.blog.$inferPages;
// Use in your functions
function processPosts(posts: BlogPosts) {
posts.forEach(post => {
// Full type safety and IDE autocomplete
console.log(post.title);
console.log(post.published);
});
}