> ## Documentation Index
> Fetch the complete documentation index at: https://docs-staging.auth0-mintlify.app/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Get Specific Users by Auth0 ID or Email

> Retrieve full user profiles for specific users with a matching email address or Auth0 user ID.

export const AuthCodeGroup = ({children, dropdown}) => {
  const [processedChildren, setProcessedChildren] = useState(children);
  useEffect(() => {
    let unsubscribe = null;
    function init() {
      unsubscribe = window.autorun(() => {
        const processChildren = node => {
          if (typeof node === "string") {
            let processedNode = node;
            for (const [key, value] of window.rootStore.variableStore.values.entries()) {
              const escapedKey = key.replaceAll(/[.*+?^${}()|[\]\\]/g, (String.raw)`\$&`);
              processedNode = processedNode.replaceAll(new RegExp(escapedKey, "g"), value);
            }
            return processedNode;
          } else if (Array.isArray(node)) {
            return node.map(processChildren);
          } else if (node && node.props && node.props.children) {
            return {
              ...node,
              props: {
                ...node.props,
                children: processChildren(node.props.children)
              }
            };
          }
          return node;
        };
        setProcessedChildren(processChildren(children));
      });
    }
    if (window.rootStore) {
      init();
    } else {
      window.addEventListener("adu:storeReady", init);
    }
    return () => {
      window.removeEventListener("adu:storeReady", init);
      unsubscribe?.();
    };
  }, [children]);
  return <CodeGroup dropdown={dropdown}>{processedChildren}</CodeGroup>;
};

export const AuthCodeBlock = ({filename, icon, language, highlight, children}) => {
  const [displayText, setDisplayText] = useState(children);
  const [copyText, setCopyText] = useState(children);
  const wrapperRef = React.useRef(null);
  useEffect(() => {
    let unsubscribe = null;
    function init() {
      if (!window.autorun || !window.rootStore) {
        return;
      }
      unsubscribe = window.autorun(() => {
        let processedChildrenForDisplay = children;
        let processedChildrenForCopy = children;
        for (const [key, value] of window.rootStore.variableStore.values.entries()) {
          const escapedKey = key.replaceAll(/[.*+?^${}()|[\]\\]/g, (String.raw)`\$&`);
          let displayValue = value;
          if (key === "{yourClientSecret}" && value !== "{yourClientSecret}") {
            displayValue = value.substring(0, 3) + "*****MASKED*****";
          }
          processedChildrenForDisplay = processedChildrenForDisplay.replaceAll(new RegExp(escapedKey, "g"), displayValue);
          processedChildrenForCopy = processedChildrenForCopy.replaceAll(new RegExp(escapedKey, "g"), value);
        }
        setDisplayText(processedChildrenForDisplay);
        setCopyText(processedChildrenForCopy);
      });
    }
    if (window.rootStore) {
      init();
    } else {
      window.addEventListener("adu:storeReady", init);
    }
    return () => {
      window.removeEventListener("adu:storeReady", init);
      unsubscribe?.();
    };
  }, [children]);
  useEffect(() => {
    if (!wrapperRef.current) return;
    const originalWriteText = navigator.clipboard.writeText.bind(navigator.clipboard);
    let isOverriding = false;
    const handleClick = e => {
      const button = e.target.closest('[data-testid="copy-code-button"]');
      if (!button || !wrapperRef.current.contains(button)) return;
      isOverriding = true;
      navigator.clipboard.writeText = text => {
        if (isOverriding) {
          isOverriding = false;
          navigator.clipboard.writeText = originalWriteText;
          return originalWriteText(copyText);
        }
        return originalWriteText(text);
      };
      setTimeout(() => {
        if (isOverriding) {
          isOverriding = false;
          navigator.clipboard.writeText = originalWriteText;
        }
      }, 100);
    };
    const wrapper = wrapperRef.current;
    wrapper.addEventListener('click', handleClick, true);
    return () => {
      wrapper.removeEventListener('click', handleClick, true);
      if (navigator.clipboard.writeText !== originalWriteText) {
        navigator.clipboard.writeText = originalWriteText;
      }
    };
  }, [copyText]);
  return <div ref={wrapperRef}>
      <CodeBlock filename={filename} icon={icon} language={language} lines highlight={highlight}>
        {displayText}
      </CodeBlock>
    </div>;
};

You can retrieve specific user profiles by email or user ID using the Auth0 Dashboard or the Management API.

