Authentication
Every request carries an API key from your dashboard, sent as a header or a query parameter.
Every request carries an API key from your dashboard, sent as a header or a query parameter.
API keys
Create and revoke keys under Dashboard → Developers → API keys. A key looks like sk_live_… and is shown in full once, when you create it.
Use one key per environment or service, so you can revoke one without touching the others. Every key spends the same account balance.
Keep keys server-side: A key spends your credits. Never put one in browser or mobile code; call Scrapely from your backend and read the key from an environment variable.
Sending the key
Method | Example | Notes |
|---|---|---|
Bearer header |
| Recommended. |
API key header |
| For clients that reserve |
Query parameter |
| Also accepted in a POST body. Query strings end up in logs, so prefer a header. |
cURL
curl "https://api.scrapelyserp.com/v1/account" \
-H "Authorization: Bearer $SCRAPELY_API_KEY"Python
import os
import requests
HEADERS = {"Authorization": f"Bearer {os.environ['SCRAPELY_API_KEY']}"}
r = requests.get(
"https://api.scrapelyserp.com/v1/account",
headers=HEADERS,
)
r.raise_for_status()
data = r.json()
print(data["credit_balance"])Node.js
const res = await fetch(`https://api.scrapelyserp.com/v1/account`, {
headers: { Authorization: `Bearer ${process.env.SCRAPELY_API_KEY}` },
});
const data = await res.json();
console.log(data.credit_balance);When authentication fails
A missing, unknown or revoked key is a 401 UNAUTHORIZED. Repeated failures from one address are throttled with 429 RATE_LIMITED.
{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or revoked API key.",
"param": "api_key",
"docs": "/docs/errors#unauthorized"
}
}