403

Forbidden

4xx · Client Error common

Overview

403 Forbidden means the server understood the request but refuses to authorize it. Unlike 401, the identity may be authenticated, but that identity lacks permission (authorization) for this resource, so re-logging in will not help.

Typical causes are insufficient role/permissions, an IP/geo/firewall (WAF) block, a missing OAuth scope, or attempting to access another user's resource. The server is effectively saying, "I know who you are, but this action is not allowed."

When it happens

Request / Response example

Request
DELETE /api/orgs/9/members/17 HTTP/1.1
Host: api.example.com
Authorization: Bearer valid.token.for.viewer
Response
HTTP/1.1 403 Forbidden
Content-Type: application/json

{"error":"forbidden","message":"Your role 'viewer' cannot remove members"}

In code

app.delete('/api/orgs/:o/members/:m', (req, res) => {
  if (req.user.role !== 'admin')
    return res.status(403).json({ error: 'forbidden' });
  // ...
});
@app.delete('/orgs/<int:o>/members/<int:m>')
def remove(o, m):
    if current_user.role != 'admin':
        abort(403)
    return '', 204

Common causes

How to fix

Notes

Related status codes

Specification