Ban people external from Roblox Game via API

Can you ban people Via the Roblox API?

I have tried many times, but it didn’t work.

Here is an example:

https://apis.roblox.com/bans/v1/universes/YOUR_UNIVERSE_ID/bans

It returned every time the error code 0.

You need to use OpenCloud UserRestriction | Documentation - Roblox Creator Hub

1 Like

You can send a PATCH request to the OpenCloud endpoint with an API key, like @Nitefal said.

//JavaScript example
const userId = //UserId of the user to ban
const banLength = 300; //how long to ban the user for

const universeId = //your universe id

fetch(`https://apis.roblox.com/cloud/v2/universes/${universeId}/user-restrictions/${userId}`, {
    method: "PATCH",
    headers: {
        "content-type": "application/json",
        "x-api-key": //your API key
    },

    body: JSON.stringify({gameJoinRestriction: {
        active: true,
        duration: String(banLength) + "s",
        privateReason: "reason private",
        displayReason: "reason to display",
        excludeAltAccounts: false
    }})
}).catch(error => console.log(error));
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.