# Error with Inventory Batch Retrieve API

**URL:** <https://developer.squareup.com/forums/t/error-with-inventory-batch-retrieve-api/11194>\
**Category:** Questions\
**Tags:** inventory-api\
**Created:** [November 1, 2023, 4:20am UTC](https://developer.squareup.com/forums/t/error-with-inventory-batch-retrieve-api/11194 "2023-11-01T04:20:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcaitou](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/jcaitou/32/2307_2.png) [@jcaitou](https://developer.squareup.com/forums/u/jcaitou)\
**Post date:** [November 1, 2023, 4:20am UTC](https://developer.squareup.com/forums/t/error-with-inventory-batch-retrieve-api/11194/1 "2023-11-01T04:20:47Z")

</div>

There is something wrong with the inventory batch retrieve API when you use limits.

I am calling /v2/inventory/counts/batch-retrieve to get the counts of 18 product variations over 2 locations.  
If I leave limit unset and make the call, that’s fine. 18 variations x 2 locations is only 56 items to return.  
The return of this call is correct and I get all unique pairs that look like this (for every variation):

```auto
{
      "catalog_object_id": "ITEM_VARIATION_A",
      "location_id": "LOCATION_1",
      "quantity": "20",
...
    },
    {
      "catalog_object_id": "ITEM_VARIATION_A",
      "location_id": "LOCATION_2",
      "quantity": "20",

    }

```

However, I am testing the pagination and so I made the call with a limit of 10, updating the cursor every time and making a new call until cursor is undefined.  
In this scenario, I’m getting specifically one object that is duplicated for location1 and missing its location info for location2.  
So I get this instead (for one item only, specifically)

```auto
{
      "catalog_object_id": "ITEM_VARIATION_A",
      "location_id": "LOCATION_1",
      "quantity": "20",
...
    },
    {
      "catalog_object_id": "ITEM_VARIATION_A",
      "location_id": " **LOCATION_1**",
      "quantity": "20",

    }

```

Now I tested wtih different values for limit, and it keeps happening to a different item, but only one item (the other 54 entries are all unique and correct).

Furthermore, I noticed a second isuse. If the total number of items (56 in my case) is divisble by the value of limit, a cursor is still returned, **even though there is nothing else to actually return**. So specifically for my case, this issue comes up when limit is set to 18 or 56.

Can someone please take a look at this issue?

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [November 1, 2023, 4:40pm UTC](https://developer.squareup.com/forums/t/error-with-inventory-batch-retrieve-api/11194/2 "2023-11-01T16:40:58Z")

</div>

What’s you application ID and is this with sandbox or production? 🙂

---

<div class="post-metadata">

**Author:** ![jcaitou](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/jcaitou/32/2307_2.png) [@jcaitou](https://developer.squareup.com/forums/u/jcaitou)\
**Post date:** [November 2, 2023, 12:26am UTC](https://developer.squareup.com/forums/t/error-with-inventory-batch-retrieve-api/11194/3 "2023-11-02T00:26:51Z")

</div>

The application ID is sandbox-sq0idb-bYENdRHJSvDxxXmnIGanTA  
and this is in Sandbox

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [November 2, 2023, 12:47am UTC](https://developer.squareup.com/forums/t/error-with-inventory-batch-retrieve-api/11194/4 "2023-11-02T00:47:16Z")

</div>

Also what’s the `item_id` that being returned twice and the ID of the one missing? 🙂

---

<div class="post-metadata">

**Author:** ![jcaitou](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/jcaitou/32/2307_2.png) [@jcaitou](https://developer.squareup.com/forums/u/jcaitou)\
**Post date:** [November 2, 2023, 1:01am UTC](https://developer.squareup.com/forums/t/error-with-inventory-batch-retrieve-api/11194/5 "2023-11-02T01:01:19Z")

</div>

It changes depending on the limit that I set. I’ll just give 2 examples. When limit is 10, I get KT7W2SXOIRUZCGYZHGPQADLL back twice.  
When limit is 11, I get Y2Z4YH25LS7XIKONOJ66W4IG back twice.

---

<div class="post-metadata">

**Author:** ![jcaitou](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/jcaitou/32/2307_2.png) [@jcaitou](https://developer.squareup.com/forums/u/jcaitou)\
**Post date:** [November 6, 2023, 3:45am UTC](https://developer.squareup.com/forums/t/error-with-inventory-batch-retrieve-api/11194/6 "2023-11-06T03:45:30Z")

</div>

Hi Bryan, I just want to see if there’s any update with this issue?
