| title | Authentication |
|---|---|
| description | Authenticate every API request with the x-scrapeunblocker-key header. |
ScrapeUnblocker uses API keys for authentication. Every request must include your key in the x-scrapeunblocker-key HTTP header. Requests without a valid key are rejected.
Your API key is available in your account dashboard:
app.scrapeunblocker.comIf you don't have an account yet, sign up on the pricing page - the free trial does not require a credit card.
Pass the key as a request header:
curl -X POST "https://api.scrapeunblocker.com/getPageSource?url=https://example.com" \
-H "x-scrapeunblocker-key: YOUR_API_KEY"import requests
headers = {"x-scrapeunblocker-key": "YOUR_API_KEY"}
r = requests.post(
"https://api.scrapeunblocker.com/getPageSource",
params={"url": "https://example.com"},
headers=headers,
)const headers = { "x-scrapeunblocker-key": "YOUR_API_KEY" };
const res = await fetch(
"https://api.scrapeunblocker.com/getPageSource?url=https://example.com",
{ method: "POST", headers }
);- Never commit keys to source control. Use environment variables (
.envfiles added to.gitignore). - Never expose keys in client-side code. Browsers and mobile apps can read them. Always proxy requests through your own backend.
- Rotate immediately if leaked. Generate a new key in the dashboard - the old one will keep working for a short grace period.
The recommended way to store your key:
SCRAPEUNBLOCKER_KEY=su_live_xxxxxxxxxxxxxxxximport os
import requests
key = os.environ["SCRAPEUNBLOCKER_KEY"]
r = requests.post(
"https://api.scrapeunblocker.com/getPageSource",
params={"url": "https://example.com"},
headers={"x-scrapeunblocker-key": key},
)const key = process.env.SCRAPEUNBLOCKER_KEY;
const res = await fetch(
"https://api.scrapeunblocker.com/getPageSource?url=https://example.com",
{ method: "POST", headers: { "x-scrapeunblocker-key": key } }
);An unrecognised key returns HTTP 401 Unauthorized with the plain-text body Unauthorized. Common causes:
| Symptom | Likely cause |
|---|---|
401 Unauthorized with valid-looking key |
Trailing whitespace or newline in the header value |
401 Unauthorized for every request |
Key was rotated in dashboard but old key still cached |
401 No valid subscription |
Key is fine - the account has no active plan. Pick one in the dashboard |
400 Missing x-scrapeunblocker-key |
The header was not sent at all (an empty value gives 401, not 400) |
402 (not 401) |
Key and account are fine - quota, credit limit, or a failed payment. See 402 payment required |
403 (not 401) |
Key is valid - the target site blocked the request. See handling failures |
Full breakdown of each case in Errors - 401 unauthorized. If you've checked the above and still see 401, contact support from the help center.