Skip to main content

Bearer Token Authentication

All agntdata API endpoints require authentication via Bearer tokens. Include your API key in the Authorization header of every request:
Authorization: Bearer YOUR_API_KEY

How It Works

1

Generate an API Key

Create an API key from the dashboard. Each key is tied to a workspace and has its own credit balance.
2

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.
3

Credits Deducted

Successful requests deduct credits from your workspace balance. The response includes your remaining credits.

Request Example

curl -X GET "https://api.agntdata.dev/v1/linkedin/get-company-details?username=microsoft" \
  -H "Authorization: Bearer agnt_live_abc123..."

Security Best Practices

Never expose API keys in client-side code, public repositories, or logs. Treat them like passwords.
Store API keys in environment variables rather than hardcoding them:
export AGNTDATA_API_KEY=agnt_live_abc123...
Periodically rotate your API keys, especially if you suspect they may have been compromised.
Create separate API keys for development, staging, and production environments.

API Key Format

API keys follow the format agnt_live_ followed by a unique identifier:
agnt_live_abc123def456ghi789...
The agnt_live_ prefix indicates a production key. All keys are 32+ characters for security.

Error Responses

Invalid or missing authentication returns a 401 Unauthorized response:
{
  "success": false,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid or missing API key"
  }
}
Common authentication errors:
Error CodeDescription
UNAUTHORIZEDAPI key is missing, invalid, or revoked
INSUFFICIENT_CREDITSNot 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.