Well .. it depends.
If your endpoint URLs show sensitive information (for example, in the Dropbox API, you refer to files by their names and not their identifiers, so the URLs contain file names) or maybe you are using sequential identifiers (for example, ascending identifiers, which may be rude), return 404.
If you need support for the Request Access feature for resources for which you do not have permissions, return 403 so that your client side can distinguish this information.
Generally speaking, if your API uses identifiers and never discloses information as part of its URLs, and you use UUIDs as identifiers, I would go with 403 .. as with many well-known and highly secure applications nowadays (Google, Microsoft, etc.).
source share