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:

1

Create an account or sign in

Sign up for a free account or sign in to your existing one.

2

Open the API Keys page

Go to Dashboard > API Keys.

3

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_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6

Making Authenticated Requests

Two equivalent ways to send your key are supported:

  • X-API-Key: sal_your_api_key - API key in its own header
  • Authorization: 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 CodeErrorDescription
401missing_api_keyNo API key in the request
401invalid_api_keyThe API key does not exist or has been revoked
402insufficient_creditsThe 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.

Next Steps