Skip to main content
Add this header to every request:
Authorization: Bearer nj_sk_YOUR_API_KEY
No OAuth. No tokens to refresh. No SDK required.

Get a key

Developers > API Keys → Add credits ($10 min) → Create key Keys start with nj_sk_ and are shown once. Copy it immediately.

Use it

curl -X POST https://ninjachat.ai/api/v1/chat \
  -H "Authorization: Bearer nj_sk_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-5", "messages": [{"role": "user", "content": "Hello"}]}'

Store your key safely

Never hardcode it. Use environment variables:
export NINJACHAT_API_KEY="nj_sk_YOUR_API_KEY"

Key management

  • You can have up to 5 active keys per account
  • Use separate keys for dev / staging / production
  • Revoke compromised keys instantly from Developers > API Keys
  • Revoked keys stop working immediately

Auth errors

StatusErrorFix
401missing_api_keyAdd Authorization: Bearer nj_sk_... header
401invalid_api_keyCheck key starts with nj_sk_ and isn’t revoked

CORS

All /api/v1/* endpoints allow cross-origin requests. But don’t put your API key in frontend code — proxy through your backend instead.