← All status codes

401

Unauthorized

Who are you? Authentication failed or is missing.

When to actually use it

Missing or invalid credentials, an expired token. Send a `WWW-Authenticate` header.

Where people mess up

Using 401 when they're logged in but lack permission — that's 403. The two are different questions entirely.

The joke

The bouncer checking ID at the door. 401 is “I don’t know who you are”; 403 is “I know exactly who you are, and no.”