Presence API Bad Request

I want to make a POST request to but it keeps saying "There was an error while accessing HTTP 400 (Bad Request). I’ve looked on the Forum if somebody else has it but I found no post about it. Here is the Script I’m using:

-- Services

local HTTP = game:GetService("HttpService")
local ReplicatedS = game:GetService("ReplicatedStorage")

-- Variables

local URL = ""
local Remote = ReplicatedS:FindFirstChild("Player")

-- Functions

local function getPresenceData(plr : Player, userID : number)
	local presenceData = {}
	local data = HTTP:JSONEncode({
		["userIds"] = userID
	local succ, response = pcall(function()
		return HTTP:PostAsync(URL, data)
	if succ then
		Remote:FireClient(plr, response)
		warn("There was an error while accessing : " .. response)


It would be cool if somebody had a solution :slight_smile:

userID has to be in a list

the parameter is the UserID so that can’t be the error

The reply above is correct. The docs clearly show an example request body that has “userIds” as a list (array).

local data = HTTP:JSONEncode({
	["userIds"] = {userID}

I think that was a skill issue from my side. Thank you so much, now it works! I knew I had to put it in curly brackets but forgot it :sweat_smile:

that is definitely not what i said but im glad @hell_ish cleared it up :+1:

1 Like

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