Skip to main content

Authentication

Learn how to authenticate your requests to the BrilliantAI API.

API Keys

All requests to BrilliantAI API must be authenticated using API keys. You can obtain your API key from the BrilliantAI Dashboard.

API Key Best Practices

  1. Keep it Secret: Never share your API key or commit it to version control
  2. Use Environment Variables: Store your API key in environment variables
  3. Rotate Regularly: Rotate your API keys periodically for security
  4. Separate Keys: Use different API keys for development and production

Using Your API Key

HTTP Header

Include your API key in the Authorization header:

Authorization: Bearer your-api-key

Client Libraries

Node.js

import OpenAI from "openai";

const openai = new OpenAI({
baseURL: "https://api.brilliantai.co",
apiKey: process.env.BRILLIANTAI_API_KEY
});

Python

from openai import OpenAI

client = OpenAI(
base_url="https://api.brilliantai.co",
api_key=os.getenv("BRILLIANTAI_API_KEY")
)

Rate Limits

  • 1000 requests per minute

Error Handling

Common authentication errors:

  • 401 Unauthorized: Invalid API key
  • 403 Forbidden: Valid API key but insufficient permissions
  • 429 Too Many Requests: Rate limit exceeded

Next Steps