Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet been provided.
What does HTTP 401 mean?
The 401 Unauthorized code is part of the 4XX class. This is a client error code — the request was faulty, unauthorized, or cannot be fulfilled. The problem is on the request side.
When is it used?
A server returns 401 Unauthorized in situations matching the definition above. You will encounter it inspecting network requests, reading logs, or testing an API. Whether it signals a problem depends on its class: 2xx and 3xx are normal, while 4xx and 5xx usually need attention on the client or server respectively.