Cannot update the phone_number for user

Describe the problem

I’m trying to update the user’s phone number, but got the following error {"statusCode":400,"error":"Bad Request","message":"Payload validation error: 'Expected type object but found type null'.","errorCode":"invalid_body"}
I’m able to get data from API.

What was the expected behavior?

Get success update response.


Hi @jringsakabe

The endpoint to update users works for me. What does line 6 in your Python script do? It looks like the tool you’re using (Postman?) doesn’t send the actual body. It also looks like you’re creating an empty “payload” dictionary. What data are you sending on line 13? (i can’t see because it’s truncated). Below is a working example (I didn’t include the imports and headers but you need them):

		user_id = 'auth0|123'
		phone_number = '+33123456789'

		payload = {
			'phone_number': phone_number

		r = requests.patch(url + f'/api/v2/users/{user_id}', headers=headers, json=payload).json()
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.