{"_rev":"3-4ac47219a3806e4d6bb734b9509c614e","time":{"created":"2025-06-26T11:54:25.008Z","modified":"2025-06-26T11:54:25.504Z","7.3.0":"2025-06-26T10:00:51.225Z","1.0.0":"2025-06-26T11:54:25.266Z"},"_id":"@ahmedelkady/notion-client","name":"@ahmedelkady/notion-client","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@ahmedelkady/notion-client","version":"1.0.0","type":"module","description":"Robust TypeScript client for the unofficial Notion API.","repository":{"type":"git","url":"git+https://github.com/rimonhanna/react-notion-x.git"},"author":{"name":"Travis Fischer","email":"travis@transitivebullsh.it"},"license":"MIT","main":"./build/index.js","module":"./build/index.js","types":"./build/index.d.ts","sideEffects":false,"engines":{"node":">=18"},"scripts":{"build":"tsup","dev":"tsup --watch","watch":"tsup --watch --silent --onSuccess 'echo build successful'","clean":"del build","test":"run-s test:*","test:lint":"eslint .","test:typecheck":"tsc --noEmit","test:unit":"vitest run","release:patch":"npm version patch && npm publish --access public","release:minor":"npm version minor && npm publish --access public","release:major":"npm version major && npm publish --access public"},"dependencies":{"ky":"^1.7.5","notion-types":"workspace:*","notion-utils":"workspace:*","p-map":"^7.0.3"},"_id":"@ahmedelkady/notion-client@1.0.0","gitHead":"3ea6d5661251c3046ded315864f6bf2c9c73ae9b","bugs":{"url":"https://github.com/rimonhanna/react-notion-x/issues"},"homepage":"https://github.com/rimonhanna/react-notion-x#readme","_nodeVersion":"23.1.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-SkKwCUoFz3/NcJG4zWERFKMA1SRi4b77iQNVvC2AK9mXhQ3Jh+oMFlAWXG5ayfti68fKg7NrMLK1ACgXnlaTXQ==","shasum":"9279c66e7d6b94e3d0750e62382ed24087eba013","tarball":"https://registry.npmjs.org/@ahmedelkady/notion-client/-/notion-client-1.0.0.tgz","fileCount":5,"unpackedSize":53552,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBGRKpZVfD4Nqba6OWcYhYdbSwOwwNOSq94rgITQlsk4AiEAxRUfi0xkv9rSiLEsw7dtESYqYl9Lz/3v61M5F5YGTR8="}]},"_npmUser":{"name":"ahmedelkady","email":"ahmed_kady@outlook.com","actor":{"name":"ahmedelkady","email":"ahmed_kady@outlook.com","type":"user"}},"directories":{},"maintainers":[{"name":"ahmedelkady","email":"ahmed_kady@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/notion-client_1.0.0_1750938865089_0.26805533228673717"},"_hasShrinkwrap":false}},"maintainers":[{"name":"ahmedelkady","email":"ahmed_kady@outlook.com"}],"description":"Robust TypeScript client for the unofficial Notion API.","homepage":"https://github.com/rimonhanna/react-notion-x#readme","repository":{"type":"git","url":"git+https://github.com/rimonhanna/react-notion-x.git"},"author":{"name":"Travis Fischer","email":"travis@transitivebullsh.it"},"bugs":{"url":"https://github.com/rimonhanna/react-notion-x/issues"},"license":"MIT","readme":"<p align=\"center\">\n  <img alt=\"React Notion X\" src=\"https://raw.githubusercontent.com/NotionX/react-notion-x/master/media/notion-ts.png\" width=\"689\">\n</p>\n\n# notion-client\n\n> Robust TypeScript client for the unofficial Notion API.\n\n[![NPM](https://img.shields.io/npm/v/notion-client.svg)](https://www.npmjs.com/package/notion-client) [![Build Status](https://github.com/NotionX/react-notion-x/actions/workflows/test.yml/badge.svg)](https://github.com/NotionX/react-notion-x/actions/workflows/test.yml) [![Prettier Code Formatting](https://img.shields.io/badge/code_style-prettier-brightgreen.svg)](https://prettier.io)\n\n## Install\n\n```bash\nnpm install notion-client\n```\n\nThis package is compatible with server-side V8 contexts such as Node.js, Deno, and Cloudflare Workers.\n\n## Usage\n\n```ts\nimport { NotionAPI } from 'notion-client'\n\n// you can optionally pass an authToken to access private notion resources\nconst api = new NotionAPI()\n\n// fetch a page's content, including all async blocks, collection queries, and signed urls\nconst page = await api.getPage('067dd719-a912-471e-a9a3-ac10710e7fdf')\n\n// fetch the data for a specific collection instance\nconst collectionId = '2d8aec23-8281-4a94-9090-caaf823dd21a'\nconst collectionViewId = 'ab639a5a-853e-45e1-9ef7-133b486c0acf'\nconst collectionData = await api.getCollectionData(\n  collectionId,\n  collectionViewId\n)\n```\n\n### Fetch a database's content\n\nYou can pass a database ID to the `getPage` method. The response is an object which contains several important properties:\n\n- `block`\n- `collection`\n- `collection_view`\n\nThe value of the `block` property maps the id of each block object present in the database to its corresponding properties like type, parent id, created time, last edited by, and more. \n\n```\n{\n  block: {\n    'cc368b47-772a-4a1a-a36e-1f52c507d20d': { role: 'reader', value: [Object] },\n    '97dbe6d5-aea3-4e03-b571-91810cf975d4': { role: 'reader', value: [Object] },\n    '08d5ba1e-03d2-4d4a-add7-a414f297ff8a': { role: 'reader', value: [Object] },\n    '7aad4627-c4af-4314-960e-1465e76cc6bd': { role: 'reader', value: [Object] },\n    '7be73360-19b9-4b77-a518-70acd610d492': { role: 'reader', value: [Object] },\n    'af961803-cd0c-470e-bd27-1d025baa2f95': { role: 'reader', value: [Object] },\n    // ...\n  }\n}\n```\n\nThe map of blocks is arranged as followed:\n\n- The first id is of the collection view\n- The second is of the parent page that contains the database in question\n- The next ids are of all the children pages inside the database\n- After that comes all the children blocks of each page.\n\n\nPlease note that a block object can take many types: header, text, list, media, and almost any block supported by Notion. It can also be *a page* or a *collection view*.\n\nExample of a block object of type `text`:\n\n```\n{\n  role: 'reader',\n  value: {\n    id: '0377e1a4-dc3d-4daf-99dd-f54f986d932e',\n    version: 1,\n    type: 'text',\n    properties: { title: [Array] },\n    format: { copied_from_pointer: [Object] },\n    created_time: 1655961814278,\n    last_edited_time: 1655961814278,\n    parent_id: '08d5ba1e-03d2-4d4a-add7-a414f297ff8a',\n    parent_table: 'block',\n    alive: true,\n    copied_from: '526d2008-0d0b-46f8-9de1-7411a85bff7b',\n    created_by_table: 'notion_user',\n    created_by_id: '55b29a2b-a8fe-4a11-9f9d-ada341bd922b',\n    last_edited_by_table: 'notion_user',\n    last_edited_by_id: '55b29a2b-a8fe-4a11-9f9d-ada341bd922b',\n    space_id: '6b70425f-211e-4318-80c6-5d093df8f7eb'\n  }\n}\n```\n\nExample of a block object of type `page`:\n\n```\n{\n  role: 'reader',\n  value: {\n    id: 'af961803-cd0c-470e-bd27-1d025baa2f95',\n    version: 31,\n    type: 'page',\n    properties: { '==~K': [Array], 'BN]P': [Array], title: [Array] },\n    content: [\n      '8cbf7053-da37-4d69-8cde-89343baf3623',\n      '0fc1712e-852c-4307-b72b-094dadaa86ba'\n    ],\n    created_time: 1655962200000,\n    last_edited_time: 1655979420000,\n    parent_id: '175482e5-870d-4da8-980c-ead469427316',\n    parent_table: 'collection',\n    alive: true,\n    created_by_table: 'notion_user',\n    created_by_id: '55b29a2b-a8fe-4a11-9f9d-ada341bd922b',\n    last_edited_by_table: 'notion_user',\n    last_edited_by_id: '55b29a2b-a8fe-4a11-9f9d-ada341bd922b',\n    space_id: '6b70425f-211e-4318-80c6-5d093df8f7eb'\n  }\n}\n```\n\nExample of a block object of type `collection_view`:\n```\n{\n  role: 'reader',\n  value: {\n    id: 'cc368b47-772a-4a1a-a36e-1f52c507d20d',\n    version: 5,\n    type: 'collection_view',\n    view_ids: [\n      '028f6968-2a6c-46da-bf43-cb44e6d91765',\n      '77f32047-52dd-422e-93fa-813438087e57'\n    ],\n    collection_id: '175482e5-870d-4da8-980c-ead469427316',\n    format: { collection_pointer: [Object], copied_from_pointer: [Object] },\n    created_time: 1655961814276,\n    last_edited_time: 1656075900000,\n    parent_id: '97dbe6d5-aea3-4e03-b571-91810cf975d4',\n    parent_table: 'block',\n    alive: true,\n    copied_from: '3e3073e9-7aee-481c-b831-765e112ec7b5',\n    created_by_table: 'notion_user',\n    created_by_id: '55b29a2b-a8fe-4a11-9f9d-ada341bd922b',\n    last_edited_by_table: 'notion_user',\n    last_edited_by_id: '55b29a2b-a8fe-4a11-9f9d-ada341bd922b',\n    space_id: '6b70425f-211e-4318-80c6-5d093df8f7eb'\n  }\n}\n```\n\n## Docs\n\nSee the [full docs](https://github.com/NotionX/react-notion-x).\n\n## License\n\nMIT © [Travis Fischer](https://transitivebullsh.it)\n\nSupport my OSS work by <a href=\"https://twitter.com/transitive_bs\">following me on twitter <img src=\"https://storage.googleapis.com/saasify-assets/twitter-logo.svg\" alt=\"twitter\" height=\"24px\" align=\"center\"></a>\n","readmeFilename":"readme.md"}