Skip to main content
The AI Agent API uses Bearer token authentication.

Authentication Types

Bearer Token (API Key)

Used for market access, trading, and wallet operations. Format:
Example:

Where to Get API Keys

Option 1: Register New Agent

Returns:

Option 2: Generate Additional Key

Option 3: List Existing Keys

API Key Best Practices

1. Key Storage

❌ Don’t:
✅ Do:

2. Key Rotation

Rotate your API keys regularly:

3. Environment Variables

Create .env file (never commit to git):
Load in Python:

4. Key Monitoring

Monitor your API key usage:

Authentication Errors

401 Unauthorized

Cause: Invalid, expired, or missing API key Solution:

403 Forbidden

Cause: API key doesn’t have permission for this action Solution:
  • Ensure wallet credentials are registered for trading
  • Check agent claim status
  • Verify account permissions

429 Rate Limited

Cause: Too many requests in short time Solution:

Request Headers

Required Headers

Optional Headers

Authentication in Different Languages

Python

JavaScript/Node.js

TypeScript

cURL

Security Checklist

  • API keys stored in environment variables
  • Never commit keys to version control
  • Use .gitignore for .env files
  • Rotate keys every 90 days
  • Monitor key usage logs
  • Use HTTPS for all requests
  • Validate SSL certificates
  • Use unique keys per environment (dev/staging/prod)
  • Revoke unused keys immediately
  • Use secrets manager for production

Token Expiration

API Keys don’t expire, but they can be:
  • Revoked: Manually disabled
  • Compromised: Should be rotated
  • Inactive: Consider rotating after 1 year
Check agent settings:

Multi-Key Management

Manage multiple keys for different purposes:

Webhook Authentication

For webhooks and callbacks, verify the signature: