Auth0 Home Blog Docs

Email address with + sign is not searchable

If I use a + sign in an email in the users-by-email endpoint it does not work as I would expect.

/api/v2/users-by-email?email=john+doe@gmail.com

returns
{
“statusCode”: 400,
“error”: “Bad Request”,
“message”: “Query validation error: ‘Object didn’t pass validation for format email: john doe@gmail.com’ on property email.”,
“errorCode”: “invalid_query_string”
}

I assume this is because URL encoding is required.

The request as URL encoded is
/api/v2/users-by-email?email=john%2Bdoe@gmail.com

but it returns []

I can see the user in question in the users UI by searching for john+ without changing the Search By, but if I change Search By to email the user is no longer found.

Instead of + sign go with %2B

encodeURIComponent(“john+doe@gmail.com”)
john%2Bdoe%40gmail.com

Thanks Konrad! My issue was that the @ was not URL encoded. It works now.

Perfect! Glad to hear that!