Skip to main content

Fetch Users By Email Address

You can fetch a user by email address using the Harness API, including users that have not accepted invites.

Before You Begin

Step 1: Fetch Users by Email Address

Here is an example of a query fetching a user by email address:

{  
userByEmail(email:"john.smith@example.io"){
id,
name,
isPasswordExpired,
isEmailVerified,
isImportedFromIdentityProvider,
isTwoFactorAuthenticationEnabled
userGroups(limit: 10, offset: 0) {
nodes {
id
name
}
}
}
}

Here is the output:

{  
"data": {
"userByEmail": {
"id": "8posiNJdThedZOCBlrfv4g",
"name": "John Smith",
"isPasswordExpired": false,
"isEmailVerified": true,
"isImportedFromIdentityProvider": false,
"isTwoFactorAuthenticationEnabled": false,
"userGroups": {
"nodes": [
{
"id": "xxxxxx",
"name": "Account Administrator"
},
{
"id": "xxxxxx",
"name": "CS Dev Mgr"
},
{
"id": "xxxxxx",
"name": "Demo"
},
{
"id": "xxxxxx",
"name": "PagerDuty"
},
{
"id": "xxxxxx",
"name": "admin-se-group"
}
]
}
}
}
}

Limitations

Queries do not support wildcards in email addresses at this time.

See Also

Configure As Code

To see how to configure the settings in this topic using YAML, configure the settings in the UI first, and then click the YAML editor button.