Authentication
Learn how to authenticate with the Adbot API using API keys or session tokens.
Authentication Methods
The Adbot API supports two authentication methods:
- API Key Authentication - Recommended for server-to-server integrations
- Token Authentication - Cookie-based sessions for web applications
API Key Authentication
API keys are the recommended way to authenticate with the Adbot API for programmatic access.
Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY Example Request
curl -X GET https://api.adbot.fi/api/templates \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" Security Note: Keep your API key secret. Never expose it in client-side code or public repositories.
Obtaining an API Key
To get your API key:
- Log in to your Adbot account at app.adbot.fi
- Navigate to Settings > API
- Click "Generate New API Key"
- Copy and securely store your API key
Token Authentication
For web applications, you can use session-based authentication with login/logout endpoints.
Login
/auth/login Authenticate a user and receive session tokens.
Request Body
{
"email": "user@example.com",
"password": "your_password"
} Response
{
"success": true,
"data": {
"user": {
"id": "usr_123",
"email": "user@example.com",
"name": "John Doe"
},
"accessToken": "eyJhbGciOiJIUzI1NiIs...",
"refreshToken": "eyJhbGciOiJIUzI1NiIs..."
}
} Refresh Token
/auth/refresh Refresh an expired access token using a valid refresh token.
Request Body
{
"refreshToken": "eyJhbGciOiJIUzI1NiIs..."
} Response
{
"success": true,
"data": {
"accessToken": "eyJhbGciOiJIUzI1NiIs...",
"refreshToken": "eyJhbGciOiJIUzI1NiIs..."
}
} Logout
/auth/logout Invalidate the current session.
Response
{
"success": true,
"message": "Successfully logged out"
} Rate Limiting
API requests are rate limited to ensure fair usage. Current limits:
| Plan | Requests per minute | Requests per day |
|---|---|---|
| Free | 60 | 1,000 |
| Pro | 300 | 10,000 |
| Enterprise | 1,000 | Unlimited |
When rate limited, the API returns a 429 Too Many Requests response with headers indicating when you can retry:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1699999999