# Square Loyalty API returns Loyalty Account with CustomerId Null

**URL:** <https://developer.squareup.com/forums/t/square-loyalty-api-returns-loyalty-account-with-customerid-null/816>\
**Category:** Questions\
**Tags:** loyalty-api\
**Created:** [August 22, 2020, 1:26am UTC](https://developer.squareup.com/forums/t/square-loyalty-api-returns-loyalty-account-with-customerid-null/816 "2020-08-22T01:26:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AminYazdani](https://avatars.discourse-cdn.com/v4/letter/a/b77776/32.png) [@AminYazdani](https://developer.squareup.com/forums/u/AminYazdani)\
**Post date:** [August 22, 2020, 1:26am UTC](https://developer.squareup.com/forums/t/square-loyalty-api-returns-loyalty-account-with-customerid-null/816/1 "2020-08-22T01:26:56Z")

</div>

We are receiving weird response from Square Loyalty API when we search for a loyalty account with a Phone number. The result has square loyalty account but there is no **customer\_id**

Question 1: In what scenarios can this happen?  
Question 2: How can we associate a customer account with a loyalty account when this happens?

```
{
  "loyalty_accounts": [
    {
      "id": "52014fa0-0dcd-48ac-97d6-4c057f0001f8",
      "mappings": [
        {
          "id": "92415d1d-5b00-43d2-844b-35da30820e55",
          "type": "PHONE",
          "value": "+13 ***********",
          "created_at": "2017-10-25T01:01:45Z"
        }
      ],
      "program_id": "760029f1-9292-4fae-8cc1-f4a471a66694",
      "balance": 1,
      "lifetime_points": 1,
      "enrolled_at": "2017-07-18T19:56:17Z",
      "created_at": "2017-10-25T01:01:45Z",
      "updated_at": "2019-03-05T21:05:35Z"
    }
  ]
}
```

---

<div class="post-metadata">

**Author:** ![sjosey](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/sjosey/32/40_2.png) [@sjosey](https://developer.squareup.com/forums/u/sjosey)\
**Post date:** [August 25, 2020, 8:58pm UTC](https://developer.squareup.com/forums/t/square-loyalty-api-returns-loyalty-account-with-customerid-null/816/2 "2020-08-25T20:58:35Z")

</div>

Checked in with our Loyalty team. There is a bug on our side where if you do a “Merge All” and more than one customer that is being merged has a loyalty account, it could leave the loyalty account unmerged. If you do manual merges, this shouldn’t happen, but they are working on fixing the merge all issue.
