Bearer Token Authentication
All agntdata API endpoints require authentication via Bearer tokens. Include your API key in theAuthorization header of every request:
How It Works
Generate an API Key
Create an API key from the dashboard. Each key is tied to a workspace and has its own credit balance.
Include in Requests
Pass the API key as a Bearer token in the Authorization header. The API validates the key and checks your credit balance.
Request Example
Security Best Practices
Keep Keys Secret
Keep Keys Secret
Never expose API keys in client-side code, public repositories, or logs. Treat them like passwords.
Use Environment Variables
Use Environment Variables
Store API keys in environment variables rather than hardcoding them:
Rotate Keys Regularly
Rotate Keys Regularly
Periodically rotate your API keys, especially if you suspect they may have been compromised.
Use Separate Keys for Environments
Use Separate Keys for Environments
Create separate API keys for development, staging, and production environments.
API Key Format
API keys follow the formatagnt_live_ followed by a unique identifier:
agnt_live_ prefix indicates a production key. All keys are 32+ characters for security.
Error Responses
Invalid or missing authentication returns a401 Unauthorized response:
| Error Code | Description |
|---|---|
UNAUTHORIZED | API key is missing, invalid, or revoked |
INSUFFICIENT_CREDITS | Not enough credits to complete request |
Next Steps
Managing API Keys
Learn how to create, rotate, and revoke API keys.
Credits & Billing
Understand how credits work and manage your balance.