# Update contacts with python API - batch mode

**URL:** <https://community.hubspot.com/t/update-contacts-with-python-api-batch-mode/66753>\
**Category:** APIs & Integrations\
**Tags:** contacts\
**Created:** [October 8, 2022, 7:46am UTC](https://community.hubspot.com/t/update-contacts-with-python-api-batch-mode/66753 "2022-10-08T07:46:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ioteo](https://avatars.discourse-cdn.com/v4/letter/i/53a042/32.png) [@ioteo](https://community.hubspot.com/u/ioteo)\
**Post date:** [October 8, 2022, 7:46am UTC](https://community.hubspot.com/t/update-contacts-with-python-api-batch-mode/66753/1 "2022-10-08T07:46:00Z")

</div>

Hello! 🙂

I am trying to use the python API to update a set of HS contacts. I am able to do this contact by contact (with a for loop), but I would like to do this in batch mode.  
Reading the documentation, I see that the input properties have to be in this format:  
inputs=[{“id”:“1”,“properties”:{“company”:“Biglytics”,“email”:“[bcooper@biglytics.net](mailto:bcooper@biglytics.net)”,“firstname”:“Bryan”,“lastname”:“Cooper”,“phone”:“(877) 929-0687”,“website”:“[biglytics.net](http://biglytics.net/)”}}]  
and I am wondering if there is a simple way to convert a python dictionary or list to this format? I’ve done something similar with the SimplePublicObjectInput, with something like:  
SimplePublicObjectInput(properties=properties\_ccontacts[0])  
and this creates the formatting needed for the “simple” (not batch) API to work. But I haven’t found in the documentation something similar for the batch api.  
Many thanks,  
Iván.

---

<div class="post-metadata">

**Author:** ![MiaSrebrnjak](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/miasrebrnjak/32/10_2.png) [@MiaSrebrnjak](https://community.hubspot.com/u/MiaSrebrnjak)\
**Post date:** [October 11, 2022, 10:17am UTC](https://community.hubspot.com/t/update-contacts-with-python-api-batch-mode/66753/2 "2022-10-11T10:17:08Z")

</div>

Hi @ioteo,

Thank you for reaching out to the Community!

I wonder if @MatthiasWeber & @taran42 could help us out? Thank you! ⭐

Cheers  
Mia, Community Team

---

<div class="post-metadata">

**Author:** ![MatthiasWeber](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/matthiasweber/32/27498_2.png) [@MatthiasWeber](https://community.hubspot.com/u/MatthiasWeber)\
**Post date:** [October 11, 2022, 10:39am UTC](https://community.hubspot.com/t/update-contacts-with-python-api-batch-mode/66753/3 "2022-10-11T10:39:08Z")

</div>

i’m sorry. No knowledge in python. Sorry.

---

<div class="post-metadata">

**Author:** ![MiaSrebrnjak](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/miasrebrnjak/32/10_2.png) [@MiaSrebrnjak](https://community.hubspot.com/u/MiaSrebrnjak)\
**Post date:** [October 19, 2022, 7:55am UTC](https://community.hubspot.com/t/update-contacts-with-python-api-batch-mode/66753/4 "2022-10-19T07:55:14Z")

</div>

No worries Matthias, thank you for letting me know! 🙏

---

<div class="post-metadata">

**Author:** ![ChrisoKlepke](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/chrisoklepke/32/11213_2.png) [@ChrisoKlepke](https://community.hubspot.com/u/ChrisoKlepke)\
**Post date:** [October 19, 2022, 7:46am UTC](https://community.hubspot.com/t/update-contacts-with-python-api-batch-mode/66753/5 "2022-10-19T07:46:24Z")

</div>

Hey

not quite sure if I follow you, but there is a class called _BatchInputSimplePublicObjectBatchInput_ that you could use in this scenario, where you can pull in a list of dictionaries into the input. It looks something like this:

updateInputs = BatchInputSimplePublicObjectBatchInput( inputs=[{ “id”: “1”, “properties”: { “company”: “Biglytics”, “email”: “[bcooper@biglytics.net](mailto:bcooper@biglytics.net)”, “firstname”: “Bryan”, “lastname”: “Cooper”, “phone”: “(877) 929-0687”, “website”: “[biglytics.net](http://biglytics.net)”, }, }, { “id”: “1”, “properties”: { “company”: “Biglytics”, “email”: “[bcooper@biglytics.net](mailto:bcooper@biglytics.net)”, “firstname”: “Bryan”, “lastname”: “Cooper”, “phone”: “(877) 929-0687”, “website”: “[biglytics.net](http://biglytics.net)”, }, }, ] )

You can then use that as an argument of the request in _batch\_input\_simple\_public\_object\_batch\_input_ like this:

updateContacts = hubspot.crm.contacts.batch\_api.update( batch\_input\_simple\_public\_object\_batch\_input=updateInputs )

Sorry about the formatting, but the system won’t let me post with code blocks and proper highlighting.

Maybe you knew this already, so please give some more detail regarding your original question.

But if you found this post helpful, consider helping others in the community to find answers faster by marking this as a solution. I’d really appreciate it.

Cheers,

Chriso

---

<div class="post-metadata">

**Author:** ![MiaSrebrnjak](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/miasrebrnjak/32/10_2.png) [@MiaSrebrnjak](https://community.hubspot.com/u/MiaSrebrnjak)\
**Post date:** [October 19, 2022, 7:55am UTC](https://community.hubspot.com/t/update-contacts-with-python-api-batch-mode/66753/6 "2022-10-19T07:55:56Z")

</div>

Thank you Chriso! 🙂
