# Unable to get user when searching via phone\_number

**URL:** <https://community.auth0.com/t/unable-to-get-user-when-searching-via-phone-number/76961>\
**Category:** Get Help\
**Tags:** api\
**Created:** [January 25, 2022, 10:07am UTC](https://community.auth0.com/t/unable-to-get-user-when-searching-via-phone-number/76961 "2022-01-25T10:07:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![fawaz.ahmed](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/fawaz.ahmed/32/33782_2.png) [@fawaz.ahmed](https://community.auth0.com/u/fawaz.ahmed)\
**Post date:** [January 25, 2022, 10:07am UTC](https://community.auth0.com/t/unable-to-get-user-when-searching-via-phone-number/76961/1 "2022-01-25T10:07:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 26, 2022, 11:40pm UTC](https://community.auth0.com/t/unable-to-get-user-when-searching-via-phone-number/76961/4 "2022-01-26T23:40:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![fawaz.ahmed](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/fawaz.ahmed/32/33782_2.png) [@fawaz.ahmed](https://community.auth0.com/u/fawaz.ahmed)\
**Post date:** [January 27, 2022, 5:00am UTC](https://community.auth0.com/t/unable-to-get-user-when-searching-via-phone-number/76961/5 "2022-01-27T05:00:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 27, 2022, 5:39pm UTC](https://community.auth0.com/t/unable-to-get-user-when-searching-via-phone-number/76961/6 "2022-01-27T17:39:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [February 4, 2022, 9:11pm UTC](https://community.auth0.com/t/unable-to-get-user-when-searching-via-phone-number/76961/7 "2022-02-04T21:11:20Z")

</div>

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:

 ![Screen Shot 2022-02-04 at 1.08.40 PM](https://global.discourse-cdn.com/auth0/original/3X/b/a/ba752da111069f3d408f07bbd7d9df3b1cd691bf.png)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 19, 2022, 9:12pm UTC](https://community.auth0.com/t/unable-to-get-user-when-searching-via-phone-number/76961/8 "2022-02-19T21:12:17Z")

</div>

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