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

You are viewing an old version of the API
Search loyalty accounts BETA

Searches for loyalty accounts.

In the current implementation, you can search for a loyalty account using the phone number associated with the account. If no phone number is provided, all loyalty accounts are returned.

Required permissions: LOYALTY_READ

Request Body

Name Description
query
SearchLoyaltyAccountsRequestLoyaltyAccountQuery

The search criteria for the request.

limit
integer

The maximum number of results to include in the response.

Min 1 Max 30
cursor
string

A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query.

For more information, see Pagination.

Response Fields

Name Description
errors
Error [ ]

Any errors that occurred during the request.

loyalty_accounts
LoyaltyAccount [ ]

The loyalty accounts that met the search criteria,
in order of creation date.

cursor
string

The pagination cursor to use in a subsequent request. If empty, this is the final response. For more information, see Pagination.

Examples

You are viewing an old version of the API
POST /v2/loyalty/accounts/search
cURL
  • cURL
  • Ruby
  • Python
  • C#
  • Java
  • PHP
curl https://connect.squareup.com/v2/loyalty/accounts/search \
  -X POST \
  -H 'Square-Version: 2020-06-25' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "query": {
      "mappings": [
        {
          "type": "PHONE",
          "value": "+14155551234"
        }
      ]
    },
    "limit": 10
  }'
Response JSON
{
  "loyalty_accounts": [
    {
      "id": "79b807d2-d786-46a9-933b-918028d7a8c5",
      "mappings": [
        {
          "id": "66aaab3f-da99-49ed-8b19-b87f851c844f",
          "type": "PHONE",
          "value": "+14155551234",
          "created_at": "2020-05-08T21:44:32Z"
        }
      ],
      "program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd",
      "balance": 10,
      "lifetime_points": 20,
      "customer_id": "Q8002FAM9V1EZ0ADB2T5609X6NET1H0",
      "created_at": "2020-05-08T21:44:32Z",
      "updated_at": "2020-05-08T21:44:32Z"
    }
  ]
}

Share Feedback

Thanks for visiting the Square API documentation. What's on your mind?