Create a sms connection user with custom user_id

Hi there,

I’m currently creating user using a Sms connection and their phone number via api/v2/users.
This is working fine and the user_id is auto-populated to be the phone number.
I noticed that in case of errors, the auth0 endpoints seem to log user_ids and phone numbers count as Pii, so I must not log them.
I attempted to update the user_id to a custom UUID, by adding the json field for newly created users, however I’m getting a bad request.

example payload:

“given_name”: “test”,
“family_name”: “test”,
“name”: “test”,
“nickname”: “test”,
“phone_number”: “+44”,
“connection”: “sms”,
“user_id” : “testtest”,

Error message:
“statusCode”: 400,
“error”: “Bad Request”,
“message”: ““user_id” is not allowed”,
“errorCode”: “invalid_body”

From the docs, I can see that user_id should be accepted as payload. Auth0 Management API v2

Any ideas?

module.exports = function (user, context, cb) {
  var response = {}; = 'changedName';
  response.user = user;
  cb(null, response);

We have tried Adding a Pre User Registration Hook as well as mentioned above code snippet , but it does work for us .