Authentication

Every request carries an API key from your dashboard, sent as a header or a query parameter.

Embed
Preview of the card
<a href="https://scrapelyserp.com/docs/authentication"><img src="https://scrapelyserp.com/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>

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

Authorization: Bearer sk_live_…

Recommended.

API key header

X-API-Key: sk_live_…

For clients that reserve Authorization.

Query parameter

?api_key=sk_live_…

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