# Create or update a contact

**URL:** <https://community.hubspot.com/t/create-or-update-a-contact/63523>\
**Category:** APIs & Integrations\
**Tags:** contacts\
**Created:** [August 23, 2022, 9:42am UTC](https://community.hubspot.com/t/create-or-update-a-contact/63523 "2022-08-23T09:42:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MGabre](https://avatars.discourse-cdn.com/v4/letter/m/b487fb/32.png) [@MGabre](https://community.hubspot.com/u/MGabre)\
**Post date:** [August 23, 2022, 9:42am UTC](https://community.hubspot.com/t/create-or-update-a-contact/63523/1 "2022-08-23T09:42:50Z")

</div>

Hi,

I have been using the createorupdate contact endpoint for posting contacts from another site into hubspot, using the email as identifier.

`[https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/${email}?hapikey=${API\_KEY](https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/$%7Bemail%7D?hapikey=$%7BAPI_KEY)}`

But now I need to migrate over to use the private app integration and I can’t find a easy way to achive the same thing using the endpoints described here: [Accounts Dashboard | HubSpot](https://developers.hubspot.com/docs/api/crm/contacts)

If I use the create endpoint, I get an error if the contact with that email already exist, and if I use the update endpoint I need to know the internal ID of the contact in hubspot in order to be able to update it? And in my case I only have the email in the other posting site.

---

<div class="post-metadata">

**Author:** ![coldrickjack](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/coldrickjack/32/6684_2.png) [@coldrickjack](https://community.hubspot.com/u/coldrickjack)\
**Post date:** [August 23, 2022, 11:28am UTC](https://community.hubspot.com/t/create-or-update-a-contact/63523/2 "2022-08-23T11:28:00Z")

</div>

Hey @MGabre,

You can use the email address of the contact providing you append the “idProperty=email” parameter to your query string. This is documented [here](https://developers.hubspot.com/docs/api/crm/contacts) under “Unique identifiers and duplication”. See below for a sample of a request to update the phone number of a known contact using their email address:

```lia-code-sample
curl --location --request PATCH 'https://api.hubapi.com/crm/v3/objects/contacts/{{email}}?idProperty=email' \
--header 'Authorization: Bearer {{access_token}}' \
--header 'Content-Type: application/json' \
--data-raw '{
 "properties": {
 "phone": "2132323423"
 }
}'

```

Hope this helps!

---

<div class="post-metadata">

**Author:** ![MGabre](https://avatars.discourse-cdn.com/v4/letter/m/b487fb/32.png) [@MGabre](https://community.hubspot.com/u/MGabre)\
**Post date:** [August 23, 2022, 2:19pm UTC](https://community.hubspot.com/t/create-or-update-a-contact/63523/3 "2022-08-23T14:19:47Z")

</div>

Thank you! I missed that part with the idProperty. That worked for updating a contact by email.

But to achieve the createOrUpdate feature that was availalbe in the older API I guess I need to first try to POST the contact, and if I recieve a 409 error I need to do the PATCH request to update the contact.

---

<div class="post-metadata">

**Author:** ![coldrickjack](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/coldrickjack/32/6684_2.png) [@coldrickjack](https://community.hubspot.com/u/coldrickjack)\
**Post date:** [August 23, 2022, 3:29pm UTC](https://community.hubspot.com/t/create-or-update-a-contact/63523/4 "2022-08-23T15:29:55Z")

</div>

Hey @MGabre , that is correct the newer CRM APIs don’t support a single endpoint for creating/updating records. You’d need to approach it with 2 separate requests in the manner you’ve described.

---

<div class="post-metadata">

**Author:** ![SYakovian](https://avatars.discourse-cdn.com/v4/letter/s/c0e974/32.png) [@SYakovian](https://community.hubspot.com/u/SYakovian)\
**Post date:** [January 1, 2024, 12:25am UTC](https://community.hubspot.com/t/create-or-update-a-contact/63523/5 "2024-01-01T00:25:12Z")

</div>

Hi @MGabre \ @coldrickjack

I have the same issue you mentions here, I’m using the first time HubSpot API, and we need to develop for update and create contact via the API every day in the same endpoint and don’t want to separate for 2 endpoints, do you solve it in some way?

I saw in the old version was the optopn to update and create for 1 contact

[https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/XXXXX@XXX.COM](https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/yonico@playtika.com)

Many thanks 🙂 Sapir
