# Loyalty Account Search API Returns Empty Response Despite Customer Being Enrolled

**URL:** <https://developer.squareup.com/forums/t/loyalty-account-search-api-returns-empty-response-despite-customer-being-enrolled/22051>\
**Category:** Questions\
**Tags:** loyalty-api\
**Created:** [April 23, 2025, 12:19pm UTC](https://developer.squareup.com/forums/t/loyalty-account-search-api-returns-empty-response-despite-customer-being-enrolled/22051 "2025-04-23T12:19:18Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sithum2020](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@Sithum2020](https://developer.squareup.com/forums/u/Sithum2020)\
**Post date:** [April 23, 2025, 12:19pm UTC](https://developer.squareup.com/forums/t/loyalty-account-search-api-returns-empty-response-despite-customer-being-enrolled/22051/1 "2025-04-23T12:19:18Z")

</div>

Hi team,

We’re currently using the Square Loyalty API to search for a customer’s loyalty account using their phone number, but we’re encountering an issue where the API response is empty even though the customer is enrolled in the loyalty program and visible from the POS. Searching from the customer id also didn’t work. There are other customers for this location that we do get proper responses.

POST → [https://connect.squareup.com/v2/loyalty/accounts/search](https://connect.squareup.com/v2/loyalty/accounts/search)

```auto
{
  "query": {
    "mappings": [
      {
        "phone_number": "+19xxxxxxxxx"
      }
    ]
  },
  "limit": 1
}

```

Customer ID - T1WHM7P0WXCQGX1T5B2XVNQH4R  
Location Id - BR1GQW7WBEVSP

The API response we receive is just: {}

However, from the POS, we can clearly see the customer is enrolled in the loyalty program. I’ve attached screenshots from the POS showing this.

Could you help us understand why the API isn’t returning the loyalty account data? Is there something we’re missing in the request, or any other issue.

Thanks in advance for your support

---

<div class="post-metadata">

**Author:** ![Square-Dev-AI](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/square-dev-ai/32/2513_2.png) [@Square-Dev-AI](https://developer.squareup.com/forums/u/Square-Dev-AI)\
**Post date:** [April 23, 2025, 12:19pm UTC](https://developer.squareup.com/forums/t/loyalty-account-search-api-returns-empty-response-despite-customer-being-enrolled/22051/2 "2025-04-23T12:19:39Z")

</div>

👋 I’m Square Dev AI, here to help answer your question!  
Based on the information you’ve provided, the following documentation will help answer your question:

> **[Enroll a Buyer in a Loyalty Program (Walkthrough 1)](https://developer.squareup.com/docs/loyalty-api/walkthrough1/enroll-buyer)**
>
> To enroll a buyer in a loyalty program, you create a loyalty account and provide the program ID and buyer's phone number.

> **[Create and Retrieve Loyalty Accounts](https://developer.squareup.com/docs/loyalty-api/loyalty-accounts)**
>
> Learn about the LoyaltyAccount object and how to use the Square Loyalty API to create and retrieve loyalty accounts.

> **Additional Documentation**
>
> [Enroll a Buyer in a Loyalty Program (Walkthrough 2)](https://developer.squareup.com/docs/loyalty-api/walkthrough2-enroll-buyer)  
> [Loyalty API](https://developer.squareup.com/docs/loyalty-api/overview)  
> [Loyalty API Example Walkthrough 1](https://developer.squareup.com/docs/loyalty-api/walkthrough1)

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.  
Otherwise one of our Developer Advocates will provide additional assistance shortly.

---

<div class="post-metadata">

**Author:** ![Sithum2020](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@Sithum2020](https://developer.squareup.com/forums/u/Sithum2020)\
**Post date:** [April 23, 2025, 12:19pm UTC](https://developer.squareup.com/forums/t/loyalty-account-search-api-returns-empty-response-despite-customer-being-enrolled/22051/3 "2025-04-23T12:19:57Z")

</div>

![unnamed](https://global.discourse-cdn.com/square/original/2X/3/366f6c57ca72e8728b40e364c6b2c60747b5309b.jpeg)

---

<div class="post-metadata">

**Author:** ![josh-square](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@josh-square](https://developer.squareup.com/forums/u/josh-square)\
**Post date:** [April 23, 2025, 4:49pm UTC](https://developer.squareup.com/forums/t/loyalty-account-search-api-returns-empty-response-despite-customer-being-enrolled/22051/4 "2025-04-23T16:49:25Z")

</div>

Hey @Sithum2020! Do you mind sharing your application ID (_not_ your access token)? I can take a look and see what I can find.

---

<div class="post-metadata">

**Author:** ![Sithum2020](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@Sithum2020](https://developer.squareup.com/forums/u/Sithum2020)\
**Post date:** [April 24, 2025, 5:23am UTC](https://developer.squareup.com/forums/t/loyalty-account-search-api-returns-empty-response-despite-customer-being-enrolled/22051/5 "2025-04-24T05:23:55Z")

</div>

Hi Josh

sq0idp-TpHen\_F96miOUr07zsUKTw

This is my application Id

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [April 24, 2025, 6:16pm UTC](https://developer.squareup.com/forums/t/loyalty-account-search-api-returns-empty-response-despite-customer-being-enrolled/22051/6 "2025-04-24T18:16:00Z")

</div>

That `customer_id` doesn’t have a phone number associated to it which is why your getting an empty response. 🙂

---

<div class="post-metadata">

**Author:** ![Sithum2020](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@Sithum2020](https://developer.squareup.com/forums/u/Sithum2020)\
**Post date:** [April 25, 2025, 4:42am UTC](https://developer.squareup.com/forums/t/loyalty-account-search-api-returns-empty-response-despite-customer-being-enrolled/22051/7 "2025-04-25T04:42:27Z")

</div>

But on the Square POS, there is a phone number displayed for this customer. Which is the same phone number that we use for the query mapping in the loyality search API.

 ![image](https://global.discourse-cdn.com/square/original/2X/0/054ed77ee442126e524b92047955d6f5ed36e650.jpeg)

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [April 25, 2025, 4:45pm UTC](https://developer.squareup.com/forums/t/loyalty-account-search-api-returns-empty-response-despite-customer-being-enrolled/22051/8 "2025-04-25T16:45:29Z")

</div>

That customer is this customer\_id: `E3R0Z4T5Q17VN628E1E7K2JPH8`. The `customer_id` you provided `T1WHM7P0WXCQGX1T5B2XVNQH4R` shows this in the Dashboard:

 ![Screenshot 2025-04-25 at 09.42.53](https://global.discourse-cdn.com/square/original/2X/9/99b503cc436773baacc341c6c9827614801406f3.png)  
🙂

---

<div class="post-metadata">

**Author:** ![Sithum2020](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@Sithum2020](https://developer.squareup.com/forums/u/Sithum2020)\
**Post date:** [April 28, 2025, 10:42am UTC](https://developer.squareup.com/forums/t/loyalty-account-search-api-returns-empty-response-despite-customer-being-enrolled/22051/9 "2025-04-28T10:42:16Z")

</div>

Thanks for the clarification. However, I still have a concern regarding the Loyalty API behavior.

When querying using the `customer_id`, I receive the expected loyalty account details. For example:

Request →

```auto
{
    "query": {
        "customer_ids": ["E3R0Z4T5Q17VN628E1E7K2JPH8"]
    },
    "limit": 10
}

```

Response →

```auto
{
    "loyalty_accounts": [
        {
            "id": "91e58518-d6ea-4dd8-a23e-xxxxx",
            "program_id": "755b73d7-4212-4f85-b071-xxxxxx",
            "balance": 21,
            "lifetime_points": 251,
            "customer_id": "E3R0Z4T5Q17VN628E1E7K2JPH8",
            "enrolled_at": "2018-02-25T20:00:30Z",
            "created_at": "2018-02-25T20:00:30Z",
            "updated_at": "2025-04-24T17:56:42Z",
            "mapping": {
                "id": "f738f021-e961-4362-b625-20fd8ac07961",
                "created_at": "2018-02-25T20:00:30Z",
                "phone_number": "+1xxxxxxxxxx"
            },
            "expiring_point_deadlines": [...]
        }
    ]
}

```

However, when I query using the customer’s phone number instead of the `customer_id`, no loyalty account is returned — even though the customer record has a phone number associated with it.

I also noticed that the `phone_number` shown under the `mapping` section of the loyalty account is **different** from the phone number associated with the customer profile.

**Could you please explain:**

- Why the loyalty account lookup by phone number doesn’t return any results ?
- Why the `mapping.phone_number` differs from the customer’s phone number ?

---

<div class="post-metadata">

**Author:** ![Sithum2020](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@Sithum2020](https://developer.squareup.com/forums/u/Sithum2020)\
**Post date:** [May 2, 2025, 5:21am UTC](https://developer.squareup.com/forums/t/loyalty-account-search-api-returns-empty-response-despite-customer-being-enrolled/22051/10 "2025-05-02T05:21:50Z")

</div>

Just a kind reminder — really appreciate it if you could share an explanation for this.

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [May 2, 2025, 4:47pm UTC](https://developer.squareup.com/forums/t/loyalty-account-search-api-returns-empty-response-despite-customer-being-enrolled/22051/11 "2025-05-02T16:47:56Z")

</div>

Looks like that customer has a different phone number than whats associated to the loyalty account which is why the empty response is being returned. 🙂

---

<div class="post-metadata">

**Author:** ![Sithum2020](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@Sithum2020](https://developer.squareup.com/forums/u/Sithum2020)\
**Post date:** [May 5, 2025, 4:23am UTC](https://developer.squareup.com/forums/t/loyalty-account-search-api-returns-empty-response-despite-customer-being-enrolled/22051/12 "2025-05-05T04:23:59Z")

</div>

According to this article,

> **[Update customer loyalty profiles | Square Support Center - US](https://squareup.com/help/us/en/article/8407-update-customer-loyalty-profiles)**

Updating the customer’s phone number will update the loyalty number as well.

 ![unnamed](https://global.discourse-cdn.com/square/original/2X/1/122076c42fba4101553313f47a541976e32e0c99.jpeg)

Can you explain how and why the loyalty number is not updated when the customers’s phone number was changed ?

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [May 5, 2025, 5:17pm UTC](https://developer.squareup.com/forums/t/loyalty-account-search-api-returns-empty-response-despite-customer-being-enrolled/22051/13 "2025-05-05T17:17:46Z")

</div>

So the customers profile was updated this way? Do you know when it was updated so the team can look into this? 🙂

---

<div class="post-metadata">

**Author:** ![Sithum2020](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@Sithum2020](https://developer.squareup.com/forums/u/Sithum2020)\
**Post date:** [May 14, 2025, 4:35am UTC](https://developer.squareup.com/forums/t/loyalty-account-search-api-returns-empty-response-despite-customer-being-enrolled/22051/14 "2025-05-14T04:35:07Z")

</div>

Since the merchant is unable to recall the exact date and time of the update, it’s difficult to determine when the change was made.

We are just trying to understand the reason for the discrepancy between the customer’s current phone number and the one displayed in the locality mapping.

---

<div class="post-metadata">

**Author:** ![Sithum2020](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@Sithum2020](https://developer.squareup.com/forums/u/Sithum2020)\
**Post date:** [May 22, 2025, 3:44pm UTC](https://developer.squareup.com/forums/t/loyalty-account-search-api-returns-empty-response-despite-customer-being-enrolled/22051/15 "2025-05-22T15:44:40Z")

</div>

Kind reminder on this. Appreciate if we can get some explanation.
