# Hubspot API Scripts - What do you script when the UI fails you?

**URL:** <https://community.hubspot.com/t/hubspot-api-scripts-what-do-you-script-when-the-ui-fails-you/18300>\
**Category:** 💬 RevOps Discussions\
**Tags:** api, operations\
**Created:** [January 23, 2020, 5:28pm UTC](https://community.hubspot.com/t/hubspot-api-scripts-what-do-you-script-when-the-ui-fails-you/18300 "2020-01-23T17:28:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![thesnappingdog](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/thesnappingdog/32/46151_2.png) [@thesnappingdog](https://community.hubspot.com/u/thesnappingdog)\
**Post date:** [January 23, 2020, 5:28pm UTC](https://community.hubspot.com/t/hubspot-api-scripts-what-do-you-script-when-the-ui-fails-you/18300/1 "2020-01-23T17:28:58Z")

</div>

Hi all,

I’m really curious to hear what kind of scripts do you use through the Hubspot API and for what purpose.

Hubspot is an awesome tool, and many things have been made very easy 🙂 However, there are some tedius operations that cannot be done in bulk, and doing them manually is frustrating and feels like a waste of time.

Luckily the API and its documentation is really good, so I started writing scripts to get rid of some things. I’ve used the API for things like:

- Mass update all of our forms through a template form

- Mass clone & edit marketing emails from a template email + .csv data

- Mass delete contact workflows 😂

- copy a set of contact / company properties from a development portal into production

- update all blog articles with a new tag\_id

If it’s useful to anyone, I have a public repository for my hubspot scripts that I update from time to time.

I also wrote a step-by-step for mass updating your hubspot forms with a script.

- [Github repository](https://github.com/thesnappingdog/hubspotscripts)

- [Walkthrough for form update script](https://www.linkedin.com/pulse/hubspot-scale-say-manual-form-updates-richard-makara/)

---

<div class="post-metadata">

**Author:** ![a\_schumacher](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/a_schumacher/32/13327_2.png) [@a\_schumacher](https://community.hubspot.com/u/a_schumacher)\
**Post date:** [January 23, 2020, 7:45pm UTC](https://community.hubspot.com/t/hubspot-api-scripts-what-do-you-script-when-the-ui-fails-you/18300/2 "2020-01-23T19:45:11Z")

</div>

@thesnappingdog thanks so much for sharing-- this repo is awesome! If you ever want to share this outside of this Power User Community, we have a Share Your Work board of the HubSpot Developers forum that this would be a great fit for (if you haven’t shared there already!) [https://community.hubspot.com/t5/Share-Your-Work/bd-p/designers\_bestpractice](https://community.hubspot.com/t5/Share-Your-Work/bd-p/designers_bestpractice)

I wrote a Python script to get all contacts with more than one email address, with the overall goal being to detect & fix contacts that were overwritten by form submissions or from emails being forwarded between contacts. It then identified the oldest (original) email address for those contacts, and returned that value.

I didn’t get to build out this next part, but ideally it would have then deleted the other email addresses on the contact besides the original. But now we have this endpoint in developer preview, [Accounts Dashboard | HubSpot](https://developers.hubspot.com/docs/methods/contacts/get-secondary-email-addresses-by-vid) which made a lot of what I wrote obsolete/overcomplicated 🙂 -Amanda Danielson, HubSpot Success Consultant

---

<div class="post-metadata">

**Author:** ![cooperelias](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cooperelias/32/38372_2.png) [@cooperelias](https://community.hubspot.com/u/cooperelias)\
**Post date:** [January 23, 2020, 10:42pm UTC](https://community.hubspot.com/t/hubspot-api-scripts-what-do-you-script-when-the-ui-fails-you/18300/3 "2020-01-23T22:42:40Z")

</div>

[@a\_schumacher](https://community.hubspot.com/t5/user/viewprofilepage/user-id/11440) - This sounds like it’s probably beyond my capabilities anyway, but how were you able to get all contacts with more than one email address?

Also, thanks for linking to that developer preview endpoint…I hadn’t see that yet!

---

<div class="post-metadata">

**Author:** ![a\_schumacher](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/a_schumacher/32/13327_2.png) [@a\_schumacher](https://community.hubspot.com/u/a_schumacher)\
**Post date:** [January 24, 2020, 8:24pm UTC](https://community.hubspot.com/t/hubspot-api-scripts-what-do-you-script-when-the-ui-fails-you/18300/4 "2020-01-24T20:24:21Z")

</div>

Hey @cooperelias ! Here is the repl.it for how I did it originally just using the contacts API.[https://repl.it/@AmandaDanielson/Clean-Overwritten-Contacts](https://repl.it/@AmandaDanielson/Clean-Overwritten-Contacts) It writes the original addresses for each contact with duplicates to first.csv, and all overwrites to overwrites.csv
