Back to all status codes

401

Unauthorized

Client Error
RFC 7235

The request requires user authentication.

Detailed Information

The 401 status code indicates that the request requires user authentication. The response must include a WWW-Authenticate header field containing a challenge applicable to the requested resource.

Common Examples

  • Accessing protected resources
  • API requests requiring authentication

Common Uses

  • API requests requiring authentication
  • Protected resources

Best Practices

  • Use when authentication is required
  • Include WWW-Authenticate header with authentication details
  • Ensure proper authentication mechanisms are in place

Additional Resources

Read more on MDN