Authentication
All API requests require authentication using an API key.
Getting an API Key
- Register as a merchant at linkbay.io/dashboard/merchant
- Navigate to the API Keys section in your dashboard
- Click "Generate New Key"
- Important: Copy and save your key immediately - it will only be shown once!
Using Your API Key
Include your API key in the X-API-Key header with every request:
cURL Example
curl https://api.linkbay.io/api/v1/merchant/lookup-click?click_id=xyz789 \
-H "X-API-Key: YOUR_API_KEY"JavaScript/TypeScript Example
const response = await fetch(
'https://api.linkbay.io/api/v1/merchant/lookup-click?click_id=xyz789',
{
headers: {
'X-API-Key': process.env.LINKBAY_API_KEY,
},
}
);
const data = await response.json();Python Example
import requests
import os
response = requests.get(
'https://api.linkbay.io/api/v1/merchant/lookup-click',
params={'click_id': 'xyz789'},
headers={'X-API-Key': os.environ['LINKBAY_API_KEY']}
)
data = response.json()Authentication Errors
| Status Code | Error | Description |
|---|---|---|
| 401 | API key required | The X-API-Key header is missing |
| 401 | Invalid API key | The API key is invalid or has been revoked |
| 403 | API key disabled | The API key has been disabled by the owner |
Security Best Practices
- Never expose your API key in client-side code. Always make API calls from your backend server.
- Store your API key in environment variables, not in your codebase.
- Rotate your API keys periodically or if you suspect they've been compromised.
- Use separate API keys for development and production environments.
Key Management
You can manage your API keys from the API Keys section of your dashboard:
- View all active keys
- Generate new keys
- Revoke compromised keys
- View key usage statistics