v1

latestOpenAPI 3.0.0Apache 2.02026-07-143281,4552.1 MB
OrderCustomAttributes

BulkUpsertOrderCustomAttributes

Creates or updates order custom attributes as a bulk operation.

Use this endpoint to delete one or more custom attributes from one or more orders. A custom attribute is based on a custom attribute definition in a Square seller account. (To create a custom attribute definition, use the CreateOrderCustomAttributeDefinition endpoint.)

This BulkUpsertOrderCustomAttributes endpoint accepts a map of 1 to 25 individual upsert requests and returns a map of individual upsert responses. Each upsert request has a unique ID and provides an order ID and custom attribute. Each upsert response is returned with the ID of the corresponding request.

To create or update a custom attribute owned by another application, the visibility setting must be VISIBILITY_READ_WRITE_VALUES. Note that seller-defined custom attributes (also known as custom fields) are always set to VISIBILITY_READ_WRITE_VALUES.

post/v2/orders/custom-attributes/bulk-upsert

Request body

valuesobject required

A map of requests that correspond to individual upsert operations for custom attributes.

Example request

{
  "values": {
    "cover-count": {
      "custom_attribute": {
        "key": "cover-count",
        "value": "6",
        "version": 2
      },
      "order_id": "7BbXGEIWNldxAzrtGf9GPVZTwZ4F"
    },
    "table-number": {
      "custom_attribute": {
        "key": "table-number",
        "value": "11",
        "version": 4
      },
      "order_id": "7BbXGEIWNldxAzrtGf9GPVZTwZ4F"
    }
  }
}

Response

Success

valuesobject required

A map of responses that correspond to individual upsert operations for custom attributes.

Example response

{
  "values": {
    "cover-count": {
      "custom_attribute": {
        "created_at": "2022-11-22T21:27:33.429Z",
        "key": "cover-count",
        "updated_at": "2022-11-22T21:28:35.721Z",
        "value": "6",
        "visibility": "VISIBILITY_READ_WRITE_VALUES"
      }
    },
    "table-number": {
      "custom_attribute": {
        "created_at": "2022-11-22T21:24:57.823Z",
        "key": "table-number",
        "updated_at": "2022-11-22T21:28:35.726Z",
        "value": "11",
        "visibility": "VISIBILITY_HIDDEN"
      }
    }
  }
}