Unable to get user when searching via phone_number

Hi,

I’m trying to fetch a user by phone number via /api/v2/users endpoint

When I pass q=phone_verified:true

I can see the list of users.

Then if I change the query to one of the user’s number in query, like
q=phone_number:“actual_number”

I get an empty array.

Hi @fawaz.ahmed,

Welcome to the Auth0 Community!

I was able to successfully get a user using that query. Can you check a few things for me?

  • Is your user on an sms connection?
  • Are you following the format stored in the user’s JSON? You can find how it is stored exactly in the dashboard or by requesting the user from the management API. typically it is stored like this: +12345678910 This would be equivalent to a US number of 1(234)567-8910

Hi @dan.woda ,

1_ Yes connection is sms
2_ Yes, I’m using the exact same format that I receive from api starting with +1…

The problem, when I pass q=phone_verified:true, I can see a list of users

Then I took the first phone_number from the list and passed q=phone_number:"+1…"

It returned an empty array.

If I use a wildcard query, lets say phone_number is +1234567
and I pass q=phone_number:*1234567, it returns me the user. But this does not works every time. While I try to patch a user’s phone_number, it says number already exists.

Thanks for the added info. Can you please post the exact request (or send it to me in a DM for privacy)?

Reposting the solution here for public visibility:

This issue has something to do with how postman is encoding your query string.

If I URL encode it everything works fine. Like this:

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