// http 4xx · client error

HTTP 401 Unauthorized

Authentication is required or has failed.

What HTTP 401 Unauthorized means

401 Unauthorized means authentication is required and either wasn't provided or failed. Despite the name it's really 'unauthenticated' — the server doesn't know who you are. The response should include a `WWW-Authenticate` header describing how to authenticate.

Which category is it?

401 is a 4xx code — Client error. 4xx means the request has a problem the client must fix — bad syntax, missing authentication, or a resource that isn't there. It's the caller's responsibility.

Common causes

  • Missing `Authorization` header
  • Expired or invalid token or credentials
  • Wrong authentication scheme

How to fix it

  • Send valid credentials or a fresh token
  • Check the token hasn't expired (inspect its claims)
  • Confirm the expected auth scheme (Bearer, Basic, etc.)

Other client error (4xx) codes