Skip to content

sebastienwitz/NotionAPI

Repository files navigation

Notion API for ChatGPT Actions / OpenWebUI Tools

This is a FastAPI wrapper around the Notion API, intended to serve as an endpoint for ChatGPT Actions and OpenWebUI tools.

Features:

  • List Notion databases
  • List rows (query database)
  • Display page content
  • Create and update pages
  • OpenAPI exposure (auto-generated by FastAPI) for ChatGPT Actions

Getting started

For setup:

  1. Copy .env.example to .env and set NOTION_KEY
  2. Install dependencies: pip install -r requirements.txt
  3. Run locally: uvicorn app.main:app --reload --port 8000

Or use Docker for a development environment with hot-reload:

  1. Create a .env in the project root with your NOTION_KEY (do NOT commit it):
NOTION_KEY=secret_xxx
PORT=8000
  1. Start the dev environment:

On Linux / macOS:

# Make scripts executable first time
chmod +x scripts/dev_up.sh scripts/dev_down.sh
./scripts/dev_up.sh

On Windows (PowerShell):

# From project root
docker compose -f docker-compose.dev.yml up --build

This will:

  • Buideld the Docker image and mount the repository into /app (ensuring that code changes also reflect within the container).
  • Start Uvicorn with --reload, so the server restarts when file changes occur.
  • Expose port 8000 on localhost.

To stop the environment, use:

  • Linux / macOS: ./scripts/dev_down.sh
  • Windows PowerShell: docker compose -f docker-compose.dev.yml down Endpoints:
  • GET /health
  • GET /v1/databases
  • GET /v1/databases/{database_id}/rows
  • GET /v1/pages/{page_id}
  • POST /v1/pages
  • PATCH /v1/pages/{page_id}
  • GET /openapi.json (generated by FastAPI)

Deployment: This can be self-hosted wherever Python is supported. Free options include:

  • Render Free tier
  • Fly.io free tier
  • Railway free tier (may require credits)
  • Vercel (with limitations)

Security Tip: Never commit your NOTION_KEY. Instead, use environmental variables or a secret manager.

License: MIT

About

Small Notion API experiments for automation, integrations, and developer workflow exploration.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors