~/devtools / http-status / 401
tool::http-status-detail

401 Unauthorized

Authentication is required and has failed or not been provided.

ad · 728×90
Status Code
401
Name
Unauthorized
Category
4xx

Detailed Explanation

HTTP 401 Unauthorized indicates that the request lacks valid authentication credentials. Despite the name 'Unauthorized', it actually refers to an authentication failure. The server sends a WWW-Authenticate header with this response to indicate which authentication method should be used. It is often confused with 403 Forbidden, but 401 means 'identity unknown' while 403 means 'identity known but not authorized'.

Common Causes
  • Authentication token (Bearer, JWT, etc.) is missing from the request headers
  • The token has expired or is invalid
  • Incorrect username/password combination
  • API key is incorrect or deactivated
How to Fix
  • 1.Check that the Authorization header contains a valid token
  • 2.If the token has expired, obtain a new one using a refresh token
  • 3.Verify that your API key is valid and active
  • 4.Ensure the authentication method (Basic, Bearer, API Key) matches the server requirements

Related HTTP Headers

WWW-AuthenticateAuthorizationProxy-Authenticate

Response Example

HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer realm="api"
Content-Type: application/json

{"error":"invalid_token","message":"Token has expired"}

Related Status Codes

400Bad RequestThe server could not understand the request due to invalid syntax.402Payment RequiredReserved for future use; some services use it for payment walls.403ForbiddenThe server refuses to fulfill the request (authenticated but unauthorized).404Not FoundThe requested resource could not be found.405Method Not AllowedThe HTTP method is not supported for this resource.
ad · 300×250
Back to all status codes
// related tools
Cron Expression Generator
Build and parse cron expressions visually. Generate human-readable descriptions and preview next execution times.
jwt
JWT Decoder
Decode and inspect JWT tokens. View header, payload, and signature details.
rx
Regex Tester
Test regular expressions with live matching, group highlighting, and explanations.
Color Converter
Convert colors between HEX, RGB, HSL, and more. Pick colors visually.