@notion-openapi/notion-openapi
v1.2.1
Published
Create a Notion database from your OpenAPI document. Automatically map API endpoints, methods, and parameters into a structured Notion DB.
Downloads
10
Maintainers
Readme
notion-openapi
A utility to create Notion databases from an OpenAPI document. This package automatically generates a structured Notion database, mapping your API endpoints, methods, parameters, and descriptions directly from the OpenAPI spec. Perfect for documenting your API or sharing it with teams in a collaborative, visual format.
Features include:
- Supports OpenAPI 3.x
- Easy authentication with Notion API
- Auto-mapping of endpoints, methods, and parameters to Notion database properties
How to use
- Create a page on Notion
- Create a Notion Integration (leaving the default permissions is fine)
- Get the Token associated with the integration
- Connect the page to the integration
- Install
notion-openapi
npm install notion-openapi # or yarn install notion-openapi # or pnpm install notion-openapi # or bun add notion-openapi
- Write some code
import { NotionOpenapi, getOpenapiFromURL } from 'notion-openapi'; async function main() { try { const openapiUrl = ''; // URL of the openapi v3 JSON const notionToken = ''; // notion token of the integration const notionPageURL = ''; // URL of the notion page // Uses the same options of axios (headers for auth...) const openapi = await getOpenapiFromURL(url); // Uses the same options of @notionhq/client const notionOpenapi = new NotionOpenapi({ auth: notionToken }); const insertedEndpoints = await notionOpenapi.createDBFromOpeanpi({ openapi, pageURL: notionPageURL }); console.log('Inserted endpoints:', insertedEndpoints); } catch (error) { console.error(error); } } main();