HTTP status code

HTTP 401 Unauthorized

401 Unauthorized means the request lacks valid authentication. The server expects a login, token or API key.

Reviewed: 6 November 2026
Class
4xx · Client errors
Where the problem is
Problem with the request (client)
Who fixes it
You can often fix it yourself (URL, sign-in, cookies).

What it means

Despite the name, 401 means “unauthenticated”: the server doesn't know who you are, or the credentials are invalid. The response must include a WWW-Authenticate header. If the server knows who you are but won't let you in, the correct code is 403.

Most common causes

  • You're not signed in or your session has expired.
  • An API call without an Authorization header or with an expired token.
  • A wrong username or password with Basic Auth.
  • An incorrect device clock that makes a token look invalid.

What you can do as a visitor

  1. Sign out and sign back in.
  2. Clear the site's cookies if your login doesn't stick.
  3. Check that your device's clock is correct.

Shows the HTTP status, redirect chain, HTTPS and basic SEO signals. Works for public addresses only.

What the site owner or developer should do

  1. Return 401 with WWW-Authenticate for unauthenticated requests, and 403 for missing permissions.
  2. Check token expiry and refresh (refresh tokens).
  3. In APIs, return a clear message: missing, invalid or expired key.

Impact on SEO and Google

Google doesn't index login pages that return 401. Don't put public content behind a 401 if you want it to appear in search.

Frequently asked questions

What's the difference between 401 and 403?

401: you're not authenticated. 403: you're authenticated (or it doesn't matter), but access is forbidden.

Why am I getting a 401 from an API?

Most often the Authorization header is missing or the token has expired.

Sources