Docs Menu & Search
Documentation
Authentication
How to create, use, and secure your nabh.cloud API keys.
API Keys
Every request must be authenticated with an API key. Keys are created in the dashboard underAPI Keys, begin with the prefix nbh_, and are tied to your account’s prepaid credits. The full key is shown only once at creation — we store only a SHA-256 hash and cannot recover it later.
Passing Your Key
You can authenticate using either header — both are equivalent:
Authorization: Bearer nbh_...(recommended; works with OpenAI SDKs out of the box)X-API-Key: nbh_...
curl https://api.nabh.cloud/v1/chat/completions \
-H "Authorization: Bearer nbh_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "model": "gpt-oss-20b", "messages": [{"role":"user","content":"Hi"}] }'curl https://api.nabh.cloud/v1/chat/completions \
-H "X-API-Key: nbh_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "model": "gpt-oss-20b", "messages": [{"role":"user","content":"Hi"}] }'Key Management
- Multiple keys — create separate keys per app or environment. Limits are 1 (Free), 5 (Developer), and 50 (Pro).
- Expiry — every key expires: 90 days after it is created unless you pick another date, and at most 365 days ahead. After that it returns
401 AUTHENTICATION_ERROR, so create a new key before then. - Rotation — replaces a key’s secret without downtime: the old key keeps working for 24 hours, with a
Warningheader on its responses, while you switch. The new key keeps the old one’s expiry date. - IP allowlist — restrict a key to specific IP addresses or CIDR ranges. Requests from other IPs are rejected with
IP_NOT_ALLOWED. - Revocation — deactivate a key instantly from the dashboard if it is compromised.
Keeping Keys Safe
- Never embed keys in client-side code, mobile apps, or public repositories.
- Call the API from your backend and keep keys in environment variables or a secrets manager.
- Rotate keys periodically and revoke any key you suspect is leaked — all usage on a key is deducted from your credits.
Authentication Errors
A missing, malformed, expired, or revoked key returns 401 AUTHENTICATION_ERROR:
{
"error": {
"code": "AUTHENTICATION_ERROR",
"message": "Invalid API key"
}
}