# Custom Contact Sync via API

**URL:** https://forum.mautic.org/t/custom-contact-sync-via-api/9043
**Category:** Product Support
**Created:** [July 25, 2017, 2:06am UTC](https://forum.mautic.org/t/custom-contact-sync-via-api/9043 "2017-07-25T02:06:11Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![conorseed](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/conorseed/32/201_2.png) [@conorseed](https://forum.mautic.org/u/conorseed)
#### Post date: [July 25, 2017, 2:06am UTC](https://forum.mautic.org/t/custom-contact-sync-via-api/9043/1 "2017-07-25T02:06:11Z")

</div>

Hey fam ![:)]( ":)") I’m developing a custom contact sync with a clients booking system, so that when a booking is made the contact is either:  
  
• Imported into Mautic if they don’t exist  
  
• Updated with latest booking info if they do exist  
  
  
  
What’s the best way to check if a contact exists before doing anything via the API?

* * *
  
As a slight side note, with Mailchimp this process is super simple. A contacts ID is simply the MD5 hash of the lowercase version of their email address, so if you do a PUT request with that ID, it does the above automatically - i.e. updates if exists, or create if doesn't. See here: https://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/#

---

<div class="post-metadata">

### Author: ![conorseed](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/conorseed/32/201_2.png) [@conorseed](https://forum.mautic.org/u/conorseed)
#### Post date: [July 25, 2017, 2:06am UTC](https://forum.mautic.org/t/custom-contact-sync-via-api/9043/2 "2017-07-25T02:06:11Z")

</div>

Hey fam 🙂 I’m developing a custom contact sync with a clients booking system, so that when a booking is made the contact is either:  
• Imported into Mautic if they don’t exist  
• Updated with latest booking info if they do exist

What’s the best way to check if a contact exists before doing anything via the API?

* * *

As a slight side note, with Mailchimp this process is super simple. A contacts ID is simply the MD5 hash of the lowercase version of their email address, so if you do a PUT request with that ID, it does the above automatically - i.e. updates if exists, or create if doesn’t. See here: [https://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/#](https://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/#)

---

<div class="post-metadata">

### Author: ![conorseed](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/conorseed/32/201_2.png) [@conorseed](https://forum.mautic.org/u/conorseed)
#### Post date: [August 1, 2017, 1:06am UTC](https://forum.mautic.org/t/custom-contact-sync-via-api/9043/3 "2017-08-01T01:06:45Z")

</div>

Well, I don’t know if it’s the best way to do it but seen as the email address field is unique I did it this way:

1. Search for EMAIL with GET request to /contacts
2. a) If the contact exists, update it with PATCH request  
b) If the contact doesn’t exist (i.e. search comes back empty), create it with POST request

---

<div class="post-metadata">

### Author: ![kgroves](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/kgroves/32/560_2.png) [@kgroves](https://forum.mautic.org/u/kgroves)
#### Post date: [August 3, 2017, 10:47am UTC](https://forum.mautic.org/t/custom-contact-sync-via-api/9043/4 "2017-08-03T10:47:53Z")

</div>

Yep thats the way I tend to go

---

<div class="post-metadata">

### Author: ![conorseed](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/conorseed/32/201_2.png) [@conorseed](https://forum.mautic.org/u/conorseed)
#### Post date: [August 9, 2017, 11:48pm UTC](https://forum.mautic.org/t/custom-contact-sync-via-api/9043/5 "2017-08-09T23:48:33Z")

</div>

Thanks @kgroves - I appreciate the response!! 🙂
