local HttpService = game:GetService("HttpService") local function hexToColor3(value, fallback) local color = tostring(value or "") local r, g, b = color:match("^#?(%x%x)(%x%x)(%x%x)$") if not r then return fallback or Color3.fromRGB(32, 227, 178) end return Color3.fromRGB(tonumber(r, 16), tonumber(g, 16), tonumber(b, 16)) end local RobloxAPIs = {} RobloxAPIs.__index = RobloxAPIs function RobloxAPIs.new(config) if type(config) == "string" then config = { apiKey = config } end config = config or {} assert(config.apiKey, "RobloxAPIs.new requires an apiKey") return setmetatable({ BaseUrl = config.baseUrl or "https://robloxapis.com", ApiKey = config.apiKey, Timeout = config.timeout or 15 }, RobloxAPIs) end function RobloxAPIs:Request(path, method, body) local request = { Url = self.BaseUrl .. path, Method = method or "GET", Headers = { ["Authorization"] = "Bearer " .. self.ApiKey, ["Content-Type"] = "application/json" } } if body ~= nil then request.Body = HttpService:JSONEncode(body) end local response = HttpService:RequestAsync(request) local decoded = nil if response.Body and response.Body ~= "" then local ok, result = pcall(function() return HttpService:JSONDecode(response.Body) end) decoded = ok and result or { rawBody = response.Body } end if not response.Success then return nil, { statusCode = response.StatusCode, statusMessage = response.StatusMessage, body = decoded } end return decoded, nil end function RobloxAPIs:CheckBan(userId, context) context = context or {} context.userId = userId return self:Request("/api/v1/cross-ban/check", "POST", context) end function RobloxAPIs:BanUser(userId, options) options = options or {} options.userId = userId return self:Request("/api/v1/cross-ban/bans", "POST", options) end function RobloxAPIs:RevokeBan(banId) return self:Request("/api/v1/cross-ban/bans/" .. HttpService:UrlEncode(tostring(banId)), "DELETE") end function RobloxAPIs:RunCrossBanSelfTest(testUserId, context) context = context or {} testUserId = testUserId or context.userId or 156 local testUniverseId = context.universeId or context.scopeId or tonumber(tostring(os.time()) .. tostring(math.random(1000, 9999))) local created, createErr = self:BanUser(testUserId, { scopeType = context.scopeType or "universe", scopeId = tostring(testUniverseId), reason = context.reason or "RobloxAPIs SDK self-test", note = "Temporary test ban created by RunCrossBanSelfTest" }) if createErr then return nil, createErr end local check, checkErr = self:CheckBan(testUserId, { universeId = testUniverseId, groupId = context.groupId, serverJobId = context.serverJobId or game.JobId }) local revoked = nil local revokeErr = nil if created and created.ban and created.ban.id then revoked, revokeErr = self:RevokeBan(created.ban.id) end return { ok = check ~= nil and check.banned == true, testUniverseId = testUniverseId, created = created, check = check, revoked = revoked, errors = { check = checkErr, revoke = revokeErr } }, nil end function RobloxAPIs:GetPlayerIntel(userId) return self:Request("/api/v1/intel/users/" .. tostring(userId), "GET") end function RobloxAPIs:PutObject(objectKey, value) return self:Request("/api/v1/vault/objects/" .. HttpService:UrlEncode(objectKey), "PUT", { value = value }) end function RobloxAPIs:GetObject(objectKey) return self:Request("/api/v1/vault/objects/" .. HttpService:UrlEncode(objectKey), "GET") end function RobloxAPIs:DeleteObject(objectKey) return self:Request("/api/v1/vault/objects/" .. HttpService:UrlEncode(objectKey), "DELETE") end function RobloxAPIs:SetExperienceConfig(configKey, config) if type(configKey) == "table" then config = configKey configKey = "default" end return self:Request("/api/v1/experience/configs/" .. HttpService:UrlEncode(tostring(configKey or "default")), "PUT", config or {}) end function RobloxAPIs:GetExperienceConfig(configKey) return self:Request("/api/v1/experience/configs/" .. HttpService:UrlEncode(tostring(configKey or "default")), "GET") end function RobloxAPIs:ApplyExperienceConfigSign(configKey, options) options = options or {} local result, err = self:GetExperienceConfig(configKey or options.configKey or "default") if err then return nil, err end local config = result.config or {} local partName = options.partName or "RobloxAPIs_LiveConfig" local part = workspace:FindFirstChild(partName) if not part then part = Instance.new("Part") part.Name = partName part.Anchored = true part.Size = options.size or Vector3.new(16, 9, 1) part.Position = options.position or Vector3.new(0, 8, -14) part.Parent = workspace end local surface = part:FindFirstChild("RobloxAPIs_Surface") if not surface then surface = Instance.new("SurfaceGui") surface.Name = "RobloxAPIs_Surface" surface.Face = Enum.NormalId.Front surface.CanvasSize = Vector2.new(1200, 700) surface.Parent = part end local label = surface:FindFirstChild("Message") if not label then label = Instance.new("TextLabel") label.Name = "Message" label.Size = UDim2.fromScale(1, 1) label.BorderSizePixel = 0 label.TextScaled = true label.Font = Enum.Font.GothamBlack label.TextColor3 = Color3.fromRGB(245, 248, 255) label.Parent = surface end part.Color = hexToColor3(config.accent, Color3.fromRGB(32, 227, 178)) label.BackgroundColor3 = Color3.fromRGB(5, 6, 8) label.BackgroundTransparency = 0.08 label.Text = tostring(config.title or "Roblox APIs") .. "\n" .. tostring(config.message or "") return { ok = true, result = result, part = part, label = label }, nil end function RobloxAPIs:SendEconomySignal(userId, action, valueDelta, metadata) return self:Request("/api/v1/economy/signals", "POST", { userId = userId, action = action, valueDelta = valueDelta or 0, metadata = metadata or {} }) end function RobloxAPIs:SendWebhookEvent(eventType, payload) return self:Request("/api/v1/webhooks/events", "POST", { type = eventType, payload = payload or {} }) end function RobloxAPIs:SetGroupPolicy(groupId, policy) return self:Request("/api/v1/groups/" .. tostring(groupId) .. "/policy", "PATCH", policy or {}) end function RobloxAPIs:GetGroupPolicy(groupId) return self:Request("/api/v1/groups/" .. tostring(groupId) .. "/policy", "GET") end function RobloxAPIs:ModerateJoin(player, context) context = context or {} context.userId = player.UserId context.universeId = context.universeId or game.GameId context.serverJobId = context.serverJobId or game.JobId local result, err = self:CheckBan(player.UserId, context) if err then warn("RobloxAPIs moderation check failed", err.statusCode) return false, err end if result and result.banned then player:Kick(context.kickMessage or "Moderation action active") return true, result end return false, result end return RobloxAPIs