Auth0 Home Blog Docs

Bad request when creating a user with a phone_number



From the docs of Management APIv2 and using Postman, I’m trying to create a user:

  "connection": "",
  "email": "",
  "username": "",
  "password": "",
  "phone_number": ""

But I get:

statusCode: 400
error: "Bad Request"
message: "Payload validation error: 'Invalid property phone_number'."
errorCode: "invalid_body"

How do you add phone_number in Auth0 database (not in user_metadata)? Or why is phone_number present in Postman Auth0 request body (outside user_metadata)?

Or is it only when passwordless service is activated?


You last question hints at the reason for the bad request you received. The phone_number is available as a root property of the user profile for SMS connection users.

The user’s phone number (following the E.164 recommendation), only valid for users to be added to SMS connections

(emphasis is mine, source: body schema section of the create users endpoint)