Users with email endpoint search with plus in email address

https://.auth0.com/api/v2/users-by-email?email=

example email address firstname.surname+1@gmail.com : returns 404
encode email address: returns 404.

there seems to be an issue with the +

also tried:
https://auth0.com/api/v2/users?search_engine=v3&q=email.raw:“firstname.surname+1@gmail.com”
and

https://auth0.com/api/v2/users?search_engine=v3&q=email.raw:“firstname.surname%2B1%40gmail.com”

1%40gmail.com"
returns 404

Hi @Kush1

Welcome back to the Auth0 Community!

I understand you are asking why Auth0 user lookups fail when the email address contains a plus sign, such as firstname.surname+1@gmail.com, when using the Management API users-by-email and users search endpoints. The key point is that the plus sign must be URL-encoded as %2B, and unencoded + is interpreted as a space in query strings.

Official Recommended steps

Use the following steps in order for the Management API calls to correctly return the list of users that contain a plus ( + ) character in their email address:

  1. Use the /api/v2/users-by-email endpoint with the full email address and URL-encode the plus sign as %2B, because Auth0 community guidance shows that unencoded + is treated as a space and causes the lookup to fail;
  2. Call the endpoint in this format for your example email address:
    https://YOUR_DOMAIN.auth0.com/api/v2/users-by-email?email=firstname.surname%2B1@gmail.com;
  3. Avoid using an incomplete tenant domain such as https://.auth0.com, because the Management API request must target your actual Auth0 tenant domain in the format https://YOUR_DOMAIN.auth0.com;
  4. Use the /api/v2/users search endpoint only if needed, and ensure the query string itself is encoded correctly when searching for an email containing +;
  5. Verify that the request includes a valid Management API access token with the required scope, because a true 404 can also indicate that the request is being sent to the wrong domain or path rather than a search parsing issue;
  6. Prefer the dedicated Search Users by Email endpoint for exact email lookups, because Auth0 provides that endpoint specifically for email-based retrieval.

Additional documentation that might prove useful in future implementations: How to use Plus Signs (+) in Email Addresses With the login_hint Parameter.

We hope this information helped you receive the correct response from the Management API calls!

Kind Regards,
Nik