Keys / Notion
NOTION_API_KEY
The token your app calls the Notion API with: a personal access token or an internal connection's API token.
- Starts with
ntn_- Expires
- you choose, up to 1 year, for personal tokens
- API
- list and revoke personal tokens, with an Admin API token; no create
Get it
Create one on www.notion.so/developers/tokens. The steps aren't recorded yet.
Set it
NOTION_API_KEY=ntn_...
The official JavaScript SDK doesn't read it; your app passes the token in as auth. Or keep it out of .env with keypin: keypin run -- npm run dev
Replace it
- For a personal access token, create a new one with the same workspace and capabilities. For an internal connection, click Refresh on its Configuration tab. The docs don't say how long the old connection token keeps working.
- Deploy the new token everywhere that reads
NOTION_API_KEY. - Check that nothing still uses the old personal token, then revoke it.
Set rotate_every on the key in keypin.toml and a rotated date on its vault item, and keypin status shows when it's due.