• Example searches: “transaction”, “CreateOrder”, “/v2/locations”, “inventory”, “delete customer”

You are viewing an old version of the API
Update customer custom attribute definition

PUT /v2/customers/custom-attribute-definitions/{key}

Updates a customer-related custom attribute definition for a Square seller account.

Use this endpoint to update the following fields: name, description, visibility, or the schema for a Selection data type.

Only the definition owner can update a custom attribute definition. Note that sellers can view all custom attributes in exported customer data, including those set to VISIBILITY_HIDDEN.

Name Description
key
string

Required

The key of the custom attribute definition to update.

Name Description
custom_attribute_definition
CustomAttributeDefinition

Required

The custom attribute definition that contains the fields to update. This endpoint supports sparse updates, so only new or changed fields need to be included in the request. Only the following fields can be updated:

  • name
  • description
  • visibility
  • schema for a Selection data type. Only changes to the named options or the maximum number of allowed selections are supported.

For more information, see Updatable definition fields.

To enable optimistic concurrency control, include the optional version field and specify the current version of the custom attribute definition.

idempotency_key
string

A unique identifier for this request, used to ensure idempotency. For more information, see Idempotency.

Max Length 45

Response Fields

Name Description
custom_attribute_definition
CustomAttributeDefinition

The updated custom attribute definition.

errors
Error [ ]

Any errors that occurred during the request.

Examples

Example:
You are viewing an old version of the API
PUT /v2/customers/custom-attribute-definitions/{key}
cURL
  • cURL
  • Ruby
  • Python
  • C#
  • Java
  • PHP
  • Node.js
curl https://connect.squareup.com/v2/customers/custom-attribute-definitions/favoritebeverage \
  -X PUT \
  -H 'Square-Version: 2022-09-21' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "custom_attribute_definition": {
      "schema": {
        "items": {
          "names": [
            "water",
            "lemonade"
          ],
          "enum": [
            "d012755e-6a3e-4fb8-8c17-d64f8483ecc9",
            "e21131a1-f1bc-467f-af95-4efb532bdd1a"
          ]
        }
      }
    }
  }'
Response JSON
{
  "custom_attribute_definition": {
    "key": "favoritebeverage",
    "name": "Favorite Beverage",
    "description": "The favorite beverage of the customer.",
    "version": 2,
    "updated_at": "2022-04-26T16:08:48Z",
    "schema": {
      "$schema": "https://developer-production-s.squarecdn.com/meta-schemas/v1/selection.json",
      "type": "array",
      "items": {
        "names": [
          "water",
          "lemonade"
        ],
        "enum": [
          "d012755e-6a3e-4fb8-8c17-d64f8483ecc9",
          "e21131a1-f1bc-467f-af95-4efb532bdd1a"
        ]
      },
      "maxItems": 1,
      "uniqueItems": true
    },
    "created_at": "2022-04-26T16:00:37Z",
    "visibility": "VISIBILITY_HIDDEN"
  }
}