I need to create and update companies and contacts from our external data source. Because HubSpot doesn’t have an “upsert” capability, I need to query for a contact by email and either create or update the contact based on if it exists or not. I’m doing this by using the “retrieve contact” endpoint and creating the contact if it returns 404 and updating if it returns a 200. I’ve noticed that the rate limit documentation says that it error responses must be less than 5% of total API calls. If this is the case, what is the best way to handle the flow that I need? I’m going to have the same problem if I just attempt to create the contact every time I get it, as attempting to create an already-existing contact will return a 409 error.
I just noticed the "search for contacts’ endpoint which I think will do what I’m wanting, as it returns objects or an empty list instead of an error.
@j.miles if you already have the email, you can use this endpoint to either update an existing contact with that email, or create a new contact if there is no existing record with that email:
You can also create or update multiple contacts in a single request:
Ahh. So you DO have upsert capability. Perhaps I should read the documentation more carefully . Thanks a lot!