Skip to main content
GET/users/search/?phone_number=:phone_number

Find users by phone number

You can find a user based on the phone_number attribute. The response is always a paginated list of the matching contacts, so many isn't needed here and has no effect.

Attributes

Optional unless marked required

phone_numberstringrequired
A user phone number.

Handling phone number formats​

The search matches the number exactly as it's stored on the contact, spaces and other characters included: a contact saved as +48 123 456 789 isn't found with +48123456789, and the other way round. Store numbers in one format, preferably the clean one (+48123456789), and search in the same format.

Formats you may find on contacts (each one matches only itself):

  • International with formatting: +1 (555) 123-4567
  • With spaces and hyphens: 48 123-456-789
  • Clean format: +48123456789

When making API requests:

  1. Using HTTP Client Libraries (Recommended)

    • Most modern HTTP clients handle URL encoding automatically
    • Example with Python requests:
    # Clean format (recommended for consistency)
    params = {
    "phone_number": "+48123456789"
    }

    # A number stored with spaces and hyphens: search with the same characters
    params = {
    "phone_number": "+48 123-456-789"
    }
    response = requests.get(url, params=params, headers=headers)
  2. Manual URL Encoding

    • If building the URL manually, make sure to encode all special characters:
    from urllib.parse import quote

    # With formatting
    phone_formatted = "+48 123-456-789"
    phone_encoded = quote(phone_formatted) # Results in: %2B48%20123-456-789

    # Clean format
    phone_clean = "+48123456789"
    phone_encoded = quote(phone_clean) # Results in: %2B48123456789

    url = f"{base_url}?phone_number={phone_encoded}"

Request​

curl -X GET "https://<your_app_subdomain>.user.com/api/public/users/search/?phone_number=:phone_number" \
-H "Authorization: Token <your_64_char_api_key>" \
-H "Accept: */*; version=2"

Response examples​

{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1947,
"user_key": "g7lvoickax9e",
"name": "John Doe",
"email": "johndoe+1@example.com",
"gender": "unknown",
"status": "user",
"phone_number": "48 123-456-789",
"first_seen": "2025-04-07T08:59:22.364896Z",
"last_seen": "2025-04-07T09:25:44.809546Z",
"page_views": 14,
"last_ip": "54.38.139.0",
"timezone": "Europe/Kaliningrad",
"city": "Warsaw",
"region": "Mazovia",
"country": "Poland",
"unsubscribed": false,
"browser_language": "pl",
"widget_language": null,
"score": 0,
"browser": "Chrome",
"os_type": "Mac OS X",
"resolution": "2560x1440",
"created_at": "2025-04-07T08:59:22.381018Z",
"updated_at": "2025-04-08T11:21:29.044044Z",
"companies": ,1 item
"gravatar_url": null,
"lists": [],
"tags": [],
"notifications": true,
"facebook_url": null,
"linkedin_url": null,
"twitter_url": null,
"google_url": null,
"last_contacted": "2025-04-07T09:28:07.247131Z",
"custom_id": null,
"web_push_subscription": false,
"assigned_to": null,
"most_active_time": null,
"lt_opened_email": null,
"lt_clicked_email": null,
"email_mx_valid": true,
"referrer": "https://srv71624.seohost.com.pl/test-site/koszyk/",
"last_heard_from": "2025-04-07T09:12:28.758234Z",
"spambounced": false,
"softbounced": false,
"hardbounced": false,
"marked_email_as_spam": true
}
]
}

Response fields​

Fields returned in the 200 OK response body.

countinteger
Number of results across all pages. It can lag behind recent changes; see Response pagination.
nextstring (URL)nullable
URL of the next page of results. null on the last page.
previousstring (URL)nullable
URL of the previous page of results. null on the first page.
resultsarray
Results on this page.
note

Errors that can come from any endpoint (401, 429, 500, 502, 504) are described in HTTP response codes.