GET
/users/search/?email=:emailFind users by email
You can find a user based on an email attribute. If you want to list all of your users with a specific email, add a "many=true" parameter to your request.
| Attributes | Type | Required | Description |
|---|---|---|---|
| string | yes | A user email address. |
| Lookup | Description | Example usage |
|---|---|---|
| contains | Case-sensitive containment test. | ?email__contains=@user.com |
Handling special characters
When the email contains special characters (like +) or other non-alphanumeric characters, you have two options for making the request:
-
Using HTTP Client Libraries (Recommended)
- Most modern HTTP clients handle URL encoding automatically
- Example with Python requests:
params = {"email": "john.doe+tag@example.com" # No manual encoding needed}response = requests.get(url, params=params, headers=headers) -
Manual URL Encoding
- If building the URL manually, encode special characters:
- Example with Python:
from urllib.parse import quoteemail = quote("john.doe+tag@example.com") # Results in: john.doe%2Btag%40example.comurl = f"{base_url}?email={email}"
Request
- CURL
- JavaScript
- PHP
- Python
curl -X GET -H "Authorization: Token <your_64_char_api_key>"
-H "Accept: */*; version=2"
"https://<your_app_subdomain>.user.com/api/public/users/search/?email=:email"
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://<your_app_subdomain>.user.com/api/public/users/search/?email=:email");
xhr.setRequestHeader("authorization", "Token <your_64_char_api_key>");
xhr.setRequestHeader("accept", "*/*; version=2");
xhr.send(data);
<?php
$request = new HttpRequest();
$request->setUrl('https://<your_app_subdomain>.user.com/api/public/users/search/');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData(array(
'email' => ':email'
));
$request->setHeaders(array(
'authorization' => 'Token <your_64_char_api_key>'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
import requests
url = "https://<your_app_subdomain>.user.com/api/public/users/search/"
querystring = {"email":":email"}
headers = {'authorization': 'Token <your_64_char_api_key>'}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Response
{
"facebook_url": null,
"region": null,
"notifications": true,
"last_ip": null,
"attributes": [
{
"value": true,
"name": "Example attr",
"name_std": "example_attr",
"id": 1109
},
{
"value": "attribute value",
"name": "My string attr",
"name_std": "my_string_attr",
"id": 2429
}
],
"country": null,
"resolution": null,
"name": "Jane Doe",
"browser_language": null,
"email": "example@email.com",
"os_type": null,
"created_at": "2017-06-07T09:41:13.466897Z",
"unsubscribed": false,
"timezone": null,
"gravatar_url": null,
"chat_id": "Chat ID is deprecated and will be removed in future",
"browser": null,
"key": "g3FaYocCy0U6",
"id": 19678376,
"updated_at": "2017-06-07T10:29:15.955873Z",
"score": 0,
"google_url": null,
"city": null,
"first_seen": null,
"status": "visitor",
"tags": [
{
"name": "tag",
"id": 1441
}
],
"gender": "unknown",
"linkedin_url": null,
"twitter_url": null,
"last_contacted": null,
"phone_number": null,
"lists": [],
"last_seen": null,
"page_views": 0
}
{
"facebook_url": null,
"region": null,
"notifications": true,
"last_ip": null,
"attributes": [
{
"value": true,
"name": "Example attr",
"name_std": "example_attr",
"id": 1100
},
{
"value": "attribute value",
"name": "My string attr",
"name_std": "my_string_attr",
"id": 2400
}
],
"country": null,
"resolution": null,
"name": "Christian Dior",
"browser_language": null,
"email": "example@email.com",
"os_type": null,
"created_at": "2017-06-07T09:41:13.466897Z",
"unsubscribed": false,
"timezone": null,
"gravatar_url": null,
"chat_id": "Chat ID is deprecated and will be removed in future",
"browser": null,
"key": "g3FaYocCy0U6",
"id": 1949376,
"updated_at": "2017-06-07T10:29:15.955873Z",
"score": 0,
"google_url": null,
"city": null,
"first_seen": null,
"status": "visitor",
"tags": [
{
"name": "tag2",
"id": 1440
}
],
"gender": "unknown",
"linkedin_url": null,
"twitter_url": null,
"last_contacted": null,
"phone_number": null,
"lists": [],
"last_seen": null,
"page_views": 0
}