401 Unauthorized

Authentication is missing or failed. Sent with a WWW-Authenticate header saying how to authenticate. Despite the name, it means unauthenticated.

What to do

Send credentials, or fresh ones. The WWW-Authenticate header names the scheme the server wants. A missing or expired token is the usual cause. Valid credentials without permission get a 403 instead.

Class
4xx Client Error. The request has a fault, or cannot be met as sent.
Registered
Yes, in the IANA HTTP status code registry.
Cacheable by default
No. A cache stores it only when Cache-Control or Expires says to.
References
RFC 9110 ยง15.5.2 · MDN

Example response

HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer realm="api"

Every 4xx code

All HTTP status codes, in one table