LogoToRouter Docs
LogoToRouter Docs
HomepageWhat is ToRouter5-minute quickstartCore concepts
Create your first API keyIP whitelist & blacklist (CIDR)Quota, rate limits & expirationRestrict which models a key can callRotate or revoke a key
API Keys

Rotate or revoke a key

Replace a leaked ToRouter API key, or instantly revoke one you no longer need.

ToRouter does not support regenerating an existing key — the plaintext is hashed at creation time and never recoverable. To rotate, you create a new key, switch traffic over, then delete the old one. Revocation is instant.

Rotate (recommended on any suspected leak)

Create a replacement

API Keys → Create key → same name + -v2 (or your convention) → copy the new sk-***. See Create a key.

Switch your application

Update the OPENAI_API_KEY / ANTHROPIC_API_KEY / GEMINI_API_KEY env var (or equivalent) in every place that uses the old key — .env, secrets manager, CI, Cursor/Cline config.

Roll the deploy. Confirm the new key works by hitting any endpoint:

curl https://portal.torouter.ai/v1/models \
  -H "Authorization: Bearer sk-***"

Delete the old key

API Keys → row of the old key → Delete. The old key returns 401 from the next request onward.

Deletion is immediate and irreversible. Make sure no production traffic still uses the old key.

Revoke (no replacement)

If a key is no longer needed — or you want to kill it right now — just delete it. Any in-flight request finishes; subsequent requests fail with 401.

When to rotate

  • The key appeared in a commit, log, screenshot, support ticket, or chat transcript
  • A teammate with the key left the project
  • Scheduled rotation (e.g. every 90 days for production)
  • The key was issued without restrictions and you now want a scoped replacement

Next steps

IP restrictions

Lock the replacement to known networks.

Quota & rate limits

Add a spend cap.

Blocked key

Diagnose 401/403 errors.

Restrict which models a key can call

Limit a ToRouter API key to a specific list of model IDs. Inherits the group catalog when empty.

Base URL & authentication

Endpoint table for the ToRouter gateway — OpenAI, Anthropic and Gemini protocols, with both /v1 and /api/v1 mount points.

Table of Contents

Rotate (recommended on any suspected leak)Create a replacementSwitch your applicationDelete the old keyRevoke (no replacement)When to rotateNext steps