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

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

POST /v2/loyalty/accounts/search

Searches for loyalty accounts in a loyalty program.

You can search for a loyalty account using the phone number or customer ID associated with the account. To return all loyalty accounts, specify an empty query object or omit it entirely.

Search results are sorted by created_at in ascending order.

Name Description
query
SearchLoyaltyAccountsRequestLoyaltyAccountQuery

The search criteria for the request.

limit
integer (32-bit)

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

Example:
You are viewing an old version of the API
POST /v2/loyalty/accounts/search
cURL
  • cURL
  • Ruby
  • Python
  • C#
  • Java
  • PHP
  • Node.js
curl https://connect.squareup.com/v2/loyalty/accounts/search \
  -X POST \
  -H 'Square-Version: 2021-05-13' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "query": {},
    "limit": 5
  }'
Response JSON
{
  "loyalty_accounts": [
    {
      "id": "79b807d2-d786-46a9-933b-918028d7a8c5",
      "mapping": {
        "id": "66aaab3f-da99-49ed-8b19-b87f851c844f",
        "phone_number": "+14155551234",
        "created_at": "2020-05-08T21:44:32Z"
      },
      "program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd",
      "balance": 20,
      "lifetime_points": 50,
      "customer_id": "RPJBC4YA0MTGX8DHTXE9AP2AS4",
      "created_at": "2020-05-08T21:44:32Z",
      "updated_at": "2020-05-08T21:44:32Z"
    },
    {
      "id": "452ea896-f36e-4c5c-95d5-e5aa727b9b2c",
      "mapping": {
        "id": "cbde1ec6-96df-40d4-8019-af9a4fa893ed",
        "phone_number": "+14255554670",
        "created_at": "2020-05-29T04:04:11Z"
      },
      "program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd",
      "balance": -10,
      "lifetime_points": 10,
      "customer_id": "6E51KR0B3GVAKE0GP0HV69A1V0",
      "created_at": "2020-05-29T04:04:11Z",
      "updated_at": "2020-05-29T04:04:11Z"
    },
    {
      "id": "bd2d7c0d-0183-4c1e-b5d4-d1c88f24c201",
      "mapping": {
        "id": "9a85bb43-a6a5-4123-a2e7-324621cf283b",
        "phone_number": "+12085559707",
        "created_at": "2020-07-22T10:50:28Z"
      },
      "program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd",
      "balance": 80,
      "lifetime_points": 210,
      "customer_id": "REK96J96AS5AN2Y8Z4H01QWYE8",
      "created_at": "2020-07-22T10:50:28Z",
      "updated_at": "2020-07-22T10:50:28Z"
    },
    {
      "id": "5bb3fc58-266a-4001-bb26-99a178533355",
      "mapping": {
        "id": "d0805ad0-7bc7-45e2-ad84-932c226cd096",
        "phone_number": "+16095552758",
        "created_at": "2020-09-13T04:27:43Z"
      },
      "program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd",
      "balance": 40,
      "lifetime_points": 40,
      "customer_id": "6WW3N3ZRWMYRSB21ZVW4TT4BYC",
      "created_at": "2020-09-13T04:27:43Z",
      "updated_at": "2020-09-13T04:27:43Z"
    },
    {
      "id": "9f32fe22-777e-4655-8a82-29c1ef51e496",
      "mapping": {
        "id": "fccc1899-e8e8-4423-9525-bb5d6453c6ae",
        "phone_number": "+15055551967",
        "created_at": "2020-09-18T14:28:57Z"
      },
      "program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd",
      "balance": 0,
      "lifetime_points": 0,
      "customer_id": "3GR8PJ090RYTZ70KPB92YM4YZ0",
      "created_at": "2020-09-18T14:28:57Z",
      "updated_at": "2020-09-18T14:28:57Z"
    }
  ],
  "cursor": "LRdH9KdUiYrJqbbouAglvV46UOmVv7VByhTxMK0pprEsQdzlYfwCUiin2Q7FGR9QC"
}

Share Feedback

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