Authentication
Learn how to authenticate your API requests.
API Key Authentication
ScraperCompany uses API key authentication. Include your API key in the x-api-key header of every request.
Header Format
x-api-key: YOUR_API_KEYExample Request
curl -X POST "https://api.scrapercompany.com/v1/search" \
-H "x-api-key: sk_live_abc123..." \
-H "Content-Type: application/json" \
-d '{"name": "Hilton Chicago", "city": "Chicago"}'Getting Your API Key
To get your API key:
- Sign in to your account
- Navigate to your dashboard
- Find your API key in the "API Access" section
- Copy the key (starts with
sk_) and store it securely
⚠️ Security Warning
Never commit your API key to version control or expose it in client-side code. Always use environment variables and keep your key secret.
API Key Types
ScraperCompany provides different key types for different environments:
- Live Keys (
sk_live_...) — Use in production - Test Keys (
sk_test_...) — Use for development and testing
Best Practices
1. Use Environment Variables
Store your API key in environment variables:
# .env file
SCRAPERCOMPANY_API_KEY=sk_live_abc123...Then access it in your code:
# Python
import os
api_key = os.environ["SCRAPERCOMPANY_API_KEY"]
# Node.js
const apiKey = process.env.SCRAPERCOMPANY_API_KEY;2. Rotate Keys Regularly
Generate new API keys periodically and revoke old ones from your dashboard.
3. Use Different Keys for Different Environments
Use separate API keys for development, staging, and production environments.
4. Monitor Key Usage
Track which keys are making requests in your dashboard to detect unauthorized usage.
Error Responses
If authentication fails, you'll receive a 401 Unauthorized response:
{
"detail": "Invalid API key"
}Rate Limiting by Key
Rate limits are applied per API key. Each key has:
- Monthly credit limit based on your plan
- Concurrent request limit based on your plan
- Per-minute sliding window rate limits
See Rate Limits for details.