403 Forbidden
The server understood the request but refuses to authorize it. Unlike 401, re-authenticating with the same credentials will make no difference.
❓ Why does this happen?
User is authenticated but lacks required role permissions (RBAC), IP address blocked by firewall, or CORS origin rejected.
✅ How to fix it
Verify user permissions, check API key scopes, and inspect server access control lists.
Return or handle 403 in your stack
// app/api/resource/route.ts
export function GET() {
return Response.json(
{ error: "Forbidden", status: 403 },
{
status: 403
}
);
}Live 403 mock endpoint
Point your app, tests, or retry logic at this free public URL to reproduce a real 403 response (CORS enabled, optional ?delay=ms up to 5000).
https://castov.com/api/mock/403403 vs similar status codes
401 means the server does not know who you are (missing or invalid credentials) — authenticate and retry. 403 means it knows who you are but you are not allowed — retrying with the same credentials will never work.
Some APIs return 404 instead of 403 to avoid revealing that a private resource exists (security through non-disclosure).
Frequently Asked Questions
What does HTTP Status 403 mean?
Why am I getting a 403 status code?
How do I fix a 403 Forbidden error?
What is the difference between 403 Forbidden and 401 Unauthorized?
What is the difference between 403 Forbidden and 404 Not Found?
How can I test how my app handles a 403 response?
Other 4xx status codes
Browse the full HTTP status codes directory or troubleshoot terminal errors in the Error Fix Encyclopedia.