Keys / OneSignal
ONESIGNAL_REST_API_KEY
The App API key your server calls the OneSignal REST API with, to send messages and manage users for one app.
- Starts with
os_v2_app_- Expires
- the docs don't say
- API
- create, list, update, rotate and delete, with an Organization API key
Get it
Create one on dashboard.onesignal.com. The steps aren't recorded yet.
Set it
ONESIGNAL_REST_API_KEY=os_v2_app_...
No official OneSignal SDK reads it; your app passes it in as restApiKey, as the Node.js SDK's guide does with ONESIGNAL_REST_API_KEY. Or keep it out of .env with keypin: keypin run -- npm run dev
Replace it
- Rotate stops the old key at once. To avoid downtime, create a second key in Settings, Keys & IDs, with the same IP allowlist. An app can have up to 16.
- Deploy it everywhere that reads
ONESIGNAL_REST_API_KEY. Both keys work in the meantime. - Check that nothing still uses the old key, then delete 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.