| title | Authentication |
|---|---|
| description | Learn how to authenticate with the ScrapeBadger API using API keys. |
All API requests require authentication using an API key. Learn how to create and manage your keys securely.
[Sign in](https://scrapebadger.com/auth/signin) to your ScrapeBadger account. Go to the [API Keys](https://scrapebadger.com/dashboard/api-keys) page in your dashboard. Click "Create New Key" and give it a descriptive name. Copy your key immediately — it won't be shown again.Include your API key in every request using one of these methods:
Pass your API key in the x-api-key header. This is the recommended method as it keeps your key out of URLs and logs.
curl -X GET "https://scrapebadger.com/v1/twitter/users/elonmusk/by_username" \
-H "x-api-key: sb_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"Alternatively, pass your API key as a query parameter. Note that this method may expose your key in logs and browser history.
curl -X GET "https://scrapebadger.com/v1/twitter/users/elonmusk/by_username?api_key=sb_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"If authentication fails, the API returns one of these status codes:
| Status | Name | Description |
|---|---|---|
401 |
Unauthorized | Missing or invalid API key. Check that you're including the key correctly. |
402 |
Payment Required | Insufficient credits. Purchase more credits to continue making requests. |
403 |
Forbidden | API key is disabled or account is restricted. Contact support if you believe this is an error. |
{
"detail": "Invalid or missing API key"
}From your dashboard, you can:
- Create multiple API keys for different projects
- Rename keys for easier identification
- Enable or disable keys without deleting them
- View usage statistics per key
- Delete keys that are no longer needed