Authentication
Every request is authenticated with an API key.
Overview
Send your API key with every request, either in the X-API-Key header or as a Bearer token in the Authorization header. Requests without a valid key get 401 and cost nothing.
Keep your API key secret
Never expose your API key in client-side code or public repositories, and never share it. If it leaks, revoke it immediately from your dashboard.
Getting Your API Key
Follow these steps to obtain your API key:
Open the API Keys page
Go to Dashboard > API Keys.
Generate a new API key
Click "Create New Key", give it a name and copy the generated key. Save it somewhere safe: you will not be able to see it again.
API Key Format
API keys start with sal_ followed by a unique identifier:
sal_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6Making Authenticated Requests
Two equivalent ways to send your key are supported:
X-API-Key: sal_your_api_key- API key in its own headerAuthorization: Bearer sal_your_api_key- Bearer token in the Authorization header
curl "https://api.scrapeadlibrary.com/v1/ads/search?q=nike&country=IT" \
-H "X-API-Key: sal_your_api_key"Authentication Errors
If authentication fails, you receive one of the following error responses:
| Status Code | Error | Description |
|---|---|---|
| 401 | missing_api_key | No API key in the request |
| 401 | invalid_api_key | The API key does not exist or has been revoked |
| 402 | insufficient_credits | The account has no credits left |
Best Practices
Use environment variables
Store your API key in an environment variable, not in your code.
Use different keys for different environments
Create separate API keys for development, staging and production.
Rotate keys periodically
Regularly rotate your API keys to reduce the impact of a leak.
Never expose keys client-side
Call the API from your server, not from browser JavaScript.