Square: Batch Retrieve Inventory Changes
Square inventory.batchRetrieveInventoryChanges: arguments, response, policy and SDK examples.
← Inventory operations · Get started
Operation square.batchretrieveinventorychanges
Provider route: POST /v2/inventory/changes/batch-retrieve. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/square with npm, or alter-sdk-square with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { SquareIntegration } from "@alter-ai/square";
async function execute(input: Parameters<SquareIntegration["inventory"]["batchRetrieveInventoryChanges"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new SquareIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.inventory.batchRetrieveInventoryChanges(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_square import SquareIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = SquareIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.inventory.batch_retrieve_inventory_changes(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
body | Model | Required within parent | Expand Batch Retrieve Inventory Changes — request body — body |
Referenced models: Batch Retrieve Inventory Changes — request body — body
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Batch Retrieve Inventory Changes — response body |
Referenced models: Batch Retrieve Inventory Changes — response body
Schemas
Section titled “Schemas”12 more schemas are linked from the tables above, on the schema pages.
Batch Retrieve Inventory Changes — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
catalog_object_ids | JSON | Optional | |
catalog_object_ids (anyOf 1) | array | Alternative | The filter to return results by `CatalogObject` ID. The filter is only applicable when set. The default value is null. |
catalog_object_ids (anyOf 1)[] | string | Each item | |
catalog_object_ids (anyOf 2) | null | Alternative | |
cursor | JSON | Optional | |
cursor (anyOf 1) | string | Alternative | A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query. See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. |
cursor (anyOf 2) | null | Alternative | |
limit | JSON | Optional | |
limit (anyOf 1) | integer | Alternative | The number of [records](entity:InventoryChange) to return. Maximum: 1000 Minimum: 1 |
limit (anyOf 2) | null | Alternative | |
location_ids | JSON | Optional | |
location_ids (anyOf 1) | array | Alternative | The filter to return results by `Location` ID. The filter is only applicable when set. The default value is null. |
location_ids (anyOf 1)[] | string | Each item | |
location_ids (anyOf 2) | null | Alternative | |
reason_ids | JSON | Optional | |
reason_ids (anyOf 1) | array | Alternative | The filter to return `ADJUSTMENT` query results by inventory adjustment reason. This filter is only applied when set. The request cannot include both `reason_ids` and `states`. |
reason_ids (anyOf 1)[] | Model | Each item | Expand Delete Inventory Adjustment Reason — request body — body reason id |
reason_ids (anyOf 2) | null | Alternative | |
sort | JSON | Optional | |
sort (anyOf 1) | Model | Alternative | Expand Batch Retrieve Inventory Changes — request body — body sort field, order Specification of how returned inventory changes should be ordered. Currently, inventory changes can only be ordered by the occurred_at field. The default sort order for occurred_at is ASC (changes are returned oldest-first by default). |
sort (anyOf 2) | null | Alternative | |
states | JSON | Optional | |
states (anyOf 1) | array | Alternative | The filter to return `ADJUSTMENT` query results by `InventoryState`. This filter is only applied when set. The default value is null. |
states (anyOf 1)[] | string | Each item | Indicates the state of a tracked item quantity in the lifecycle of goods. One of: CUSTOM, IN_STOCK, SOLD, RETURNED_BY_CUSTOMER, RESERVED_FOR_SALE, SOLD_ONLINE, ORDERED_FROM_VENDOR, RECEIVED_FROM_VENDOR, IN_TRANSIT_TO, NONE, WASTE, UNLINKED_RETURN, COMPOSED, DECOMPOSED, SUPPORTED_BY_NEWER_VERSION, IN_TRANSIT, UNTRACKED |
states (anyOf 2) | null | Alternative | |
types | JSON | Optional | |
types (anyOf 1) | array | Alternative | The filter to return results by `InventoryChangeType` values other than `TRANSFER`. The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`. |
types (anyOf 1)[] | string | Each item | Indicates how the inventory change was applied to a tracked product quantity. One of: PHYSICAL_COUNT, ADJUSTMENT |
types (anyOf 2) | null | Alternative | |
updated_after | JSON | Optional | |
updated_after (anyOf 1) | string | Alternative | The filter to return results with their `calculated_at` value after the given time as specified in an RFC 3339 timestamp. The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). |
updated_after (anyOf 2) | null | Alternative | |
updated_before | JSON | Optional | |
updated_before (anyOf 1) | string | Alternative | The filter to return results with their `created_at` or `calculated_at` value strictly before the given time as specified in an RFC 3339 timestamp. The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). |
updated_before (anyOf 2) | null | Alternative |
Referenced models: Batch Retrieve Inventory Changes — request body — body sort field, order, Delete Inventory Adjustment Reason — request body — body reason id
Batch Retrieve Inventory Changes — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
changes | array | Optional | The current calculated inventory changes for the requested objects and locations. |
changes[] | Model | Each item | Expand Batch Change Inventory — response body — changes item |
cursor | string | Optional | The pagination cursor to be used in a subsequent request. If unset, this is the final response. See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. |
errors | array | Optional | Any errors that occurred during the request. |
errors[] | Model | Each item | Expand Get Shift — response body — errors item |
Referenced models: Get Shift — response body — errors item, Batch Change Inventory — response body — changes item
Batch Retrieve Inventory Changes — request body — body sort field, order
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
field | JSON | Optional | |
field (anyOf 1) | string | Alternative | The field to sort inventory changes by. See [Field](#type-field) for possible values One of: OCCURRED_AT |
field (anyOf 2) | null | Alternative | |
order | JSON | Optional | |
order (anyOf 1) | string | Alternative | The order (e.g., chronological or alphabetical) in which results from a request are returned. The order to sort inventory changes by. See [SortOrder](#type-sortorder) for possible values One of: DESC, ASC |
order (anyOf 2) | null | Alternative |
Delete Inventory Adjustment Reason — request body — body reason id
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Identifies a standard or custom inventory adjustment reason. |
custom_reason_id | JSON | Optional | |
custom_reason_id (anyOf 1) | string | Alternative | The Square-generated ID of the custom adjustment reason. This field is only set when `type` is `CUSTOM`. Maximum length: 100 |
custom_reason_id (anyOf 2) | null | Alternative | |
type | Model | Required within parent | Expand Delete Inventory Adjustment Reason — request body — body reason id type The adjustment reason type. See [Type](#type-type) for possible values |
Referenced models: Delete Inventory Adjustment Reason — request body — body reason id type
Get Shift — response body — errors item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents an error encountered during a request to the Connect API. See [Handling errors](https://developer.squareup.com/docs/build-basics/handling-errors) for more information. |
category | string | Required within parent | Indicates which high-level category of error has occurred during a request to the Connect API. The high-level category for the error. See [ErrorCategory](#type-errorcategory) for possible values Known values: API_ERROR, AUTHENTICATION_ERROR, INVALID_REQUEST_ERROR, RATE_LIMIT_ERROR, PAYMENT_METHOD_ERROR, REFUND_ERROR, MERCHANT_SUBSCRIPTION_ERROR, EXTERNAL_VENDOR_ERROR |
code | Model | Required within parent | Expand Get Shift — response body — errors item code The specific code of the error. See [ErrorCode](#type-errorcode) for possible values |
detail | string | Optional | A human-readable description of the error for debugging purposes. |
field | string | Optional | The name of the field provided in the original request (if any) that the error pertains to. |
Referenced models: Get Shift — response body — errors item code
Delete Inventory Adjustment Reason — request body — body reason id type
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | string | Root | The type of inventory adjustment reason. Custom reasons use `CUSTOM` and include a `custom_reason_id`. Standard seller-selectable reasons use `RECEIVED`, `DAMAGED`, `THEFT`, `LOST`, `RETURNED`, `SPOILAGE_WASTE`, `SAMPLES_PROMOTIONAL`, `INTERNAL_USE`, `VENDOR_RETURN`, or `PRODUCTION_WASTE`. The writable standard reasons with direction `INCREASE` are `RECEIVED` and `RETURNED`. The writable standard reasons with direction `DECREASE` are `DAMAGED`, `THEFT`, `LOST`, `SPOILAGE_WASTE`, `SAMPLES_PROMOTIONAL`, `INTERNAL_USE`, `VENDOR_RETURN`, and `PRODUCTION_WASTE`. The `SALE`, `RECOUNT`, `TRANSFER`, `IN_TRANSIT`, and `CANCELED_SALE` values identify system-generated inventory events. These values can be returned by Square, but cannot be used when writing inventory adjustments. One of: RECEIVED, DAMAGED, THEFT, LOST, RETURNED, SPOILAGE_WASTE, SAMPLES_PROMOTIONAL, INTERNAL_USE, VENDOR_RETURN, PRODUCTION_WASTE, SALE, RECOUNT, TRANSFER, IN_TRANSIT, CANCELED_SALE, CUSTOM |
Batch Change Inventory — response body — changes item measurement unit measurement unit area unit, custom unit, generic unit, length unit, time unit, type, volume unit, weight unit custom unit abbreviation, name
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | The information needed to define a custom unit, provided by the seller. |
abbreviation | string | Required within parent | The abbreviation of the custom unit, such as "bsh" (bushel). This appears in the cart for the Point of Sale app, and in reports. |
name | string | Required within parent | The name of the custom unit, for example "bushel". |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: square.batchretrieveinventorychanges. Catalog operation: BatchRetrieveInventoryChanges. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Required provider scopes: ["INVENTORY_READ"]
Pinned headers: {"Square-Version": "2026-11-18"}