Using a bot to ban and unban people remotely

,

I want to make a discord bot that allows you to ban and unban players through it.
How would I go about this?

2 Likes

The endpoint for this is: https://apis.roblox.com/user/cloud/v2/universes/{UniverseId}/user-restrictions/{UserId}?. Method = PATCH

This api endpoint accepts a body, which should look like this in JSON:

{"gameJoinRestriction":{"active":true,"duration":"1s","privateReason":"PrivateReasonHere","displayReason":"PublicReasonHere","excludeAltAccounts":true}}

You can customize the parameters as needed, this api endpoint requires an x-api-key with user-restrictions:write to be passed onto headers.

Only include the “active” key set as false when attempting to unban a user.

An easier method is to host the banned players on your bot’s website (if you have one) and directly check if a user is registered as banned on your website using HttpService to make a request on roblox; kick the user if they are registered.

1 Like

This isn’t quite right. A .ROBLOSECURITY cookie and X-Csrf-Token aren’t required. You should be just fine with a valid API key.

1 Like

where do you even find these APIs if I can’t even find them myself!? because I really need to find many APIs that I can’t find…

Thanks for the heads up! I have edited the post with the information you provided.

1 Like

I usually find undocumented api endpoints through the networks tab on my browser or the network section on roblox’s console. This specific api endpoint is partially documented

i would know that but most apis are in-game or in-app only…

Most apis in-game can be found through the networks tab of roblox’s console as I stated (if the specific CoreScript is requesting them from the client). Which apis do you specifically mean by “in-game” or “in-app”

like post avatar api or post captures api, really would wanna try out avatar post api cuz roblox keeps posting my avatars incorrectly.

There are lots of APIs documented but it’s a bit annoying to actually navigate to the OpenCloud REST API documentation. This specific API is documented here. If you don’t have information about an API and can’t find anything, it can help to ask AI for information about the API since it can search a wide variety of sources much faster. Sometimes, the code it gives works, but it’s often better to just get information about the API and apply that in your own code.

I actually find the Studio assistant to be particularly good at these APIs, despite lacking some capability with built-in Roblox Luau features. You just need to specify the API, specify that it’s a REST API, and sometimes provide some code. If you type the language of the code after the first set of backticks, it will interpret it correctly in that language.

oh i know that page but seems to be updated tho roblox never shares apis that is used inside their client etc like i said the post avatar api and post capture etc so on tho i got a few post apis but dont know how to use some that i guessed the api by trying random paths

I think the idea is they aren’t supposed to be used by developers and are limited to internal systems, hence why they aren’t documented. You could always try asking an AI and see if there is more info out there.

The captures api (which I believe is the screenshot capture api, I might have misunderstood this) is almost entirely internalized as stated by @12345koip; the api endpoint for captures seem to be sc7.rbxcdn.com but requires multiple internal cookies which are redacted. For the post avatar api, could you be more specific (do you mean the api to create avatars?)

I might be wrong here since I am not that familiar with the forum rules, but this conversation is not related to the post so you might have to create a post or contact elsewhere.

no not create clearly, just the feature where you post your avatars to marketplace.