API Keys Authentication
Learn how to authenticate your API requests using API keys
Overview
API keys are used to authenticate requests to the API. Each key is unique to your account and has specific permissions. All API requests must include an API key in the Authorization header.
Your API keys carry many privileges, so be sure to keep them secure. Do not share your API keys in publicly accessible areas such as GitHub, client-side code, or in your browser's developer tools.
Generating API Keys
You can generate API keys from your dashboard under API Keys section. Each key can be configured with specific permissions and a descriptive name for reference.
- Navigate to the API Keys section - Go to your project dashboard and select "API Keys" from the sidebar
- Click "Generate New Key" - Provide a name and select appropriate permissions for your key
- Store your key securely - The full key is only shown once, so make sure to copy and store it securely
Using API Keys
API keys should be included in the Authorization header using the Bearer scheme:
Authorization: Bearer sk-brz-yourapikeyhere
Examples
Using curl:
curl -X GET "https://browserize.com/api/browsers" \
-H "Authorization: Bearer sk-brz-yourapikeyhere" \
-H "Content-Type: application/json"
Using JavaScript (Node.js):
const axios = require('axios');
const apiKey = 'sk-brz-yourapikeyhere';
axios.get('https://browserize.com/api/browsers', {
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error);
});
Using Python:
import requests
api_key = 'sk-brz-yourapikeyhere'
headers = {
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
}
response = requests.get('https://browserize.com/api/browsers', headers=headers)
data = response.json()
print(data)
API Key Security
Follow these best practices to keep your API keys secure:
- Use environment variables - Store API keys in environment variables, not in your code
- Restrict permissions - Generate keys with only the permissions they need
- Rotate keys regularly - Create new keys and deprecate old ones on a schedule
- Use backend servers - Make API calls from your server, not directly from client-side code
Testing Authentication
You can test if your API key is working correctly with this endpoint:
GET https://browserize.com/api/test
A successful response will look like this:
{
"success": true,
"message": "API key is valid",
"project_id": "proj_123456789"
}
Troubleshooting
Common authentication error responses and how to fix them:
Error | Possible Cause |
---|---|
Missing API key | You didn't include the Authorization header |
Invalid API key | The API key doesn't exist or is incorrectly formatted |
Expired API key | The API key has been revoked or deactivated |
Insufficient permissions | The API key doesn't have permission for the requested operation |
Next Steps
Now that you understand API authentication, you can explore: