Authentication
Authenticate every request with an API key from your dashboard, sent as a header or a query parameter.
Authenticate every request with an API key from your dashboard, sent as a header or a query parameter.
API keys
Create and revoke keys in the dashboard under API keys. Keys look like sk_live_… and are shown in full exactly once. Use a separate key per environment or service so you can revoke one without touching the others.
Keep keys server-side: A key spends your credits. Never ship one in browser or mobile code; call Scrapely from your backend.
Sending the key
Three equivalent ways. Headers are preferred: query strings end up in proxy and server logs.
Method | Example | Notes |
|---|---|---|
Bearer header |
| Recommended. |
API key header |
| For clients that reserve |
Query parameter |
| ScraperAPI-compatible. Also accepted in a POST body. |
cURL
curl "https://api.scrapely.dev/v1/account" \
-H "Authorization: Bearer YOUR_API_KEY"Python
import requests
r = requests.get("https://api.scrapely.dev/v1/account", headers={"Authorization": "Bearer YOUR_API_KEY"})
print(r.json()["credit_balance"])Node.js
const res = await fetch('https://api.scrapely.dev/v1/account', {
headers: { Authorization: 'Bearer YOUR_API_KEY' },
});
console.log((await res.json()).credit_balance);When authentication fails
A missing, unknown or revoked key is a 401 with code UNAUTHORIZED. Repeated requests with unknown keys from one address are throttled (429 RATE_LIMITED) to slow down key guessing.
{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or revoked API key.",
"param": "api_key",
"docs": "/docs/errors#unauthorized"
}
}