Getting The request body was not well-formed

gettin this error when attempting to create a new user via API. Using express and bodyParser to parse form body, serialize it into JSON, and then send it to OKTA. tried various formats, but all the same. What am I missing?


my code:

 req.body.user.profile.login =;
  let data = JSON.stringify(req.body.user){
    uri: ``,
    json: true,
    headers: {Authorization: `SSWS ${process.env.OKTA_TOKEN}`},
    body: `'${data}'`

the error:

StatusCodeError: 400 -
"errorSummary":"The request body was not well-formed.",

So i’ve noticed that if I remove the groups then it works fine…

Are you creating a user or updating one? Setting the groupIds field only works when creating a new user. For existing users you can use this:

I am creating a user from scratch, which is reflected in the URI. I even tried the example provided on Okta’s page using Postman and it failed.

solved my issues by updating the groups later. not sure what’s going on.