> ## Documentation Index
> Fetch the complete documentation index at: https://docs.referrush.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get customer

> Get one customer's referral code and referral totals by phone number or email.

Pass at least one of `phoneNumber` and `email`. The phone number is looked up first. If no customer has that number, or you didn't pass one, the email is looked up instead.

## Query parameters

**phoneNumber** `string`

The customer's Indian mobile number, with or without the `91` country code. Spaces, dashes, brackets and `+` are ignored, so `9876543210`, `919876543210` and `+91 98765-43210` all work.

**email** `string`

The customer's exact email address. Looked up when no customer has the phone number, or when you don't pass one.

## Response

**success** `boolean`

`true` when the customer was found.

**message** `string`

A short description of the result.

**data** `object`

The customer.

**properties**

**fullName** `string | null`

The customer's full name.

**phoneNumber** `string | null`

The customer's phone number, with the `91` country code and no spaces, like `919876543210`.

**email** `string | null`

The customer's email address.

**discountCode** `string | null`

The customer's referral code, which friends use at checkout. `null` if the customer hasn't been given one yet.

**discountCodeNodeId** `string | null`

The Shopify ID of the referral code, like `gid://shopify/DiscountCodeNode/123456789`. Use it to look the code up in the Shopify Admin API.

**totalReferralOrders** `number`

The number of orders placed with the customer's referral code.

**totalReferralSales** `number`

The total value of those orders, in your store's currency.

```bash cURL theme={null}
curl "https://asia-south1-refero1.cloudfunctions.net/merchantDataApiCustomerDetails?phoneNumber=9876543210" \
  -H "Authorization: Bearer rr_xxxxxxxxx"
```

```javascript Node.js theme={null}
const params = new URLSearchParams({ phoneNumber: "9876543210" })

const response = await fetch(
  `https://asia-south1-refero1.cloudfunctions.net/merchantDataApiCustomerDetails?${params}`,
  {
    headers: { Authorization: `Bearer ${process.env.REFERRUSH_API_KEY}` },
  },
)

const { data } = await response.json()
```

```python Python theme={null}
import os
import requests

response = requests.get(
    "https://asia-south1-refero1.cloudfunctions.net/merchantDataApiCustomerDetails",
    params={"phoneNumber": "9876543210"},
    headers={"Authorization": f"Bearer {os.environ['REFERRUSH_API_KEY']}"},
)

data = response.json()["data"]
```

```json 200 theme={null}
{
  "success": true,
  "message": "Customer fetched successfully",
  "data": {
    "fullName": "Asha Verma",
    "phoneNumber": "919876543210",
    "email": "asha@example.com",
    "discountCode": "ASHA10",
    "discountCodeNodeId": "gid://shopify/DiscountCodeNode/123456789",
    "totalReferralOrders": 4,
    "totalReferralSales": 5200
  }
}
```

```json 400 theme={null}
{
  "success": false,
  "message": "Phone number or email is required",
  "data": null
}
```

```json 401 theme={null}
{
  "success": false,
  "message": "Auth API Key is missing or invalid",
  "data": null
}
```

```json 404 theme={null}
{
  "success": false,
  "message": "Customer not found",
  "data": null
}
```

```json 429 theme={null}
{
  "success": false,
  "message": "Too many requests",
  "data": null
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.