title: Keycloak - How to check if username and email exists
body: <p>We want to create Keycloak users programmatically and check before if the username and/or the email address already exists in Keycloak. We are using version <code>4.4.0.FINAL</code>.</p>
  
  <p>When we create a user programmatically with the Keycloak admin client we're getting the error code 409 (conflict) if the username or the email address is already in use. But we only get one error message in the response (<code>readEntity</code>), namely that the username already exists. The error message doesn't state that the email address is already in use, too.</p>
  
  <p>What is the best way to check if the username and/or the email address already exists in Keycloak?</p>
  
  <p>The goal is to know exactly if an username or an email address already existing or not. And that not only in combination, but also if user A already used the requested username and user B already used the requested mail address.</p>