It’s like building a house of cards - everything looks right until one tiny thing throws the whole thing off. We’ve got a PowerShell script for bulk user creation using the /api/v2/users endpoint and it’s started failing with a 400 Bad Request on the phoneNumber field. We’ve got around 250 agents, so manually creating them is, well, doing jack all.
The script’s been running fine for months, but it’s now hitting this issue consistently. The documentation says phoneNumber should be E.164 format, which we are sending. It’s not a token issue - we’ve confirmed token refresh works.
Here’s the relevant bit of the script - stripped down for clarity:
$uri = "https://api-us-west-2.genesyscloud.com/api/v2/users"
$body = @{
"username" = "test.user123"
"firstName" = "Test"
"lastName" = "User"
"email" = "test.user123@example.com"
"phoneNumber" = "+15551234567" #E.164 format
} | ConvertTo-Json
$headers = @{
"Authorization" = "Bearer $env:GC_TOKEN"
"Content-Type" = "application/json"
}
Invoke-RestMethod -Uri $uri -Method POST -Headers $headers -Body $body
The API response just gives a generic “Invalid request” and a 400. Nothing else. We’re on Genesys Cloud release 2024-08. I’ve checked the user’s default country code, thinking maybe something’s off there, but the default country code is set correctly. The console is empty.
N.