Square: Batch Change Inventory
Square inventory.batchChangeInventory: arguments, response, policy and SDK examples.
← Inventory operations · Get started
Operation square.batchchangeinventory
Provider route: POST /v2/inventory/changes/batch-create. 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"]["batchChangeInventory"]>[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.batchChangeInventory(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_change_inventory(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 Change Inventory — request body — body |
Referenced models: Batch Change Inventory — 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 Change Inventory — response body |
Referenced models: Batch Change Inventory — response body
Schemas
Section titled “Schemas”22 more schemas are linked from the tables above, on the schema pages.
Batch Change Inventory — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
changes | JSON | Optional | |
changes (anyOf 1) | array | Alternative | The set of physical counts and inventory adjustments to be made. Changes are applied based on the client-supplied timestamp and may be sent out of order. |
changes (anyOf 1)[] | Model | Each item | Expand Batch Change Inventory — request body — body changes array item |
changes (anyOf 2) | null | Alternative | |
idempotency_key | string | Required within parent | A client-supplied, universally unique identifier (UUID) for the request. See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more information. Maximum length: 128 Minimum length: 1 |
ignore_unchanged_counts | JSON | Optional | |
ignore_unchanged_counts (anyOf 1) | boolean | Alternative | Indicates whether the current physical count should be ignored if the quantity is unchanged since the last physical count. Default: `true`. |
ignore_unchanged_counts (anyOf 2) | null | Alternative |
Referenced models: Batch Change Inventory — request body — body changes array item
Batch Change Inventory — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
changes | array | Optional | Changes created for the request. |
changes[] | Model | Each item | Expand Batch Change Inventory — response body — changes item |
counts | array | Optional | The current counts for all objects referenced in the request. |
counts[] | Model | Each item | Expand Batch Change Inventory — response body — counts item |
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 Change Inventory — response body — counts item
Batch Change Inventory — request body — body changes array item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents a single physical count, inventory, adjustment, or transfer that is part of the history of inventory changes for a particular [CatalogObject](entity:CatalogObject) instance. |
adjustment | JSON | Optional | |
adjustment (anyOf 1) | Model | Alternative | Expand Update Inventory Adjustment — request body — body adjustment Contains details about the inventory adjustment when `type` is `ADJUSTMENT`, and is unset for all other change types. |
adjustment (anyOf 2) | null | Alternative | |
measurement_unit | Model | Optional | Expand Upsert Catalog Object — request body — body object measurement unit data measurement unit, precision The [CatalogMeasurementUnit](entity:CatalogMeasurementUnit) object representing the catalog measurement unit associated with the inventory change. Read only: true |
measurement_unit_id | string | Optional | The ID of the [CatalogMeasurementUnit](entity:CatalogMeasurementUnit) object representing the catalog measurement unit associated with the inventory change. Read only: true |
physical_count | JSON | Optional | |
physical_count (anyOf 1) | Model | Alternative | Expand Batch Change Inventory — request body — body changes array item physical count adjustment id, catalog object id, catalog object type, created at, employee id, id, location id, occurred at, quantity, reference id, source, state, team member id Contains details about the physical count when `type` is `PHYSICAL_COUNT`, and is unset for all other change types. |
physical_count (anyOf 2) | null | Alternative | |
type | JSON | Optional | |
type (anyOf 1) | string | Alternative | Indicates how the inventory change was applied to a tracked product quantity. Indicates how the inventory change is applied. See [InventoryChangeType](entity:InventoryChangeType) for all possible values. See [InventoryChangeType](#type-inventorychangetype) for possible values One of: PHYSICAL_COUNT, ADJUSTMENT |
type (anyOf 2) | null | Alternative |
Referenced models: Upsert Catalog Object — request body — body object measurement unit data measurement unit, precision, Update Inventory Adjustment — request body — body adjustment, Batch Change Inventory — request body — body changes array item physical count adjustment id, catalog object id, catalog object type, created at, employee id, id, location id, occurred at, quantity, reference id, source, state, team member id
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
Batch Change Inventory — response body — changes item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents a single physical count, inventory, adjustment, or transfer that is part of the history of inventory changes for a particular [CatalogObject](entity:CatalogObject) instance. |
adjustment | JSON | Optional | |
adjustment (anyOf 1) | Model | Alternative | Expand Update Inventory Adjustment — response body — adjustment Contains details about the inventory adjustment when `type` is `ADJUSTMENT`, and is unset for all other change types. |
adjustment (anyOf 2) | null | Alternative | |
measurement_unit | Model | Optional | Expand Batch Change Inventory — response body — changes item measurement unit The [CatalogMeasurementUnit](entity:CatalogMeasurementUnit) object representing the catalog measurement unit associated with the inventory change. Read only: true |
measurement_unit_id | string | Optional | The ID of the [CatalogMeasurementUnit](entity:CatalogMeasurementUnit) object representing the catalog measurement unit associated with the inventory change. Read only: true |
physical_count | JSON | Optional | |
physical_count (anyOf 1) | Model | Alternative | Expand Retrieve Inventory Physical Count — response body — count Contains details about the physical count when `type` is `PHYSICAL_COUNT`, and is unset for all other change types. |
physical_count (anyOf 2) | null | Alternative | |
type | JSON | Optional | |
type (anyOf 1) | string | Alternative | Indicates how the inventory change was applied to a tracked product quantity. Indicates how the inventory change is applied. See [InventoryChangeType](entity:InventoryChangeType) for all possible values. See [InventoryChangeType](#type-inventorychangetype) for possible values Known values: PHYSICAL_COUNT, ADJUSTMENT |
type (anyOf 2) | null | Alternative |
Referenced models: Batch Change Inventory — response body — changes item measurement unit, Update Inventory Adjustment — response body — adjustment, Retrieve Inventory Physical Count — response body — count
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
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: square.batchchangeinventory. Catalog operation: BatchChangeInventory. 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_WRITE"]
Pinned headers: {"Square-Version": "2026-11-18"}