Learn when to return 404 (missing or temporary absence) versus 410 (intentional permanent removal), including redirect and cache implications.
Last reviewed: February 20, 2026|Editorial standard: source-backed comparison guidance
HTTP/1.1 404 Not Found
Content-Type: application/json
{
"error": "not_found",
"message": "No current representation for this URI."
}HTTP/1.1 410 Gone
Content-Type: application/json
{
"error": "gone",
"message": "This endpoint was permanently removed."
}Return 410 when permanent retirement is intentional and known by the server. Use 404 when current representation is unavailable but permanence is not asserted.
Use 301 or 308 when there is a canonical replacement URI. Use 410 when no replacement exists and the old URI is intentionally retired.
They can be heuristically cacheable unless explicit cache controls override that behavior, so set caching headers intentionally during migrations and retirements.
Use 403 for explicit access denial, or 404 to conceal resource existence when security policy requires reducing endpoint and object enumeration risk.
Fix 401 Unauthorized vs 403 Forbidden by separating authentication failures from authorization denials, then apply the right login or permission fix fast.