{"id":32272572,"url":"https://github.com/jonathangomz/notion_api","last_synced_at":"2026-02-21T08:02:14.492Z","repository":{"id":48349935,"uuid":"369241566","full_name":"jonathangomz/notion_api","owner":"jonathangomz","description":"Notion API client for dart","archived":false,"fork":false,"pushed_at":"2023-08-11T19:02:27.000Z","size":331,"stargazers_count":30,"open_issues_count":8,"forks_count":11,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-02-17T09:46:32.702Z","etag":null,"topics":["dart","notion-api","package","pubdev"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/notion_api","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonathangomz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-20T14:44:55.000Z","updated_at":"2025-08-06T13:30:41.000Z","dependencies_parsed_at":"2022-09-01T17:50:44.126Z","dependency_job_id":null,"html_url":"https://github.com/jonathangomz/notion_api","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/jonathangomz/notion_api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathangomz%2Fnotion_api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathangomz%2Fnotion_api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathangomz%2Fnotion_api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathangomz%2Fnotion_api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonathangomz","download_url":"https://codeload.github.com/jonathangomz/notion_api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathangomz%2Fnotion_api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29676981,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T06:23:40.028Z","status":"ssl_error","status_checked_at":"2026-02-21T06:23:39.222Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["dart","notion-api","package","pubdev"],"created_at":"2025-10-22T23:04:42.530Z","updated_at":"2026-02-21T08:02:14.486Z","avatar_url":"https://github.com/jonathangomz.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"Notion API client for dart.\n\n![CI](https://github.com/jonathangomz/notion_api/actions/workflows/main.yml/badge.svg)\n[![codecov](https://codecov.io/gh/jonathangomz/notion_api/branch/main/graph/badge.svg?token=4XYHP1W8ZY)](https://codecov.io/gh/jonathangomz/notion_api)\n\nSee the [ROADMAP](ROADMAP.md) file to see what is coming next.\n\n- [API implemented](#api-implemented)\n- [Usage](#usage)\n  - [`NotionClient` class](#notionclient-class)\n  - [Individual classes](#individual-classes)\n  - [A few examples](#a-few-examples)\n    - [Append blocks children](#append-blocks-children)\n    - [Create a page](#create-a-page)\n- [Errors](#errors)\n  - [Create page with chidren](#create-page-with-chidren)\n- [Contributions](#contributions)\n  - [Rules](#rules)\n  - [Tests](#tests)\n    - [Example:](#example)\n- [Next release](#next-release)\n  - [v1.2.1:](#v121)\n\n# API implemented\n| Endpoint                | Avaliable  | Notes           \n|:------------------------|:----------:|:-\n| Retrieve a database     |     ✅     |                 \n| Query a database        |     🏗     | Working on it   \n| List databases          |     ✅     | \n| Create a database       |     ✅     | Workin on more properties\n| Retrieve a page         |     ✅     | \n| Create a page           |     ✅     | Workin on more properties\n| Update a page           |     ✅     | Workin on more properties\n| Retrieve block children |     ✅     |\n| Append block children   |     ✅     |\n| Retrieve a user         |            |\n| List all users          |            |\n| Search                  |            |\n\n\n# Usage\n**Important**: The methods return a `NotionResponse`. You can find how to use it in its [documentation][1].\n\n## `NotionClient` class\nYou only have to create a new instance of the `NotionClient` class and all the API requests will be available as class methods.\n```dart\nNotionClient notion = NotionClient(token: 'YOUR SECRET TOKEN FROM INTEGRATIONS PAGE');\n```\n\n## Individual classes\nYou can also use individual request group class like `NotionPagesClient` or `NotionDatabasesClient`. They are used like the main client but the methods are class methods instead of class properties methods.\n\n**Example**\n```dart\n// With main class\nNotionClient notion = NotionClient(token: 'YOUR_TOKEN');\nnotion.databases.fetchAll();\n\n// With individual class\nNotionDatabasesClient databases = NotionDatabasesClient(token: 'YOUR_TOKEN');\ndatabases.fetchAll();\n```\n\n## A few examples\nA page created and filled using only this package: \\\nhttps://jonathangomz.notion.site/notion_api-example-0893dd2cb38a413d90165cb810b3c019\n\n_To see code to create the page above or see more examples [go here](https://github.com/jonathangomz/notion_api/blob/main/example/example.md)._\n\n### Append blocks children\n```dart\n// Create children instance:\nChildren children = Children.withBlocks([\n  Heading(text: Text('Test')),\n  Paragraph(texts: [\n    Text('Lorem ipsum (A)'),\n    Text('Lorem ipsum (B)',\n        annotations: TextAnnotations(\n          bold: true,\n          underline: true,\n          color: ColorsTypes.Orange,\n        ))\n  ])\n]);\n\n// Send the instance to Notion\nnotion.blocks.append(\n  to: 'YOUR_BLOCK_ID',\n  children: children,\n);\n```\n\n### Create a page\n```dart\n// Create a page instance\nPage page = Page(\n  parent: Parent.database(id: 'YOUR_DATABASE_ID'),\n  title: Text('NotionClient (v1): Page test'),\n);\n\n// Send the instance to Notion.\nnotion.pages.create(page);\n```\n\n# Errors\nSome errors that I have encounter and still don't know how to solve because are errors that also occur on Postman are:\n## Create page with chidren\nWhen the parent is a page the error is:\n```json\n\"body failed validation: body.properties.title.type should be an array, instead was `\\\"array\\\"`.\"\n```\nBut when the parent is a database then the error is:\n```json\n\"body failed validation: body.parent.page_id should be defined, instead was `undefined`.\"\n```\nYou can create the page first and then add the children as shown in the examples.\n\n# Contributions\nPlease help, I don't even know if what I'm doing is right.\n\n## Rules\nSome rules to follow:\n1. Please follow the dart convention format:\n   1. [Effective dart](https://dart.dev/guides/language/effective-dart)\n   2. [`dart format`](https://dart.dev/tools/dart-format)\n2. If you are adding a new function, please also add the documentation.\n3. If you are adding a new parameters, please also add it to the current documentation.\n4. (**Optional**) Run the tests to know that everything is working just fine ([See how run the tests](#tests)).\n   * This is optional because sometimes the tests fail on GitHub actions so anyway I will check this on my computer.\n\n## Tests\nTo be able to run the tests you will have to have a `.env` file on the root directory with the next variables:\n* TOKEN: The secret token.\n* TEST_DATABASE_ID: The database id where you will be working on.\n* TEST_PAGE_ID: Some page id inside the database specified above.\n* TEST_BLOCK_ID: Some block id inside the page specified above.\n* TEST_BLOCK_HEADING_ID: Some heading block id inside the page specified above.\n\n### Example:\n_The values are not valid of course._\n```\nTOKEN=secret_Oa24V8FbJ49JluJankVOQihyLiMXwqSQeeHuSFobQDW\nTEST_DATABASE_ID=366da3d646bb458128071fdb2fbbf427\nTEST_PAGE_ID=c3b53019-4470-443b-a141-95a3a1a44g60\nTEST_BLOCK_ID=c8hac4bb32af48889228bf483d938e34\nTEST_BLOCK_HEADING_ID=c8hac4bb32af48889228bf483d938e34\n```\n\n# Next release\n## v1.2.1:\n\u003e Release date: 02/Aug/2021\n* Add constructors with only single text content with default style for:\n  * `Paragraph.text('some text here...')`\n  * `ToDo.text('some text here...', checked: true)`\n  * `Heading.text('some text here...', type: 2)`\n  * `BulletedListItem.text('some text here...')`\n  * `NumberedListItem.text('some text here...')`\n  * `Toggle.text('some text here...', children: [])`\n* Add more constructors for `Heading` class:\n  * `one`: Heading with type 1 by default.\n  * `two`: Heading with type 2 by default.\n  * `three`: Heading with type 3 by default.\n* Add more constructors for `Text` class:\n  * `code`: Text with code style by default.\n  * `italic`: Text with italic style by default.\n  * `bold`: Text with bold style by default.\n  * [**Opt**] `list`: List of words separated by comma (by default).\n    * Example: `Text.list()` will receive a list of Text and will be concatenated separated with comma by default. **It may be unnecessary**. Can help to make the code more readable.\n  * [**Opt**] `sep`: Text separator.\n    * Example: `Text.sep()`, by default, will insert \" \" in a list of `Text` instances, but it will be able to do more things that I don't know yet, hehe. **It may be unnecessary**. Can help to make the code more readable.\n\n[1]:https://pub.dev/documentation/notion_api/1.0.0-beta1/responses_notion_response/NotionResponse-class.html","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathangomz%2Fnotion_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonathangomz%2Fnotion_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathangomz%2Fnotion_api/lists"}