API Token "Not Authorized" Error for Public API and MCP Automation
noobginger
HOBBYOP

5 months ago

I'm experiencing persistent "Not Authorized" errors when attempting to use the Railway public API with API tokens from my account.

Here's what I've done so far:

- I am the Workspace Owner of my account (profile: Ginger, email: denniesework@protonmail.com).

- I generated multiple API tokens from the "Tokens" section of my personal account settings (not from any team or project), making sure to copy each token immediately after creation.

- Each time, I tested the token with the documented GraphQL endpoint:

```

POST https://backboard.railway.com/graphql/v2

Authorization: Bearer <my_token>

{ "query": "query { me { name email } }" }

```

In every case, the response was: { "errors": [ { "message": "Not Authorized", ... } ], "data": null }

- I also injected these tokens into Docker containers and the MCP automation workflow; the result was always an "Invalid API token" or "Not Authorized" error in both logs and direct API use.

- My profile and permission state confirm I'm the workspace/project owner.

- I have already tried revoking, deleting, and re-creating new tokens, waiting several minutes before retrying, and ensured no whitespace or copy issues.

Per https://docs.railway.com/reference/public-api, these tokens should grant full access, but all API requests are failing authorization.

Can you please confirm if there is a known restriction or propagation issue with my account, or review why tokens are being rejected? I can provide example token IDs and full CLI output upon request.

Thank you for your help.

$10 Bounty

4 Replies

noobginger
HOBBYOP

5 months ago

TL;DR - ChatGPT said:

Nothing is actually wrong with your Claude commands.
The Railway API itself is refusing all tokens from your account, which breaks both the Public API and the MCP server. Until Railway fixes that, the cloud-hosted server will keep failing its handshake and Claude won’t offer configure_api_token. Running the MCP locally with an env-var token is the only immediate work-around.


chalumurigirish
HOBBY

5 months ago

I am facing the same issue , is there any fix for that? or does it take some time to use the token?


arthuracn
PRO

2 months ago

Same problem when trying to set the RAILWAY_API_TOKEN in github actions.

This command does not work locally as test: RAILWAY_API_TOKEN=... railway whoami
It asks me to use railway login
I tried both Github and google sign in see if it would affect the programmatic access


robksawyer
FREE

2 months ago

Token Type Mismatch: Railway has different token types:

  • Personal API Tokens: Generated from your personal account settings.

  • Team API Tokens: Generated from a specific team within your account.

Personal API tokens should grant full access to your personal resources. However, some users have reported that personal API tokens don't work with the GraphQL endpoint, and only internal/plugin tokens do.

Use REST API Instead of GraphQL: If you're currently using the GraphQL endpoint, try switching to the REST API, which might have different authentication requirements.

  • Regenerate Tokens: Even though you've tried this, consider regenerating your personal API token and testing again. Ensure you're using the correct token type for your intended operations.

  • Check Token Permissions: Verify that the token has the necessary permissions for the actions you're attempting. Some tokens might have restricted scopes.


Loading...