Keys / PlanetScale
PLANETSCALE_SERVICE_TOKEN
A PlanetScale service token for the CLI and API in CI and scripts. Its permissions are set per organization and per database.
- Expires
- never, unless you set a date or TTL
- API
- create, list and delete, with a service token
Get it
Create one on app.planetscale.com/~/settings/service-tokens. The steps aren't recorded yet.
Set it
PLANETSCALE_SERVICE_TOKEN=...
The pscale CLI reads it, with PLANETSCALE_SERVICE_TOKEN_ID, when you don't pass --service-token. Or keep it out of .env with keypin: keypin run -- npm run dev
Replace it
- On Settings > Service tokens, create a new token and give it the same organization and database permissions as the old one.
- Deploy it, with its new ID in
PLANETSCALE_SERVICE_TOKEN_ID, everywhere that readsPLANETSCALE_SERVICE_TOKEN. - Check that nothing still uses the old token, then click Delete service token on its page.
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.