Batch API 207 status code

Hi,

I am using Batch API, to update the line items. I have passed invalid hubspot Record IDs to the Line Item Batch Update API. So we are assuming that the response will have errors, But the actial response has 207 status, 0 errors and empty results. Upon reviewing the Batch API documenation, the Batch API has set of status PENDING, PROCESSING, COMPLETED. How can i handle the situation where the Batch API status was PROCESSING initial and then later changed to COMPLETED. is there any polling or do we have webhook to handle this situation.

Hey @SwaroopNagothi,

Welcome to the Community!

About the 207 response, based on the documentation this kind of response is meant for batch create requests, and only when you specifically opt in by tagging each item with a unique tracking ID. For batch updates with invalid Record IDs, there’s no documented way to opt into that same partial-success behavior, so I can’t confirm from the docs whether you’d actually see a 207 with an empty results list and zero errors in that scenario.

Here are a couple of relevant resources you may find helpful!

That said, I’d like to tag in some of our Top Contributors to see if they have any experience with this!

Hey @Anton, @SteveHTM, @zach_threadint -- Do you have any suggestions for @SwaroopNagothi on this?

Thanks in advance!

Sam, Community Manager

@SwaroopNagothi -- I have a recent example of this batch response which is related to a batch retrieve API call: Retrieve a batch of contacts - HubSpot docs.

The intent was to query for a list of email addresses for contacts - the 207 response indicated that I had a list returned in two parts - the first ‘results’ array contained existing instances of these email addresses as contacts. The errors array contained a set of emails not already known in the database. I did not need to set the unique ‘objectWriteTraceId’ value - that may be important for more complex create operations etc.

This was a very useful call result in my circumstances, and could be useful to other who don’t want to roll the dice on a partial update or upsert operation based on an initial list of data, but may want to split the list between items that exist and don’t exist. I assume with a large set of values, the return status could also be ‘pending’ but I have not encountered that as yet.

Hope this is helpful.

Steve