Authentication
Learn how to authenticate your API requests using API keys.
Authentication
The Social Scraper API uses API keys to authenticate requests. You must include your API key in every request to access the API endpoints.
Obtaining an API Key
To get started:
- Sign up for an account at your-domain.com
- Navigate to your dashboard
- Generate a new API key
Keep your API key secure. Never expose it in client-side code or public repositories.
Using Your API Key
Include your API key in the Authorization header of every request:
Authorization: Bearer YOUR_API_KEYExample Request
curl -X GET "https://api.your-domain.com/instagram/profile/username" \
-H "Authorization: Bearer sk_live_abc123..."JavaScript Example
const response = await fetch('https://api.your-domain.com/instagram/profile/username', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
});
const profile = await response.json();API Key Best Practices
| Practice | Description |
|---|---|
| Use environment variables | Store API keys in environment variables, not in code |
| Rotate keys regularly | Generate new keys periodically for security |
| Use separate keys | Use different keys for development and production |
| Monitor usage | Check your dashboard for unusual activity |
Authentication Errors
If your API key is missing or invalid, you'll receive one of these responses:
Missing API Key
{
"error": "unauthorized",
"message": "API key is required"
}Status Code: 401 Unauthorized
Invalid API Key
{
"error": "unauthorized",
"message": "Invalid API key"
}Status Code: 401 Unauthorized
Rate Limits
API keys are subject to rate limiting. See the Errors page for details on rate limit responses.