Introducing the Ban API and Alt Account Detection

Thank you everyone who worked on this feature!
This has been something I have requested for many years as moderating our games/experiences was becoming extremely annoying with banned players “ban evading” by using alts and there being no way of being sure the alt was theirs.
Really looking forward to using this!

Hey, if you’re interested I’ve made a npm package which wraps the new ban api endpoints.

docs:

get restriction (get ban): https://open.blox.wiki/cloud/userRestrictions/restrictions
update restriction (ban): https://open.blox.wiki/cloud/userRestrictions/updateRestrictionsForUser
list restrctions (list bans): https://open.blox.wiki/cloud/userRestrictions/listRestrictionLogs

npm i openblox
Typescript Example

Example:

import "dotenv/config"
import { UserRestrictionsApi } from "openblox/cloud"
import { Identifier } from "openblox/types"
import { v4 as uuidv4 } from "uuid"

// Put universe and place IDs here.
const UNIVERSE_ID: Identifier = 0, PLACE_ID: Identifier | undefined = 0

const banUser = async (userId: Identifier, duration: `${number}s`, privateReason: string, displayReason: string) => {
  const idempotencyKey = uuidv4(), firstSent = new Date();

  return await UserRestrictionsApi.updateRestrictionsForUser({
    universeId: UNIVERSE_ID, placeId: PLACE_ID, userId,
    idempotencyKey, firstSent, updatedData: {
      gameJoinRestriction: {
        active: true,
        duration: duration,
        privateReason,
        displayReason,
        excludeAltAccounts: false,
      },
    },
  }); 
}

;(async () => {
  const { data:banData } = await banUser(0, "31540000s" /* 1 year */, "private reason", "display reason")
  console.log(banData)
})()
Javascript Example
require("dotenv/config")
const { UserRestrictionsApi } = require("openblox/cloud")
const { v4:uuidv4 } = require("uuid")

// Put universe and place IDs here.
const UNIVERSE_ID = 0, PLACE_ID = 0

const banUser = async (userId, duration, privateReason, displayReason) => {
  const idempotencyKey = uuidv4(), firstSent = new Date();

  return await UserRestrictionsApi.updateRestrictionsForUser({
    universeId: UNIVERSE_ID, placeId: PLACE_ID, userId,
    idempotencyKey, firstSent, updatedData: {
      gameJoinRestriction: {
        active: true,
        duration: duration,
        privateReason,
        displayReason,
        excludeAltAccounts: false,
      },
    },
  }); 
}

;(async () => {
  try {
    const { data:banData } = await banUser(0, "31540000s" /* 1 year */, "private reason", "display reason")
    console.log(banData)
  } catch (e) {
    console.log(e)
  }
})()
3 Likes

I figured, would it be possible to expand this feature to the dashboard of an experience by default?
It’d make the process of managing bans by a dozen times more efficient rather than having to go through opening either Roblox client/studio or by a 3rd party tool in order to do this.

I get your point and this isn’t a clear cut idea, but I’m also not talking about automatically giving out site-wide bans to players that got kicked in some simulator for being a nuisance in chat or for getting vote-kicked by other players in some competitive game.

If someone is constantly getting banned from various experiences it makes sense to flag that account for a manual review or a stricter moderation AI pass. Keeping platform of this size clean is an insane task and any additional data helps, so Roblox would be silly not to use this in one way or another.

2 Likes

This is really neat! Does it work for JavaScript? My bot is in JavaScript and I’ve had some issues in the past using package that are in TypeScript.

it should work in javascript but if you run into any issues feel free to message me. :smile:

I hope the “by the creator” part is removed from the ban message, as it might result in anyone appealing blaming the creator for their ban unless specified within the display reason. Also, for some reason, if you’re banned while in-game, it displays the regular kick dialogue. In some circumstances, I’ve seen it show the ban dialogue but then switch to the kick dialogue a few frames later. Otherwise, this is a great API that I’ve been waiting on for months and I hope it gets more support down the line.

1 Like

How do I get a players ban history?

1 Like

Is there a reason why we aren’t allowed view users ban history in studio or is this a bug (Enable Studio Access to API Services and HTTP Service is enabled)?

game.Players:GetBanHistoryAsync(userId)

5 Likes

This is the best update Roblox has released so far

This is going to be incredibly useful for everyone. (aside from exploiters, obviously)

Thank you so much for this, Roblox! By far the best update all year.

I think it’s because it needs access to API services, since this should also count as an API service.
image

1 Like

Thanks, I was too lazy to do this myself

1 Like

roblox finally making a good update, W

Oops, forgot to mention I did have this enabled and it still returned 403 forbidden, I will edit my original reply to include that.

4 Likes

Yippee!

Small issue: It appears it’s possible to ban yourself without any way to revoke that ban from Roblox Studio. The only recourse is to script an :Unban() call, publish the game with that code, then join on an unbanned account to execute that code.

Once this has been implemented in the Creator dashboard this won’t be as much of an issue, but it’s something to look out for if you’re toying around like I was.

It’s most likely gonna be, IP and/or HWID related.

1 Like

Thanks this should be easier now.

It should be better to have a few more options to play with and a few more APIs, included but not limited to:

  • Modify a ban (reason, duration, …)
  • Own way of handling bans (teleporting to another place to handle appeals for instance)

So this would translate via:

  • A new method! Players:ModifyBan(), to modify a punishment log. I have no idea how you would be able to achieve that with the current configuration.

  • A new optional field in BanAsync (Kick, default is true): allows customized handle.

  • A new event Players.PlayerPunished or PlayerBanned, or PlayerBanStatusChanged, made to allow users to implement their own logic (as mentioned, teleporting to another server, …)

4 Likes

Small question.
Would appreciate if a Roblox Staff can clarify this.
Will it kick users if they have a active ban even if they got banned from
A: Another Server.
B: The API itself.
Would be awesome if it did!

1 Like