Search code examples
httphttp-status-code-403http-status

What's the right HTTP Status code for a blocked, abusive user?


I am building an app in which users might be blocked for using offensive language. When a user is blocked, his or her app can not access some API calls.

What should be the right HTTP status code when a blocked user tried access these API parts? Error 403 seems like a good choice, but I wonder if there's anything more specific.


Solution

  • Just for completeness ....

    The answer to the question is that there is no other code that is (clearly) more appropriate than 403. As Wikipedia says:

    "HTTP 403 is returned when the client is not permitted access to the resource despite providing authentication - either because authentication failed, or for some reason besides authentication, such as insufficient permissions of the authenticated account. This other reason needs to be acted upon before re-requesting access to the resource."

    That is a good fit to the scenario you describe.

    The other thing is that since you have blocked the users, you probably don't care what they think about the "correctness" of the status code. Nobody else will care one way or the other.

    Ultimately it is your choice.