# notionapi-agent

> Unofficial Notion.so API client.

Latest version **3.0.0** (published 2021-10-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install notionapi-agent
pnpm add notionapi-agent
yarn add notionapi-agent
bun add notionapi-agent
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2021-10-06 |
| First published | 2019-06-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 72.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 112 |
| Author | dragonman225 |
| Maintainers | dragonman225 |
| Keywords | nodejs, notion, api, api-wrapper, api-client |

## Links

- npm: https://www.npmjs.com/package/notionapi-agent
- Repository: https://github.com/dragonman225/notionapi-agent
- Issues: https://github.com/dragonman225/notionapi-agent/issues
- npm.io page: https://npm.io/package/notionapi-agent

## Dependencies (2)

- [@dnpr/logger](https://npm.io/package/@dnpr/logger.md) ^0.2.0
- [@dnpr/make-request](https://npm.io/package/@dnpr/make-request.md) ^0.1.1

## Recent versions

- 3.0.0 (latest) — 2021-10-06
- 3.1.0-bata.1 (beta) — 2022-11-22
- 3.1.0-bata.0 — 2022-11-22
- 2.0.2 — 2021-07-23
- 2.0.1 — 2021-07-23
- 2.0.0 — 2021-07-23
- 1.2.1 — 2021-04-10
- 1.2.0 — 2020-02-27
- 1.1.3 — 2020-01-30
- 1.1.2 — 2020-01-22
- 1.1.1 — 2020-01-22
- 1.1.0 — 2020-01-22
- 1.0.4 — 2020-01-15
- 1.0.3 — 2020-01-15
- 1.0.2 — 2020-01-15
- … 18 more at https://npm.io/package/notionapi-agent/versions

## README

# notionapi-agent

![version](https://img.shields.io/npm/v/notionapi-agent.svg?style=flat-square&color=007acc&label=version) ![language](https://img.shields.io/badge/language-typescript-blue.svg?style=flat-square) ![license](https://img.shields.io/github/license/dragonman225/notionapi-agent.svg?style=flat-square&label=license&color=08CE5D)

Unofficial Node.js API client for [Notion.so](https://www.notion.so).

> ⚠ If you need to use Notion's API in production, I recommend waiting for their official release.

* [CHANGELOG](CHANGELOG.md)
* [API Documentation](https://notionapi.netlify.com/globals.html)

## Installation

```bash
npm install notionapi-agent
```

## Getting Started

### Basic Usage

[![Try notionapi-agent on RunKit](https://badge.runkitcdn.com/notionapi-agent.svg)](https://npm.runkit.com/notionapi-agent)

```typescript
const { createAgent } = require("notionapi-agent")

const agent = createAgent()

async function main() {

  const pageId = "181e961a-eb5c-4ee6-9153-07c0dfd5156d"

  try {
    const result = await agent.getRecordValues({
      requests: [{ id: pageId, table: "block" }]
    })
    console.log(result)
  } catch (error) {
    console.log(error)
  }

}

main()
```

The `result` is always the response of a successful request (HTTP status `200 OK`). If Notion responds with other status code or the request failed, an error is thrown.

### Advanced Usage

There is an [example](documentation/examples/download-page.ts) to demonstrate how to download all blocks of a page.

To access private content, one need the [token](documentation/get-token/get-token.md).

## Development

### Project Structure

![project structure graph](documentation/dependency-graph.svg)

### Documentation

Use [TypeStrong/typedoc](https://github.com/TypeStrong/typedoc) to generate reference documentation. It needs to be installed globally.

```bash
npm i -g typedoc
```

### Packaging

Use [rollup/rollup](https://github.com/rollup/rollup) to package multiple source files into one `cjs` module (`dist/index.js`) and one `esm` module (`dist/index.esm.js`). Use `tsc --emitDeclarationOnly` to generate TypeScript declaration files.

---
_Source: https://npm.io/package/notionapi-agent · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
