All HTTP status codes
4xx Client Error
RFC 9110
401 Unauthorized
Authentication is required and has failed or has not been provided.
What it means
HTTP 401 Unauthorized indicates that the request lacks valid authentication credentials for the target resource. The response must include a WWW-Authenticate header indicating the required auth scheme.
When it's used
Protected resources requiring login, API endpoints requiring an API key or bearer token, or expired sessions.
Common causes
- Missing Authorization header
- Expired JWT or session token
- Invalid API key
- Wrong username/password combination
- Token signature verification failed
How to fix it
- Include valid credentials via Authorization header
- Refresh expired tokens before retrying
- Verify API key is correct and active
- Check the WWW-Authenticate header for the required scheme (Basic, Bearer, etc.)
Example response
HTTP/1.1 401 Unauthorized WWW-Authenticate: Bearer realm="api" Content-Type: application/json
SEO impact
Pages behind 401 are not indexed. Use noindex meta tag on member-only pages instead, with public preview content.