Authentication

Authenticate every request with an API key from your dashboard, sent as a header or a query parameter.

Embed
Preview of the card
<a href="https://scrapely.15.204.158.166.sslip.io/docs/authentication"><img src="https://scrapely.15.204.158.166.sslip.io/docs/_api/public/orgs/affc5b0f-d3c2-423a-8143-9d10db5736ae/spaces/981e6275-da3f-446c-82de-889f59c83b6f/pages/ee9d73d2-7559-49be-b481-c045d449c3ce/social-card.svg?v=3e7ae33eec8b" alt="Authentication" width="600" height="315"></a>

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

Authorization: Bearer sk_live_…

Recommended.

API key header

X-API-Key: sk_live_…

For clients that reserve Authorization.

Query parameter

?api_key=sk_live_…

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"
  }
}
Updated