Keys / Heroku
HEROKU_API_KEY
The Heroku API token the Heroku CLI and your scripts call the Platform API with.
- Starts with
HRKU-- Expires
- you choose, or never
- API
- create, list, update, regenerate and delete authorizations
Get it
Create one on dashboard.heroku.com/account. The steps aren't recorded yet.
Set it
HEROKU_API_KEY=HRKU-...
The Heroku CLI reads it before any stored login; elsewhere, the app passes it in. Or keep it out of .env with keypin: keypin run -- npm run dev
Replace it
- Run
heroku authorizations:create -d "<what it's for>"to create a new long-lived token. It needs an account without SSO. The API Key on your Account settings page also works, but it changes when your password does. - Deploy it everywhere that reads
HEROKU_API_KEY. - Check that nothing still uses the old token, then run
heroku authorizations:revoke <id>. - Or run
heroku authorizations:rotate <id>: the authorization gets a new token, and the old token stops working.
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.