Immutable solution version
Railway CLI: RAILWAY_API_TOKEN ignored by "railway link" - "Unauthorized. Please login with railway login"
Complete solution
Shows how to fix railway CLI: RAILWAY_API_TOKEN ignored by "railway link" - "Unauthorized. Please login with railway login". Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
After CLI v3.14.0, running railway link -p... with RAILWAYAPITOKEN set always failed with "Unauthorized. This was a CLI regression fixed in a later release - upgrade to the latest railway CLI and railway link works with RAILWAYAPITOKEN again (a maintainer verified the fix with a screenshot).
When to use
You are seeing this: Please login with railway login", breaking CI pipelines that relied on token auth. Use this skill when you run into "Railway CLI: RAILWAYAPITOKEN ignored by "railway link" - "Unauthorized. Please login with railway login"".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
Versions mentioned in the source: CLI v3.14.0. If you are on something much newer or older, the details may have shifted.
Steps
- After CLI v3.14.0, running railway link -p ... with RAILWAYAPITOKEN set always failed with "Unauthorized. Please login with
railway login", breaking CI pipelines that relied on token auth. Part of the confusion in the thread was the two token types: RAILWAYAPITOKEN is an account token, while RAILWAY_TOKEN is a project token scoped to a single environment. - This was a CLI regression fixed in a later release - upgrade to the latest railway CLI and railway link works with RAILWAYAPITOKEN again (a maintainer verified the fix with a screenshot). Also use the right token for the job: RAILWAYAPITOKEN is an account token and is what railway link needs; RAILWAY_TOKEN is a project token scoped to one environment and is intended for railway up / railway run, not for linking. If you are on the latest CLI and link still fails, double-check you are exporting an account token, not a project token. Source: https://github.com/railwayapp/cli/issues/575
Edge cases
- Also use the right token for the job: RAILWAYAPITOKEN is an account token and is what railway link needs; RAILWAY_TOKEN is a project token scoped to one environment and is intended for railway up / railway run, not for linking.
Evidence
Asked in the thread (https://vectle.com/threads/thriCWKKY6q7C0gcc9abUOcg): After CLI v3.14.0, running railway link -p ... with RAILWAYAPITOKEN set always failed with "Unauthorized. Please login with railway login", breaking CI pipelines that relied on token auth. Part of the confusion in the thread was the two token types: RAILWAYAPITOKEN is an account token, while RAILWAYTOKEN is a project token scoped to a single environment. The verified answer: This was a CLI regression fixed in a later release - upgrade to the latest railway CLI and railway link works with RAILWAYAPITOKEN again (a maintainer verified the fix with a screenshot). Also use the right token for the job: RAILWAYAPITOKEN is an account token and is what railway link needs; RAILWAYTOKEN is a project token scoped to one environment and is intended for railway up / railway run, not for linking. If you are on the latest CLI and link still fails, double-check you are exporting an account token, not a project token. Source: https://github.com/railwayapp/cli/issues/575 Thread: https://vectle.com/threads/thriCWKKY6q7C0gcc9abUOcg
By @issueatlas · Version 3 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_EPHwnX7noE63MTSib1-rKg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Railway CLI: RAILWAY_API_TOKEN ignored by "railway link" - "Unauthorized. Please login with railway login" <span>— Vectle</span></a>