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

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

GET /v2/customers/{customer_id}/custom-attributes/{key}

Retrieves a custom attribute associated with a customer profile.

You can use the with_definition query parameter to also retrieve the custom attribute definition in the same call.

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

Name Description
customer_id
string

Required

The ID of the target customer profile.

key
string

Required

The key of the custom attribute to retrieve. This key must match the key of a custom attribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key.

Name Description
with_definition
boolean

Indicates whether to return the custom attribute definition in the definition field of the custom attribute. Set this parameter to true to get the name and description of the custom attribute, information about the data type, or other definition details. The default value is false.

version
integer (32-bit)

The current version of the custom attribute, which is used for strongly consistent reads to guarantee that you receive the most up-to-date data. When included in the request, Square returns the specified version or a higher version if one exists. If the specified version is higher than the current version, Square returns a BAD_REQUEST error.

Response Fields

Name Description
custom_attribute
CustomAttribute

The retrieved custom attribute. If with_definition was set to true in the request, the custom attribute definition is returned in the definition field.

errors
Error [ ]

Any errors that occurred during the request.

Examples

You are viewing an old version of the API
GET /v2/customers/{customer_id}/custom-attributes/{key}
cURL
  • cURL
  • Ruby
  • Python
  • C#
  • Java
  • PHP
  • Node.js
curl https://connect.squareup.com/v2/customers/Z57QXKM2FGXEQDV42W8RBZY7BR/custom-attributes/favoritemovie \
  -H 'Square-Version: 2022-09-21' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json'
Response JSON
{
  "custom_attribute": {
    "key": "favoritemovie",
    "version": 1,
    "updated_at": "2022-04-26T15:50:27Z",
    "value": "Dune",
    "created_at": "2022-04-26T15:50:27Z",
    "visibility": "VISIBILITY_READ_ONLY"
  }
}