Authentication
Learn how to authenticate your API requests and manage your API keys securely.
Getting Your API Key
To use the Assisters API, you need an API key. Here's how to get one:
- Create an account at assisters.dev/signup
- Navigate to your API Keys dashboard
- Click "Create New Key" and give it a descriptive name
- Copy your API key immediately - it won't be shown again
Using Your API Key
Include your API key in the Authorization header of every request:
Authorization: Bearer YOUR_API_KEYExample Request
curl https://api.assisters.dev/v1/chat/completions \
-H "Authorization: Bearer asst_sk_..." \
-H "Content-Type: application/json" \
-d '{"model": "assisters-chat-v1", "messages": [{"role": "user", "content": "Hello"}]}'Security Best Practices
Never expose your API key
API keys should never be included in client-side code, public repositories, or shared publicly. Treat them like passwords.
Use Environment Variables
Store your API key in environment variables, not in code.
ASSISTERS_API_KEY=asst_sk_...Rotate Keys Regularly
Create new keys periodically and revoke old ones. If you suspect a key is compromised, revoke it immediately from your dashboard.
Use Key Scoping (Coming Soon)
Create keys with limited permissions for specific use cases. For example, a read-only key for analytics or a key that only works with certain models.
Monitor Usage
Check your API usage regularly in the dashboard. Set up alerts for unusual activity.
SDK Authentication
Our official SDKs handle authentication automatically:
from assisters import Assisters
import os
# Option 1: Pass directly
client = Assisters(api_key="asst_sk_...")
# Option 2: Use environment variable (recommended)
# Set ASSISTERS_API_KEY in your environment
client = Assisters() # Reads from ASSISTERS_API_KEYimport Assisters from 'assisters';
// Option 1: Pass directly
const client = new Assisters({ apiKey: 'asst_sk_...' });
// Option 2: Use environment variable (recommended)
// Set ASSISTERS_API_KEY in your environment
const client = new Assisters(); // Reads from ASSISTERS_API_KEYAuthentication Errors
| Error Code | Meaning | Solution |
|---|---|---|
401 | Invalid API key | Check your key is correct and not revoked |
401 | Missing API key | Include Authorization header in request |
403 | Access denied | Your key doesn't have permission for this action |