Authentication
Understand how nRouter authentication works, including virtual API keys, Bearer token authorization headers, tenant isolation, and security best practices.
Every request to the nRouter API is authenticated using a virtual API key transmitted as a Bearer token in the Authorization HTTP header.
- Key format: Virtual keys use the
sk-nrouter-*prefix for transparent identification and secret scanner detection. - One-time secret disclosure: Full keys are revealed exactly once during creation and cannot be retrieved again.
- Granular scoping: Bind keys to teams, configure model access controls, set hard budget ceilings, and enforce RPM/TPM rate limits.
- Immediate revocation: Revoking a key rejects new requests instantly while allowing active in-flight calls to complete.
Manage API keys
Your starter Default key is provisioned on Getting Started (/[org]/getting-started) upon email verification (403 EMAIL_NOT_VERIFIED until confirmed).
Generate additional keys in API Keys (/[org]/keys) with optional team scoping, allowed models, rate limits, and budget caps. Pass the key in requests:
curl https://api.nrouter.ai/v1/chat/completions \
-H "Authorization: Bearer $NROUTER_API_KEY" -H "Content-Type: application/json" \
-d '{"model": "gemini-2.5-flash", "messages": [{"role": "user", "content": "Hello"}]}'Official SDKs and OpenAI clients read NROUTER_API_KEY automatically. Key deletion takes effect immediately.
Frequently asked questions
What does an nRouter API key look like?
Keys begin with sk-nrouter- and are revealed once at creation.
I lost my API key. Can I see it again?
No. Keys cannot be re-displayed; generate a replacement and revoke the old key.
What happens when I revoke a key?
New requests are rejected immediately with 401; active in-flight calls finish.
Can I limit a single key's spend or rate?
Yes. Configure dedicated budget caps, RPM/TPM rate limits, and team scoping.
Why did my request return 401?
The invalid_api_key code means the Bearer token was missing, incorrect, or revoked.
Next Steps
- Quick Start — Make your first API call
- Chat Completions — Full API reference
- Budget Controls — Set spending limits on your keys
- Team Management — Manage keys across teams