Authentication

Learn how to authenticate your requests to the TalonAI API.

Getting Your API Key

  1. Sign up or log in at portal.talonai.io
  2. Navigate to Settings → API Keys
  3. Click Create New Key
  4. Give your key a descriptive name
  5. Copy the key - it won't be shown again

Using Your API Key

Environment Variable (Recommended)

# .env
TALONAI_API_KEY=your-api-key-here

JavaScript/TypeScript

import { TalonAI } from '@talonai/sdk';

// Automatically uses TALONAI_API_KEY env variable
const talon = new TalonAI();

// Or explicitly pass the key
const talon = new TalonAI({
  apiKey: process.env.TALONAI_API_KEY,
});

Python

from talonai import TalonAI

# Automatically uses TALONAI_API_KEY env variable
talon = TalonAI()

# Or explicitly pass the key
talon = TalonAI(api_key="your-api-key-here")

REST API

curl https://api.talonai.io/v1/analyze \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"content": "Hello world"}'

Security Best Practices

  • Never commit API keys to version control
  • Use environment variables for all environments
  • Rotate keys regularly
  • Use separate keys for development and production
  • Set appropriate rate limits for each key

Keep Your Key Secret

Your API key grants access to your TalonAI account. Never share it publicly or include it in client-side code.