Skip to main content
HTTP/4xx (Client Error)

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/403

403 vs similar status codes

Frequently Asked Questions

What does HTTP Status 403 mean?
The server understood the request but refuses to authorize it. Unlike 401, re-authenticating with the same credentials will make no difference.
Why am I getting a 403 status code?
User is authenticated but lacks required role permissions (RBAC), IP address blocked by firewall, or CORS origin rejected.
How do I fix a 403 Forbidden error?
Verify user permissions, check API key scopes, and inspect server access control lists.
What is the difference between 403 Forbidden and 401 Unauthorized?
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.
What is the difference between 403 Forbidden and 404 Not Found?
Some APIs return 404 instead of 403 to avoid revealing that a private resource exists (security through non-disclosure).
How can I test how my app handles a 403 response?
Send a request to https://castov.com/api/mock/403 — it returns a real 403 Forbidden response with CORS enabled. Add ?delay=2000 to simulate a slow server.

Other 4xx status codes

Browse the full HTTP status codes directory or troubleshoot terminal errors in the Error Fix Encyclopedia.