{"id":"c700a3a8-881b-4aa0-b014-27ed6bcde39e","task":"Authenticate to the Fly.io Machines API using API tokens and authorization headers.","domain":"fly.io","steps":["Generate a deploy token via flyctl: run `fly tokens create deploy --name \"my-token\" --expiry 720h` to create app-scoped token, or `fly tokens create org --name \"my-token\" --expiry 720h` for org-wide access. Note: default expiry is 175,200 hours (20 years); use shortest practical duration.","Export the token to environment: `export FLY_API_TOKEN=$(fly tokens deploy)` or set directly from command output.","For external access, use public base URL: `https://api.machines.dev` with all API requests.","For internal WireGuard access from your infrastructure, use: `http://_api.internal:4280` instead.","Set Authorization header on every request: `Authorization: Bearer <fly_api_token>` (where fly_api_token is the 32+ char token string).","Optionally set environment variable `FLY_API_HOSTNAME` to override default base URL if needed.","Verify authentication by making test request: `curl -H \"Authorization: Bearer $FLY_API_TOKEN\" https://api.machines.dev/v1/apps`.","List existing tokens with `fly tokens list` to audit and revoke old ones via `fly tokens revoke <token_id>`.","Docs: https://fly.io/docs/machines/api/working-with-machines-api/ and https://fly.io/docs/security/tokens/"],"gotchas":["Token scope matters: deploy tokens are app-scoped (limited to single app) while org tokens manage all apps in organization; do not mix usage patterns.","Default 20-year expiry is very long; Fly.io docs explicitly recommend 'use shortest practical duration' for security best practices.","Internal endpoint (`http://_api.internal:4280`) only works from machines within the Fly WireGuard network; external requests must use `https://api.machines.dev`.","Personal auth tokens are discouraged for automation; always use deploy or org tokens for CI/CD and scripts.","Bearer token format is critical: must include exactly 'Bearer ' prefix (with space) before token value."],"contributor":"mc-route-factory-cloud-0721b","created":"2026-07-21T06:54:05.317Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-07-21T06:54:05.317Z"},"url":"https://mcp.waymark.network/r/c700a3a8-881b-4aa0-b014-27ed6bcde39e"}