Skip to content

Square: Batch Upsert Catalog Objects

Square catalog.batchUpsertCatalogObjects: arguments, response, policy and SDK examples.

← Catalog operations · Get started

Operation square.batchupsertcatalogobjects

Provider route: POST /v2/catalog/batch-upsert. 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["catalog"]["batchUpsertCatalogObjects"]>[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.catalog.batchUpsertCatalogObjects(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.catalog.batch_upsert_catalog_objects(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
bodyModelRequired within parentExpand Batch Upsert Catalog Objects — request body — body

Referenced models: Batch Upsert Catalog Objects — 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 Upsert Catalog Objects — response body

Referenced models: Batch Upsert Catalog Objects — response body

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

Batch Upsert Catalog Objects — request body — body
FieldTypePresenceDescription and constraints
$objectRoot
batchesarrayRequired within parentA batch of CatalogObjects to be inserted/updated atomically.
The objects within a batch will be inserted in an all-or-nothing fashion, i.e., if an error occurs
attempting to insert or update an object within a batch, the entire batch will be rejected. However, an error
in one batch will not affect other batches within the same request.

For each object, its `updated_at` field is ignored and replaced with a current [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates), and its
`is_deleted` field must not be set to `true`.

To modify an existing object, supply its ID. To create a new object, use an ID starting
with `#`. These IDs may be used to create relationships between an object and attributes of
other objects that reference it. For example, you can create a CatalogItem with
ID `#ABC` and a CatalogItemVariation with its `item_id` attribute set to
`#ABC` in order to associate the CatalogItemVariation with its parent
CatalogItem.

Any `#`-prefixed IDs are valid only within a single atomic batch, and will be replaced by server-generated IDs.

Each batch may contain up to 1,000 objects. The total number of objects across all batches for a single request
may not exceed 10,000. If either of these limits is violated, an error will be returned and no objects will
be inserted or updated.
batches[]ModelEach itemExpand Batch Upsert Catalog Objects — request body — body batches item
idempotency_keystringRequired within parentA value you specify that uniquely identifies this
request among all your requests. A common way to create
a valid idempotency key is to use a Universally unique
identifier (UUID).

If you're unsure whether a particular request was successful,
you can reattempt it with the same idempotency key without
worrying about creating duplicate objects.

See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
Maximum length: 128
Minimum length: 1

Referenced models: Batch Upsert Catalog Objects — request body — body batches item

Batch Upsert Catalog Objects — response body
FieldTypePresenceDescription and constraints
$objectRoot
errorsarrayOptionalAny errors that occurred during the request.
errors[]ModelEach itemExpand Get Shift — response body — errors item
id_mappingsarrayOptionalThe mapping between client and server IDs for this upsert.
id_mappings[]ModelEach itemExpand Upsert Catalog Object — response body — id mappings item
objectsarrayOptionalThe created successfully created CatalogObjects.
objects[]ModelEach itemExpand Create Catalog Image — response body — image
updated_atstringOptionalThe database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this update in RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z".

Referenced models: Upsert Catalog Object — response body — id mappings item, Create Catalog Image — response body — image, Get Shift — response body — errors item

Batch Upsert Catalog Objects — request body — body batches item
FieldTypePresenceDescription and constraints
$objectRootA batch of catalog objects.
objectsarrayRequired within parentA list of CatalogObjects belonging to this batch.
objects[]ModelEach itemExpand Upsert Catalog Object — request body — body object

Referenced models: Upsert Catalog Object — request body — body object

Upsert Catalog Object — response body — id mappings item
FieldTypePresenceDescription and constraints
$objectRootA mapping between a temporary client-supplied ID and a permanent server-generated ID.

When calling [UpsertCatalogObject](api-endpoint:Catalog-UpsertCatalogObject) or
[BatchUpsertCatalogObjects](api-endpoint:Catalog-BatchUpsertCatalogObjects) to
create a [CatalogObject](entity:CatalogObject) instance, you can supply
a temporary ID for the to-be-created object, especially when the object is to be referenced
elsewhere in the same request body. This temporary ID can be any string unique within
the call, but must be prefixed by "#".

After the request is submitted and the object created, a permanent server-generated ID is assigned
to the new object. The permanent ID is unique across the Square catalog.
client_object_idJSONOptional
client_object_id (anyOf 1)stringAlternativeThe client-supplied temporary `#`-prefixed ID for a new `CatalogObject`.
client_object_id (anyOf 2)nullAlternative
object_idJSONOptional
object_id (anyOf 1)stringAlternativeThe permanent ID for the CatalogObject created by the server.
object_id (anyOf 2)nullAlternative
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

Create Catalog Image — response body — image image data caption, name, photo studio order id, url
FieldTypePresenceDescription and constraints
$objectRootAn image file to use in Square catalogs. It can be associated with
`CatalogItem`, `CatalogItemVariation`, `CatalogCategory`, and `CatalogModifierList` objects.
Only the images on items and item variations are exposed in Dashboard.
Only the first image on an item is displayed in Square Point of Sale (SPOS).
Images on items and variations are displayed through Square Online Store.
Images on other object types are for use by 3rd party application developers.
captionJSONOptional
caption (anyOf 1)stringAlternativeA caption that describes what is shown in the image. Displayed in the
Square Online Store. This is a searchable attribute for use in applicable query filters
using the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects).
caption (anyOf 2)nullAlternative
nameJSONOptional
name (anyOf 1)stringAlternativeThe internal name to identify this image in calls to the Square API.
This is a searchable attribute for use in applicable query filters
using the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects).
It is not unique and should not be shown in a buyer facing context.
name (anyOf 2)nullAlternative
photo_studio_order_idJSONOptional
photo_studio_order_id (anyOf 1)stringAlternativeThe immutable order ID for this image object created by the Photo Studio service in Square Online Store.
photo_studio_order_id (anyOf 2)nullAlternative
urlJSONOptional
url (anyOf 1)stringAlternativeThe URL of this image, generated by Square after an image is uploaded
using the [CreateCatalogImage](api-endpoint:Catalog-CreateCatalogImage) endpoint.
To modify the image, use the UpdateCatalogImage endpoint. Do not change the URL field.
url (anyOf 2)nullAlternative
Create Catalog Image — response body — image time period data event
FieldTypePresenceDescription and constraints
$objectRootRepresents a time period - either a single period or a repeating period.
eventJSONOptional
event (anyOf 1)stringAlternativeAn iCalendar (RFC 5545) [event](https://tools.ietf.org/html/rfc5545#section-3.6.1), which
specifies the name, timing, duration and recurrence of this time period.

Example:

```
DTSTART:20190707T180000
DURATION:P2H
RRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR
```

Only `SUMMARY`, `DTSTART`, `DURATION` and `RRULE` fields are supported.
`DTSTART` must be in local (unzoned) time format. Note that while `BEGIN:VEVENT`
and `END:VEVENT` is not required in the request. The response will always
include them.
event (anyOf 2)nullAlternative
Create Catalog Image — response body — image catalog v1 ids array item
FieldTypePresenceDescription and constraints
$objectRootA Square API V1 identifier of an item, including the object ID and its associated location ID.
catalog_v1_idJSONOptional
catalog_v1_id (anyOf 1)stringAlternativeThe ID for an object used in the Square API V1, if the object ID differs from the Square API V2 object ID.
catalog_v1_id (anyOf 2)nullAlternative
location_idJSONOptional
location_id (anyOf 1)stringAlternativeThe ID of the `Location` this Connect V1 ID is associated with.
location_id (anyOf 2)nullAlternative

SDK function policy ID: square.batchupsertcatalogobjects. Catalog operation: BatchUpsertCatalogObjects. 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: ["ITEMS_WRITE"]

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.