Skip to content

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.

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 os
from alter_sdk import App
from 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()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
bodyModelRequired within parentExpand Batch Retrieve Inventory Changes — request body — body

Referenced models: Batch Retrieve Inventory Changes — request body — body

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$ModelRootExpand Batch Retrieve Inventory Changes — response body

Referenced models: Batch Retrieve Inventory Changes — response body

12 more schemas are linked from the tables above, on the schema pages.

Batch Retrieve Inventory Changes — request body — body
FieldTypePresenceDescription and constraints
$objectRoot
catalog_object_idsJSONOptional
catalog_object_ids (anyOf 1)arrayAlternativeThe filter to return results by `CatalogObject` ID.
The filter is only applicable when set. The default value is null.
catalog_object_ids (anyOf 1)[]stringEach item
catalog_object_ids (anyOf 2)nullAlternative
cursorJSONOptional
cursor (anyOf 1)stringAlternativeA 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)nullAlternative
limitJSONOptional
limit (anyOf 1)integerAlternativeThe number of [records](entity:InventoryChange) to return.
Maximum: 1000
Minimum: 1
limit (anyOf 2)nullAlternative
location_idsJSONOptional
location_ids (anyOf 1)arrayAlternativeThe filter to return results by `Location` ID.
The filter is only applicable when set. The default value is null.
location_ids (anyOf 1)[]stringEach item
location_ids (anyOf 2)nullAlternative
reason_idsJSONOptional
reason_ids (anyOf 1)arrayAlternativeThe 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)[]ModelEach itemExpand Delete Inventory Adjustment Reason — request body — body reason id
reason_ids (anyOf 2)nullAlternative
sortJSONOptional
sort (anyOf 1)ModelAlternativeExpand 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)nullAlternative
statesJSONOptional
states (anyOf 1)arrayAlternativeThe filter to return `ADJUSTMENT` query results by
`InventoryState`. This filter is only applied when set.
The default value is null.
states (anyOf 1)[]stringEach itemIndicates 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)nullAlternative
typesJSONOptional
types (anyOf 1)arrayAlternativeThe filter to return results by `InventoryChangeType` values other than `TRANSFER`.
The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`.
types (anyOf 1)[]stringEach itemIndicates how the inventory change was applied to a tracked product quantity.
One of: PHYSICAL_COUNT, ADJUSTMENT
types (anyOf 2)nullAlternative
updated_afterJSONOptional
updated_after (anyOf 1)stringAlternativeThe 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)nullAlternative
updated_beforeJSONOptional
updated_before (anyOf 1)stringAlternativeThe 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)nullAlternative

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
FieldTypePresenceDescription and constraints
$objectRoot
changesarrayOptionalThe current calculated inventory changes for the requested objects
and locations.
changes[]ModelEach itemExpand Batch Change Inventory — response body — changes item
cursorstringOptionalThe 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.
errorsarrayOptionalAny errors that occurred during the request.
errors[]ModelEach itemExpand 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
FieldTypePresenceDescription and constraints
$objectRoot
fieldJSONOptional
field (anyOf 1)stringAlternativeThe field to sort inventory changes by.
See [Field](#type-field) for possible values
One of: OCCURRED_AT
field (anyOf 2)nullAlternative
orderJSONOptional
order (anyOf 1)stringAlternativeThe 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)nullAlternative
Delete Inventory Adjustment Reason — request body — body reason id
FieldTypePresenceDescription and constraints
$objectRootIdentifies a standard or custom inventory adjustment reason.
custom_reason_idJSONOptional
custom_reason_id (anyOf 1)stringAlternativeThe 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)nullAlternative
typeModelRequired within parentExpand 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
FieldTypePresenceDescription and constraints
$objectRootRepresents 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.
categorystringRequired within parentIndicates 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
codeModelRequired within parentExpand Get Shift — response body — errors item code
The specific code of the error.
See [ErrorCode](#type-errorcode) for possible values
detailstringOptionalA human-readable description of the error for debugging purposes.
fieldstringOptionalThe 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
FieldTypePresenceDescription and constraints
$stringRootThe 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
FieldTypePresenceDescription and constraints
$objectRootThe information needed to define a custom unit, provided by the seller.
abbreviationstringRequired within parentThe abbreviation of the custom unit, such as "bsh" (bushel). This appears
in the cart for the Point of Sale app, and in reports.
namestringRequired within parentThe name of the custom unit, for example "bushel".

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"}

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand how our website, product, and documentation are used.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

Advertising

Shares visits and sign-ups with Meta, Reddit, and X so we can measure which of our ads work.

You can change these choices at any time from Cookie settings.