{"id":15020958,"url":"https://github.com/notion-dotnet/notion-sdk-net","last_synced_at":"2025-05-16T18:10:04.428Z","repository":{"id":37033765,"uuid":"369718518","full_name":"notion-dotnet/notion-sdk-net","owner":"notion-dotnet","description":"A Notion SDK for .Net","archived":false,"fork":false,"pushed_at":"2025-04-22T00:55:23.000Z","size":845,"stargazers_count":197,"open_issues_count":11,"forks_count":50,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-22T01:32:55.078Z","etag":null,"topics":["api","api-client","csharp","dotnet","hacktoberfest","hacktoberfest2022","hacktoberfest2023","notion","notion-api","notion-dotnet","sdk"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/notion-dotnet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-05-22T04:58:50.000Z","updated_at":"2025-04-19T01:05:28.000Z","dependencies_parsed_at":"2025-01-15T03:52:26.635Z","dependency_job_id":"e8839caf-cb8c-4b3c-b0ea-75dccab5bfe6","html_url":"https://github.com/notion-dotnet/notion-sdk-net","commit_stats":{"total_commits":475,"total_committers":26,"mean_commits":18.26923076923077,"dds":0.2126315789473684,"last_synced_commit":"a9e8c60118b17705116a81d66c1e8fafdec5d4be"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notion-dotnet%2Fnotion-sdk-net","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notion-dotnet%2Fnotion-sdk-net/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notion-dotnet%2Fnotion-sdk-net/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notion-dotnet%2Fnotion-sdk-net/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/notion-dotnet","download_url":"https://codeload.github.com/notion-dotnet/notion-sdk-net/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254582907,"owners_count":22095518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-client","csharp","dotnet","hacktoberfest","hacktoberfest2022","hacktoberfest2023","notion","notion-api","notion-dotnet","sdk"],"created_at":"2024-09-24T19:55:56.654Z","updated_at":"2025-05-16T18:10:04.412Z","avatar_url":"https://github.com/notion-dotnet.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\t\u003ch1\u003eNotion SDK for .Net\u003c/h1\u003e\n\t\u003cp\u003e\n\t\t\u003cb\u003eA simple and easy to use client for the \u003ca href=\"https://developers.notion.com\"\u003eNotion API\u003c/a\u003e\u003c/b\u003e\n\t\u003c/p\u003e\n\t\u003cbr\u003e\n\u003c/div\u003e\n\n[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/notion-dotnet/notion-sdk-net)]()\n[![GitHub](https://img.shields.io/github/license/notion-dotnet/notion-sdk-net)]()\n\n[![Build Status](https://github.com/notion-dotnet/notion-sdk-net/actions/workflows/ci-build.yml/badge.svg)](https://github.com/notion-dotnet/notion-sdk-net/actions/workflows/ci-build.yml)\n[![Build artifacts](https://github.com/notion-dotnet/notion-sdk-net/actions/workflows/build-artifacts-code.yml/badge.svg)](https://github.com/notion-dotnet/notion-sdk-net/actions/workflows/build-artifacts-code.yml)\n[![Publish Code](https://github.com/notion-dotnet/notion-sdk-net/actions/workflows/publish-code.yml/badge.svg)](https://github.com/notion-dotnet/notion-sdk-net/actions/workflows/publish-code.yml)\n[![CodeQL](https://github.com/notion-dotnet/notion-sdk-net/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/notion-dotnet/notion-sdk-net/actions/workflows/codeql-analysis.yml)\n\n[![GitHub last commit](https://img.shields.io/github/last-commit/notion-dotnet/notion-sdk-net)]()\n[![GitHub commit activity](https://img.shields.io/github/commit-activity/w/notion-dotnet/notion-sdk-net)]()\n[![GitHub commit activity](https://img.shields.io/github/commit-activity/m/notion-dotnet/notion-sdk-net)]()\n[![GitHub commit activity](https://img.shields.io/github/commit-activity/y/notion-dotnet/notion-sdk-net)]()\n\n[![GitHub repo size](https://img.shields.io/github/repo-size/notion-dotnet/notion-sdk-net)]()\n[![Lines of code](https://img.shields.io/tokei/lines/github/notion-dotnet/notion-sdk-net)]()\n\nProvides the following packages:\n\n| Package | Downloads | Nuget |\n|---|---|---|\n| Notion.Net | [![Nuget](https://img.shields.io/nuget/dt/Notion.Net?color=success)](https://www.nuget.org/packages/Notion.Net) | [![Nuget](https://img.shields.io/nuget/v/Notion.Net) ![Nuget (with prereleases)](https://img.shields.io/nuget/vpre/Notion.Net)](https://www.nuget.org/packages/Notion.Net) |\n\n\n\n## Installation\n\n.Net CLI\n\n```\ndotnet add package Notion.Net\n```\n\n**Note:** default Notion-Version used by NuGet package versions\n| Package version | Notion-Version |\n| --- | --- |\n| 4.0.0-preview-1.8.21.2022 | 2022-06-28 | \n| 3.0.0+ | 2022-02-22 |\n| 2.0.0+ | 2021-08-16 |\n| 1.0.0+ | 2021-05-13 |\n\n## Usage\n\n\u003e Before getting started, you need to [create an integration](https://www.notion.com/my-integrations) and find the token. You can learn more about authorization [here](https://developers.notion.com/docs/authorization).\n\nImport and initialize the client using the integration token created above.\n\n```csharp\nvar client = NotionClientFactory.Create(new ClientOptions\n{\n    AuthToken = \"\u003cToken\u003e\"\n});\n```\n\nMake A request to any Endpoint. For example you can call below to fetch the paginated list of users.\n\n```csharp\nvar usersList = await client.Users.ListAsync();\n```\n\n## Dependency Injection\n\nLibrary also provides extension method to register NotionClient with Microsoft dependency injection.\n\n```\nservices.AddNotionClient(options =\u003e {\n  options.AuthToken = \"\u003cToken\u003e\";\n});\n```\n\n### Querying a database\n\nAfter you initialized your client and got an id of a database, you can query it for any contained pages. You can add filters and sorts to your request. Here is a simple example:\n\n```C#\n// Date filter for page property called \"When\"\nvar dateFilter = new DateFilter(\"When\", onOrAfter: DateTime.Now);\n\nvar queryParams = new DatabasesQueryParameters { Filter = dateFilter };\nvar pages = await client.Databases.QueryAsync(databaseId, queryParams);\n```\n\nFilters constructors contain all possible filter conditions, but you need to choose only condition per filter, all other should be `null`. So, for example this code would not filter by 2 conditions as one might expect:\n\n```C#\nvar filter = new TextFilter(\"Name\", startsWith: \"Mr\", contains: \"John\"); // WRONG FILTER USAGE\n\n```\n\nTo use complex filters, use class `CompoundFilter`. It allows adding many filters and even nesting compound filters into each other (it works as filter group in Notion interface). Here is an example of filter that would return pages that were due in past month AND either had a certain assignee OR had high urgency:\n\n```C#\nvar selectFilter = new SelectFilter(\"Urgency\", equal: \"High\");\nvar assigneeFilter = new PeopleFilter(\"Assignee\", contains: \"some-uuid\");\nvar dateFilter = new DateFilter(\"Due\", pastMonth: new Dictionary\u003cstring, object\u003e());\n\nvar orGroup = new List\u003cFilter\u003e { assigneeFilter, selectFilter };\nvar complexFiler = new CompoundFilter(\n    and: new List\u003cFilter\u003e { dateFilter, new CompoundFilter(or: orGroup) }\n);\n```\n\n## Supported Endpoints\n\n- [x] Databases\n  - [x] Query a database\n  - [x] Create a database\n  - [x] Update database\n  - [x] Retrieve a database\n- [x] Pages\n  - [x] Retrieve a page\n  - [x] Create a page\n  - [x] Update page\n  - [x] Retrieve page property item\n- [x] Blocks\n  - [x] Retrieve a block\n  - [x] Update a block\n  - [x] Retrieve block children\n  - [x] Append block children\n  - [x] Delete a block\n- [x] Comments\n  - [x] Retrieve comments\n  - [x] Create comment\n- [x] Users\n  - [x] Retrieve a User\n  - [x] List all users\n  - [x] Retrieve your token's bot user\n- [x] Search\n\n## Enable internal logs\nThe library make use of `ILoggerFactory` interface exposed by `Microsoft.Extensions.Logging`. Which allow you to have ability to enable the internal logs when developing application to get additional information.\n\nTo enable logging you need to add the below code at startup of the application.\n\n```csharp\n// pass the ILoggerFactory instance\nNotionClientLogging.ConfigureLogger(logger);\n\n```\n\nYou can set the LogLevel in config file.\n```json\n{\n  \"Logging\": {\n    \"LogLevel\": {\n      \"Notion.Client\": \"Trace\"\n    }\n  }\n}\n```\n\nYou can also refer `examples/list-users` example.\n\n## Contributors\nThis project exists thanks to all the people who contribute.\n\n[![contributor image](https://contrib.rocks/image?repo=notion-dotnet/notion-sdk-net)](https://github.com/notion-dotnet/notion-sdk-net/graphs/contributors)\n\n## Contribution Guideline\n\nHello! Thank you for choosing to help contribute to this open source library. There are many ways you can contribute and help is always welcome. You can read the detailed [Contribution Guideline](https://github.com/notion-dotnet/notion-sdk-net/blob/main/CONTRIBUTING.md) defined here - we will continue to improve it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotion-dotnet%2Fnotion-sdk-net","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnotion-dotnet%2Fnotion-sdk-net","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotion-dotnet%2Fnotion-sdk-net/lists"}