# API Integration - Get contact by email address

**URL:** <https://community.hubspot.com/t/api-integration-get-contact-by-email-address/65039>\
**Category:** APIs & Integrations\
**Tags:** contacts\
**Created:** [September 14, 2022, 2:01am UTC](https://community.hubspot.com/t/api-integration-get-contact-by-email-address/65039 "2022-09-14T02:01:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![atiqah](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@atiqah](https://community.hubspot.com/u/atiqah)\
**Post date:** [September 14, 2022, 2:01am UTC](https://community.hubspot.com/t/api-integration-get-contact-by-email-address/65039/1 "2022-09-14T02:01:55Z")

</div>

Hi, we’re doing the api keys to private apps migration currently.

For one of our integrations, we’re using “Get a contact by email address” [https://legacydocs.hubspot.com/docs/methods/contacts/get\_contact\_by\_email](https://legacydocs.hubspot.com/docs/methods/contacts/get_contact_by_email)

When tested on postman it works (with the private app token) returning 200 and json data.

However when we do the same via our java servlet, it returns 404, which means the email is not found although it is the same email and call.

Do you have any sample code for java?

Or the v3 endpoints for get contact by email? Thanks!

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [September 14, 2022, 8:18pm UTC](https://community.hubspot.com/t/api-integration-get-contact-by-email-address/65039/2 "2022-09-14T20:18:31Z")

</div>

Hi, @atiqah 👋 thanks for reaching out. While I do not have a documented Java example, I can confirm you can use the v3 Contact endpoints to get a Contact by ID (email address for your use case).

Here’s what the documentation states:

“The `idProperty` query parameter doesn’t appear on the Endpoints tab due to technical limitations, but it can be used for contacts exclusively with `email`. **To use an email address** as the unique identifier, set the `idProperty` as `email` and enter the email address in place of the contact ID. This should be set as a query parameter rather than added to the request body.”

[Unique identifiers and deduplication](https://developers.hubspot.com/docs/api/crm/contacts#:~:text=Unique%20identifiers%20and%20deduplication)

I hope this helps a bit. Have fun building! — Jaycee

---

<div class="post-metadata">

**Author:** ![atiqah](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@atiqah](https://community.hubspot.com/u/atiqah)\
**Post date:** [September 15, 2022, 4:00am UTC](https://community.hubspot.com/t/api-integration-get-contact-by-email-address/65039/3 "2022-09-15T04:00:05Z")

</div>

thanks jaycee!

adding idProperty=email in the params works in postman but the java servlet is still returning 404. 😞

Here’s the java code if it helps

```lia-code-sample
URL newUri = new URL("https://api.hubapi.com/crm/v3/objects/contacts/[EMAIL]?idProperty=email");
HttpURLConnection conn = (HttpURLConnection) newUri.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Authorization", "Bearer " + token);
conn.connect();

```

---

<div class="post-metadata">

**Author:** ![atiqah](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@atiqah](https://community.hubspot.com/u/atiqah)\
**Post date:** [September 22, 2022, 8:23am UTC](https://community.hubspot.com/t/api-integration-get-contact-by-email-address/65039/4 "2022-09-22T08:23:46Z")

</div>

Hi Jaycee, still having the 404 issue 😞
