Skip to content

BusHero/Notion-Sharp

Repository files navigation

Notion-SDK

Unnoficial SDK for around Notion API

Installation

The project is avaiable on Nuget

dotnet add package Notion.Sharp

Usage

The first step for using the SDK is to initialize the client with the Bearer Token and the Notion API Version. You should create a notion integration to get a bearer token.

string bearerToken = BEARER_TOKEN;
string apiVersion = "2021-08-16";
INotion client = Notion.GetClient(bearerToken, apiVersion);

Endpoints

Each notion api endpoint has a corresponding method associated with it

Name Method
Query a database QueryDatabaseAsync
Create a database CreateDatabaseAsync
Update database UpdateDatabaseAsync
Retrieve a database GetDatabaseAsync
List databases (deprecated) GetDatabasesAsync
Retrieve a page GetPageAsync
Create a page CreatePageAsync
Update page UpdatePageAsync
Retrieve a page property item GetPagePropertyAsync
Retrieve a block GetBlockAsync
Update a block UpdateBlockAsync
Retrieve block children GetBlocksChildrenAsync
Append block children AppendBlockChildrenAsync
Delete a block DeleteBlockAsync
Retrieve a user GetUserAsync
List all users GetUsersAsync
Retrieve your token's bot user GetMeAsync
Search SearchAsync

Examples

Make a request to any endpoint

PaginationList<User> users = await client.GetUsersAsync();