What is the difference between a 401 Unauthorized and a 403 Forbidden status code?

Last updated 29 June 2026

401 means "I don't know who you are" (authentication failed or is missing); 403 means "I know who you are, but you're not allowed to do this" (authorization failed).

  • 401 Unauthorized = authentication problem:

    • No credentials, invalid token, or expired session.

    • Should include a WWW-Authenticate header telling the client how to authenticate.

    • Fix: log in / provide valid credentials.

  • 403 Forbidden = authorization problem:

    • Credentials are valid but lack the permission/role for this resource.

    • Re-authenticating won't help: the identity simply isn't allowed.

  • Privacy nuance: Sometimes a 404 is returned instead of 403 to avoid revealing that a resource exists to unauthorized users.

  • https://www.datacamp.com/blog/rest-api-interview-questions
  • https://www.browserless.io/blog/rest-api-interview-questions-answers
  • https://www.testmuai.com/learning-hub/rest-api-interview-questions/
  • https://www.wattlecorp.com/owasp-api-security-top-10/
  • https://www.acte.in/owasp-interview-questions-and-answers
  • https://zuplo.com/learning-center/asynchronous-operations-in-rest-apis-managing-long-running-tasks
  • https://tyk.io/blog/api-design-guidance-bulk-and-batch-import/
  • https://coderanch.com/t/581000/engineering/Bulk-Batch-design
  • https://www.codementor.io/blog/batch-endpoints-6olbjay1hd
  • https://softwareengineering.stackexchange.com/questions/435691/rest-api-design-for-bulk-post
  • https://stackoverflow.com/questions/45525753/restful-api-and-bulk-operations
  • https://www.hellointerview.com/learn/system-design/patterns/long-running-tasks
  • https://www.geeksforgeeks.org/system-design/differences-between-api-versioning-and-backward-compatibility-in-system-design/
  • https://www.infoq.com/articles/breaking-changes-are-broken-semver/
  • https://medium.com/@fahimad/api-versioning-strategies-backward-compatibility-in-rest-apis-234bafd5388e
  • https://www.speakeasy.com/api-design/versioning
  • https://cjohansen.no/backwards-compatibility-http-apis/
  • https://amasucci.com/posts/api-backwards-compatibility/
  • https://www.simplilearn.com/rest-api-interview-questions-answers-article
  • https://github.com/kedro-org/kedro/wiki/Backwards-compatibility-and-breaking-changes
  • https://truelist.io/blog/webhook-vs-rest-api
  • https://blog.postman.com/rest-api-interview-questions/
  • https://www.sendowl.com/s/job-search
  • https://www.ashokit.in/blog/top-microservices-interview-questions-and-answers
  • https://www.resumeadapter.com/blog/full-stack-developer-resume-keywords
  • https://meduzzen.com/hire/backend-developers/
  • https://www.greatfrontend.com/blog/latest
  • https://prepfully.com/interview-guides/hubspot-software-engineer
  • https://www.getsmartresume.com/article/netflix-internship-new-grad-opportunities
All REST API interview questions