HTTP error
HTTP 401 Unauthorized
HTTP 401 Unauthorized means the request lacks valid authentication credentials. Despite the name, it is about who you are (authentication), not what you may do. A client that is known but not allowed gets 403 instead.
Why a pipeline gets a 401
- The
Authorizationheader is missing, or the secret was not loaded in this environment. - The key or token has expired or was revoked.
- The wrong scheme is used, such as
BasicwhereBeareris expected. - The credential belongs to another environment or workspace.
- A redirect sent the request to another host, and the client dropped the header on the way.
- On a website, the page needs a login, so the data is not public.
A server should send a WWW-Authenticate header that names the scheme it accepts. Read it.
What to do
- Check that the credential reaches the request, is unexpired, and is the right one for this environment.
- Refresh a token and retry once. Do not loop on the same bad credential; repeated failures can lock an account.
- Keep keys out of URLs, logs, screenshots and source control, and load them from your secret store.
- For a website's login wall, do not script a sign-in with someone else's credentials or work around it. Use the official API, or ask for access.
In CleanedWeb
Server requests authenticate with Authorization: Bearer <API_KEY>, using a key from the workspace. A 401 means there was no credential or you are not signed in: supply a valid key. Expired or revoked keys are rejected, so check the key's expiry and revocation state in your workspace. Keys carry scopes (read, run, results); a key that is valid but not tied to a workspace account or lacking permission answers 403.
CleanedWeb reads public pages only, never pages behind a login. For a source that needs a login, a 401 is a limit of the approach, not something to configure around.
Tools and docs
- HTTP status checker See the status code, redirects and headers a URL answers a script with.
- Authentication and limits Create a scoped key, restrict access, and rotate or revoke it.
- Errors and retries What to check first for each status the API returns.
- Troubleshooting Diagnose authentication failures and other rejected requests.
Related terms
-
HTTP 403 Forbidden
The server understood the request and refuses it. Why it happens and how to respond.
-
Cloudflare challenge page
The interstitial a site shows instead of its content. How to recognise it and respond.
-
Web scraping vs API
Scraping pages versus calling an API: when each fits and what scraping costs to maintain.
Build an API from a website
CleanedWeb turns a website into a maintained REST API that returns structured records, with a versioned schema and repairs when the site changes.