API to add user to group

Hi,

We're developing some api request to daily reports that work fine with GET, but when we made some POST they didnt work, i can create user with the same script below, but when i try to put that user into a group i get error 400, if someone have experience or some guide if im doing somwthing wrong

#headers

$headersX = @{
'New-Object' = "System.Collections.Generic.Dictionary[[String],[String]]"
'X-Tenant-ID' = "tenant id"
'Authorization' = "Bearer $res"
'Accept' = "application/json"
'Content-Type' = "application/json"
}

#data formating

$body.Add("ids" , "user id")

$data = $body | ConvertTo-Json

#api call

Invoke-RestMethod -Uri 'api-us0X.central.sophos.com/.../users' -Method POST -Body $data -Headers $headersX

return error 400 bad request