Keys / Fly.io
FLY_API_TOKEN
The Fly.io token flyctl deploys with in CI, and your scripts call the Machines API with.
- Starts with
FlyV1 fm2_- Expires
- you choose with
--expiry; 20 years by default - API
- create, list and revoke, with
fly tokens
Get it
Create one on fly.io/dashboard. The steps aren't recorded yet.
Set it
FLY_API_TOKEN=FlyV1 fm2_...
flyctl reads it when FLY_ACCESS_TOKEN isn't set; elsewhere, the app passes it in. Or keep it out of .env with keypin: keypin run -- npm run dev
Replace it
- Run
fly tokens create deployfor one app, orfly tokens create org, with the same scope as the old token. - Deploy it everywhere that reads
FLY_API_TOKEN. Keep theFlyV1part and the space. - Check that nothing still uses the old token, then find its ID with
fly tokens list, orfly tokens list --scope orgfor an org token, and runfly tokens revoke <id>.
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.