# Batch Update API Is not working even when passed right object

**URL:** <https://community.hubspot.com/t/batch-update-api-is-not-working-even-when-passed-right-object/57495>\
**Category:** APIs & Integrations\
**Tags:** contacts\
**Created:** [May 23, 2022, 11:52am UTC](https://community.hubspot.com/t/batch-update-api-is-not-working-even-when-passed-right-object/57495 "2022-05-23T11:52:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![CMetaliya](https://avatars.discourse-cdn.com/v4/letter/c/c89c15/32.png) [@CMetaliya](https://community.hubspot.com/u/CMetaliya)\
**Post date:** [May 23, 2022, 11:52am UTC](https://community.hubspot.com/t/batch-update-api-is-not-working-even-when-passed-right-object/57495/1 "2022-05-23T11:52:13Z")

</div>

I’m trying to implement batch update functionality in one of my nodeJs applications using Hubspot API and when I call, batch update method of contacts, it returns an empty array and nothing is changed in my hubspot account either.

My request objects is as same as mentioned in the documentation here.

[https://legacydocs.hubspot.com/docs/methods/contacts/batch\_create\_or\_update](https://legacydocs.hubspot.com/docs/methods/contacts/batch_create_or_update)

I’m trying to figure out issue since last two days but didn’t found any solution. Please help.

Here’s the code I’ve implemented so far.

 ![Capture-1.PNG](https://d2qpr2jzcazej7.cloudfront.net/original/3X/4/c/4c28048d016b3d61d8989c2c69f2b0e7e68c4a14.png)

Here’s the response that I got by calling this method.

 ![Capture-1.PNG](https://d2qpr2jzcazej7.cloudfront.net/original/3X/b/4/b4026f803909fbe86907a49b8f145d9ed9165a98.png)

Both contact IDs are present and I’ve obtained those contact IDs from hubspot search API only.

Any help would be highly appreciated.

---

<div class="post-metadata">

**Author:** ![CMetaliya](https://avatars.discourse-cdn.com/v4/letter/c/c89c15/32.png) [@CMetaliya](https://community.hubspot.com/u/CMetaliya)\
**Post date:** [May 23, 2022, 12:56pm UTC](https://community.hubspot.com/t/batch-update-api-is-not-working-even-when-passed-right-object/57495/2 "2022-05-23T12:56:59Z")

</div>

I didn’t get you buddy. TEST means?

---

<div class="post-metadata">

**Author:** ![Teun](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/teun/32/28739_2.png) [@Teun](https://community.hubspot.com/u/Teun)\
**Post date:** [May 23, 2022, 12:57pm UTC](https://community.hubspot.com/t/batch-update-api-is-not-working-even-when-passed-right-object/57495/3 "2022-05-23T12:57:55Z")

</div>

My replies keep getting deleted once I paste code. Let me try this again.  
The NPM package uses the v3 version of the API. So you should use these [docs](https://developers.hubspot.com/docs/api/crm/contacts).

---

<div class="post-metadata">

**Author:** ![Teun](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/teun/32/28739_2.png) [@Teun](https://community.hubspot.com/u/Teun)\
**Post date:** [May 23, 2022, 12:59pm UTC](https://community.hubspot.com/t/batch-update-api-is-not-working-even-when-passed-right-object/57495/4 "2022-05-23T12:59:13Z")

</div>

Your code should look something like this:

```lia-code-sample
const hubspot = require('@hubspot/api-client');

let updateObj = [
 {
 id: '1801',
 properties: [
 { property: 'firstname', value: 'random' },
 { property: 'lastname', value: 'random' },
 { property: 'email', value: 'example@hubspot.com' },
 { property: 'phone', value: '000-000-0000' },
 ]
 },
 {
 id: '1851',
 properties: [
 { property: 'firstname', value: 'random' },
 { property: 'lastname', value: 'random' },
 { property: 'email', value: 'example3@hubspot.com' },
 { property: 'phone', value: '000-000-0000' },
 ]
 }
]

const inputs = JSON.stringify(updateObj)

const BatchInputSimplePublicObjectBatchInput = { inputs: inputs };

try {
 const apiResponse = await hubspotClient.crm.contacts.batchApi.update(BatchInputSimplePublicObjectBatchInput);
 console.log(JSON.stringify(apiResponse.body, null, 2));
} catch (e) {
 e.message === 'HTTP request failed'
 ? console.error(JSON.stringify(e.response, null, 2))
 : console.error(e)
}

```
