Search user with email.
curl --request POST \
--url https://{tenant}/api/users/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filters": {
"query": "itachi@tyk.io"
}
}
'import requests
url = "https://{tenant}/api/users/search"
payload = { "filters": { "query": "itachi@tyk.io" } }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({filters: {query: 'itachi@tyk.io'}})
};
fetch('https://{tenant}/api/users/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenant}/api/users/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'filters' => [
'query' => 'itachi@tyk.io'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{tenant}/api/users/search"
payload := strings.NewReader("{\n \"filters\": {\n \"query\": \"itachi@tyk.io\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{tenant}/api/users/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"filters\": {\n \"query\": \"itachi@tyk.io\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/api/users/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filters\": {\n \"query\": \"itachi@tyk.io\"\n }\n}"
response = http.request(request)
puts response.read_body{
"pages": 1,
"users": [
{
"access_key": "d19fc75cd3aa497f6cb042f72e47ce8c",
"active": true,
"api_model": {},
"created_at": "2024-05-19T08:45:09.53319+03:00",
"email_address": "itachi.w@tyk.io",
"first_name": "sasuke",
"group_id": "",
"id": "363634393931653535373135656334633936636265663261",
"last_login_date": "2024-05-19T08:45:09.53319+03:00",
"last_name": "itachi",
"org_id": "5e9d9544a1dcd60001d0ed20",
"password_max_days": 0,
"password_updated": "2024-05-19T08:45:09.53319+03:00",
"user_permissions": {
"IsAdmin": "admin"
}
}
]
}{
"Message": "Could not extract search filter from request body.",
"Meta": null,
"Status": "Error"
}{
"Message": "Not authorised",
"Meta": null,
"Status": "Error"
}{
"Message": "access denied: You do not have permission to access /api/users/search",
"Meta": null,
"Status": "Error"
}{
"Message": "Could not search users.",
"Meta": null,
"Status": "Error"
}Users
Search user with email.
This endpoint allows you to search for users with their email address (e.g if you send the filter @gmail.com` in the request payload, all users whole email contain the string @gmail.com will be returned).
POST
/
api
/
users
/
search
Search user with email.
curl --request POST \
--url https://{tenant}/api/users/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filters": {
"query": "itachi@tyk.io"
}
}
'import requests
url = "https://{tenant}/api/users/search"
payload = { "filters": { "query": "itachi@tyk.io" } }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({filters: {query: 'itachi@tyk.io'}})
};
fetch('https://{tenant}/api/users/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenant}/api/users/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'filters' => [
'query' => 'itachi@tyk.io'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{tenant}/api/users/search"
payload := strings.NewReader("{\n \"filters\": {\n \"query\": \"itachi@tyk.io\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{tenant}/api/users/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"filters\": {\n \"query\": \"itachi@tyk.io\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/api/users/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filters\": {\n \"query\": \"itachi@tyk.io\"\n }\n}"
response = http.request(request)
puts response.read_body{
"pages": 1,
"users": [
{
"access_key": "d19fc75cd3aa497f6cb042f72e47ce8c",
"active": true,
"api_model": {},
"created_at": "2024-05-19T08:45:09.53319+03:00",
"email_address": "itachi.w@tyk.io",
"first_name": "sasuke",
"group_id": "",
"id": "363634393931653535373135656334633936636265663261",
"last_login_date": "2024-05-19T08:45:09.53319+03:00",
"last_name": "itachi",
"org_id": "5e9d9544a1dcd60001d0ed20",
"password_max_days": 0,
"password_updated": "2024-05-19T08:45:09.53319+03:00",
"user_permissions": {
"IsAdmin": "admin"
}
}
]
}{
"Message": "Could not extract search filter from request body.",
"Meta": null,
"Status": "Error"
}{
"Message": "Not authorised",
"Meta": null,
"Status": "Error"
}{
"Message": "access denied: You do not have permission to access /api/users/search",
"Meta": null,
"Status": "Error"
}{
"Message": "Could not search users.",
"Meta": null,
"Status": "Error"
}Authorizations
The Tyk Dashboard API Access Credentials
Query Parameters
Use p query parameter to say which page you want returned. Send number less than 0 to return all items.
Body
application/json
User search criteria.
Show child attributes
Show child attributes
Was this page helpful?
⌘I