Use 403 for explicit access denial, or 404 to conceal resource existence when security policy requires reducing endpoint and object enumeration risk.
Last reviewed: February 20, 2026|Editorial standard: source-backed comparison guidance
HTTP/1.1 403 Forbidden
Content-Type: application/json
{
"error": "forbidden",
"message": "You do not have permission to access this resource.",
"request_id": "req_2f3b9b4f"
}HTTP/1.1 404 Not Found
Content-Type: application/json
{
"error": "not_found",
"message": "Resource was not found."
}Yes. RFC 9110 explicitly allows an origin server to return 404 instead of 403 when it wants to hide the current existence of a forbidden target resource.
Keep status, payload schema, and caching behavior consistent for unauthorized-existing and truly nonexistent objects, and avoid timing differences where possible.
No. Concealment is an external response policy. Internal logs and traces should still record whether the event was a real not-found or an authorization-based concealment.
Learn when to return 404 (missing or temporary absence) versus 410 (intentional permanent removal), including redirect and cache implications.
Fix 401 Unauthorized vs 403 Forbidden by separating authentication failures from authorization denials, then apply the right login or permission fix fast.