Create customer custom attribute definition
POST
/v2/customers/custom-attribute-definitions
Creates a customer-related custom attribute definition for a Square seller account.
Use this endpoint to define a custom attribute that can be associated with customer profiles.
A custom attribute definition specifies the key
, visibility
, schema
, and other properties
for a custom attribute. After the definition is created, you can call
UpsertCustomerCustomAttribute or
BulkUpsertCustomerCustomAttributes
to set the custom attribute for customer profiles in the seller's Customer Directory.
Sellers can view all custom attributes in exported customer data, including those set to
VISIBILITY_HIDDEN
.
Request body
Example code
The custom attribute definition to create. Note the following:
- With the exception of the
Selection
data type, theschema
is specified as a simple URL to the JSON schema definition hosted on the Square CDN. For more information, including supported values and constraints, see Specifying the schema. - If provided,
name
must be unique (case-sensitive) across all visible customer-related custom attribute definitions for the seller. - All custom attributes are visible in exported customer data, including those set to
VISIBILITY_HIDDEN
.
A unique identifier for this request, used to ensure idempotency. For more information, see Idempotency.