<Tabs>
  <Tab title="Auth0 Dashboard">
    To get a specific user by email address or user ID using the Auth0 Dashboard:

    1. Go to [Dashboard > User Management > Users](https://manage.auth0.com/#/users).

           <img src="https://mintlify.s3.us-west-1.amazonaws.com/docs-staging/docs/images/user-management/users.png" alt="The Users page in the Auth0 Dashboard" />

    2. In the **Search by** drop-down menu, select **User** to search by user ID or **Email** to search by email address.

    3. In the search field, enter the user ID or email address you want to search for.

    4. In the results, open the **...** menu for the user and select **View details** to go to the user's full profile.
  </Tab>

  <Tab title="Management API">
    The Management API provides two endpoints for getting specific users:

    * The [Get a User endpoint](/docs/api/management/v2/users/get-users-by-id) (`GET /users/{id}`) retrieves a specific user's details by their user ID.

    * The [Search Users by Email endpoint](/docs/api/management/v2/users-by-email/get-users-by-email) (`GET /users-by-email`) retrieves user details that match the given email address.

    These Management API endpoints are immediately consistent, so the results reflect all successful write operations, including those that occurred shortly prior to the request. Therefore, you can use these endpoints for user searches during authentication or account linking.

    To get a specific user by user ID, call the [Get a User endpoint](/docs/api/management/v2/users/get-users-by-id) (`GET /users/{id}`) and pass the URL-encoded user ID as the [`id` path parameter](/docs/api/management/v2/users/get-users-by-id#parameter-id):

    <AuthCodeGroup>
      ```bash curl theme={null}
      curl --request GET \
        --url 'https://{yourDomain}/api/v2/users/%7BuserId%7D' \
        --header 'authorization: Bearer {yourMgmtApiAccessToken}'
      ```

      ```csharp C# theme={null}
      var client = new RestClient("https://{yourDomain}/api/v2/users/%7BuserId%7D");
      var request = new RestRequest(Method.GET);
      request.AddHeader("authorization", "Bearer {yourMgmtApiAccessToken}");
      IRestResponse response = client.Execute(request);
      ```

      ```go Go theme={null}
      package main

      import (
      	"fmt"
      	"net/http"
      	"io/ioutil"
      )

      func main() {
      	url := "https://{yourDomain}/api/v2/users/%7BuserId%7D"
      	req, _ := http.NewRequest("GET", url, nil)
      	req.Header.Add("authorization", "Bearer {yourMgmtApiAccessToken}")

      	res, _ := http.DefaultClient.Do(req)
      	defer res.Body.Close()
      	body, _ := ioutil.ReadAll(res.Body)

      	fmt.Println(res)
      	fmt.Println(string(body))
      }
      ```

      ```java Java theme={null}
      HttpResponse<String> response = Unirest.get("https://{yourDomain}/api/v2/users/%7BuserId%7D")
        .header("authorization", "Bearer {yourMgmtApiAccessToken}")
        .asString();
      ```

      ```javascript Node.JS theme={null}
      var axios = require("axios").default;

      var options = {
        method: 'GET',
        url: 'https://{yourDomain}/api/v2/users/%7BuserId%7D',
        headers: {authorization: 'Bearer {yourMgmtApiAccessToken}'}
      };

      axios.request(options).then(function (response) {
        console.log(response.data);
      }).catch(function (error) {
        console.error(error);
      });
      ```

      ```php PHP theme={null}
      $curl = curl_init();

      curl_setopt_array($curl, [
        CURLOPT_URL => "https://{yourDomain}/api/v2/users/%7BuserId%7D",
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "GET",
        CURLOPT_HTTPHEADER => [
          "authorization: Bearer {yourMgmtApiAccessToken}"
        ],
      ]);

      $response = curl_exec($curl);
      $err = curl_error($curl);

      curl_close($curl);

      if ($err) {
        echo "curl Error #:" . $err;
      } else {
        echo $response;
      }
      ```

      ```python Python theme={null}
      import http.client

      conn = http.client.HTTPSConnection("")
      headers = { 'authorization': "Bearer {yourMgmtApiAccessToken}" }
      conn.request("GET", "/{yourDomain}/api/v2/users/%7BuserId%7D", headers=headers)

      res = conn.getresponse()
      data = res.read()

      print(data.decode("utf-8"))
      ```

      ```ruby Ruby theme={null}
      require 'uri'
      require 'net/http'
      require 'openssl'

      url = URI("https://{yourDomain}/api/v2/users/%7BuserId%7D")

      http = Net::HTTP.new(url.host, url.port)
      http.use_ssl = true
      http.verify_mode = OpenSSL::SSL::VERIFY_NONE

      request = Net::HTTP::Get.new(url)
      request["authorization"] = 'Bearer {yourMgmtApiAccessToken}'

      response = http.request(request)
      puts response.read_body
      ```
    </AuthCodeGroup>

    To get a specific user by email address, call the [Search Users by Email endpoint](/docs/api/management/v2/users-by-email/get-users-by-email) (`GET /users-by-email`) and pass the email address as the [`email` query parameter](/docs/api/management/v2/users-by-email/get-users-by-email#parameter-email):

    <AuthCodeGroup>
      ```bash curl theme={null}
      curl --request GET \
        --url 'https://{yourDomain}/api/v2/users-by-email?email=%7BuserEmailAddress%7D' \
        --header 'authorization: Bearer {yourMgmtApiAccessToken}'
      ```

      ```csharp C# theme={null}
      var client = new RestClient("https://{yourDomain}/api/v2/users-by-email?email=%7BuserEmailAddress%7D");
      var request = new RestRequest(Method.GET);
      request.AddHeader("authorization", "Bearer {yourMgmtApiAccessToken}");
      IRestResponse response = client.Execute(request);
      ```

      ```go Go theme={null}
      package main

      import (
      	"fmt"
      	"net/http"
      	"io/ioutil"
      )

      func main() {
      	url := "https://{yourDomain}/api/v2/users-by-email?email=%7BuserEmailAddress%7D"
      	req, _ := http.NewRequest("GET", url, nil)
      	req.Header.Add("authorization", "Bearer {yourMgmtApiAccessToken}")

      	res, _ := http.DefaultClient.Do(req)
      	defer res.Body.Close()
      	body, _ := ioutil.ReadAll(res.Body)

      	fmt.Println(res)
      	fmt.Println(string(body))
      }
      ```

      ```java Java theme={null}
      HttpResponse<String> response = Unirest.get("https://{yourDomain}/api/v2/users-by-email?email=%7BuserEmailAddress%7D")
        .header("authorization", "Bearer {yourMgmtApiAccessToken}")
        .asString();
      ```

      ```javascript Node.JS theme={null}
      var axios = require("axios").default;

      var options = {
        method: 'GET',
        url: 'https://{yourDomain}/api/v2/users-by-email',
        params: {email: '{userEmailAddress}'},
        headers: {authorization: 'Bearer {yourMgmtApiAccessToken}'}
      };

      axios.request(options).then(function (response) {
        console.log(response.data);
      }).catch(function (error) {
        console.error(error);
      });
      ```

      ```php PHP theme={null}
      $curl = curl_init();

      curl_setopt_array($curl, [
        CURLOPT_URL => "https://{yourDomain}/api/v2/users-by-email?email=%7BuserEmailAddress%7D",
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "GET",
        CURLOPT_HTTPHEADER => [
          "authorization: Bearer {yourMgmtApiAccessToken}"
        ],
      ]);

      $response = curl_exec($curl);
      $err = curl_error($curl);

      curl_close($curl);

      if ($err) {
        echo "curl Error #:" . $err;
      } else {
        echo $response;
      }
      ```

      ```python Python theme={null}
      import http.client
      conn = http.client.HTTPSConnection("")
      headers = { 'authorization': "Bearer {yourMgmtApiAccessToken}" }
      conn.request("GET", "/{yourDomain}/api/v2/users-by-email?email=%7BuserEmailAddress%7D", headers=headers)

      res = conn.getresponse()
      data = res.read()

      print(data.decode("utf-8"))
      ```

      ```ruby Ruby theme={null}
      require 'uri'
      require 'net/http'
      require 'openssl'

      url = URI("https://{yourDomain}/api/v2/users-by-email?email=%7BuserEmailAddress%7D")

      http = Net::HTTP.new(url.host, url.port)
      http.use_ssl = true
      http.verify_mode = OpenSSL::SSL::VERIFY_NONE

      request = Net::HTTP::Get.new(url)
      request["authorization"] = 'Bearer {yourMgmtApiAccessToken}'

      response = http.request(request)
      puts response.read_body
      ```
    </AuthCodeGroup>
  </Tab>
</Tabs>
