Skip to main content
The API key is the access credential of your project. Without a valid key, the API accepts no request.
Every request to the public API (/v1) is authenticated with an API key sent in the Authorization header, in the Bearer scheme:
Each key belongs to a single project. There is no “all projects” key: everything the key reads or writes stays inside that project. To access another project, use its key.

Key format

A partner key, in the format rt_partner_…, is not a project key. It only works on the /v1/partner/* routes and never sends messages. On any project route it gets 401 api_key_invalid, and a project key does not work on partner routes either. See Partner keys.
The key is generated with a cryptographic generator and shown only once, when it is created. Routa stores only a hash of it, so it cannot be recovered later. If you lose the key, create another one and revoke the old one.

What you can do with your keys

  • Create one or more keys per project, each with the minimum scopes the integration needs.
  • Set an expiry date and an IP allowlist for the key.
  • Rotate a key without downtime: the new key is created and the old one stays valid until you revoke it.
  • Revoke a compromised key. Revocation takes effect in about a second.
  • See when each key was last used and spot the idle ones.
Creating, rotating and revoking keys are dashboard actions, on the API keys page, in the Developer group of the sidebar, authenticated by a user session. They do not use an API key.

Scopes

Each key carries a closed set of scopes. A new key starts with the minimum you asked for, never with full access. If a route requires a scope the key lacks, the API responds 403 with the insufficient_scope code.

Scope required by each route

Each endpoint page in the API reference shows the required scope.

Check a key

GET /v1/whoami has no side effects. It returns the organization, the project, the key id and the scopes the key has.
Response

Troubleshooting

The API responds 401 with type: "authentication_error" and the api_key_invalid code. Check, in this order:
  1. The header is exactly Authorization: Bearer <key>, with the word Bearer and one space.
  2. The whole key was copied, with no spaces or line breaks at the start or end.
  3. The key was not revoked and has not expired.
  4. The request comes from an allowed IP, if the key has an IP allowlist.
  5. The environment variable holding the key is set in the process that makes the call.
To test, call the identity endpoint:
The key is valid but lacks the scope the route requires. The error message says which one. The scopes of a key do not change after it is created: create a new key with the scope you need, swap it into your integration and revoke the old one.
A resource of another project responds 404, never 403, so its existence is not revealed. Use GET /v1/whoami to confirm that the key belongs to the right project.
Look at the prefix. rt_live_ is live and rt_test_ is test. See Environments.

Security best practices

Protect your keys

  • Read the key from an environment variable or a secrets manager.
  • Never publish the key in repositories, front ends, mobile apps or logs.
  • Use one key per integration, with the minimum scopes.
  • Rotate keys periodically and revoke any exposed key right away.
The SDK does not read environment variables on its own. Pass the key explicitly: