Which token works where
Routy has two kinds of token you can hand to a script, a service or an AI assistant. They are made in different places, they are sent differently, and they are accepted by different parts of the API. Mixing them up is the most common reason an integration that "has a valid token" keeps getting refused.
A third kind, the connected app, is what Claude or ChatGPT gets when you add Routy as a connector and click Allow. There is nothing to copy, and it only works for that assistant.
Send each token the right way
An API token must be sent with ApiKey, never with Bearer.
Authorization: ApiKey Qk9vM3J5VGtwc2ZYMmJ6dUx3PT1leGFtcGxl1A8=
Bearer is for personal access tokens and for a signed-in session. An API
token sent as Bearer is read as a session, fails, and comes back as a plain
401 with no explanation.
A personal access token is accepted either way:
Authorization: Bearer rpat_โฆ
Authorization: ApiKey rpat_โฆ
Where each one is accepted
Three rules follow from the table:
- Personal access tokens are managed only by you, signed in. No token, of any kind, can create, edit or revoke one.
- Your own user's settings need you, signed in. A token, even a personal
one, can't change a password or a profile. For "who am I?" with an API token,
ask for your account (
/v1/my/account), not your user. - The older API (paths without
/v1/) takes neither kind of token. It accepts only a signed-in session. If an integration is calling an address without/v1/, move it to the/v1/equivalent before giving it a token.
Choosing an affiliate
If you work on more than one affiliate, the two tokens behave differently:
- An API token always works on the one affiliate it was made in. An
x-affiliate-idheader is ignored, not refused. If a request with an API token returns another affiliate's data than you expected, this is why: make the token in the affiliate you want. - A personal access token that can reach several affiliates must say which
one, on every request, with the
x-affiliate-idheader. Leave it out and the request is refused with a 400 that lists the affiliates the token can use. A token limited to one affiliate uses it automatically.
Reading a refusal
A 401 never says which rule was broken, so check the header form first: it is the most common cause.
When to contact support
- A token is sent the right way, to a
/v1/address, has the permission, and is still refused. - A request with an API token returns data from an affiliate other than the one the token was made in.