Guide

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:

  1. Create an account at assisters.dev/signup
  2. Navigate to your API Keys dashboard
  3. Click "Create New Key" and give it a descriptive name
  4. Copy your API key immediately - it won't be shown again
Go to API Keys

Using Your API Key

Include your API key in the Authorization header of every request:

HTTP Header
Authorization: Bearer YOUR_API_KEY

Example Request

cURL
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:

Python
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_KEY
Node.js
import 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_KEY

Authentication Errors

Error CodeMeaningSolution
401Invalid API keyCheck your key is correct and not revoked
401Missing API keyInclude Authorization header in request
403Access deniedYour key doesn't have permission for this action

Next Steps