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."
DELETE /api/orgs/9/members/17 HTTP/1.1
Host: api.example.com
Authorization: Bearer valid.token.for.viewerHTTP/1.1 403 Forbidden
Content-Type: application/json
{"error":"forbidden","message":"Your role 'viewer' cannot remove members"}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