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

# getCustomerReferralStats

> Get referral statistics for the logged-in customer.

Retrieve referral statistics for the currently logged-in customer, including a summary of referral statuses and individual referral details.

## Usage

```javascript theme={null}
MageSDK.getCustomerReferralStats().then(function(resp) {
  if (resp.success) {
    console.log('Total referrals:', resp.data.summary.totalReferrals);
    console.log('Completed:', resp.data.summary.completed);
  }
});
```

## Response

<ResponseField name="success" type="boolean">
  Whether the request was successful.
</ResponseField>

<ResponseField name="data.summary" type="object">
  Aggregated referral statistics.

  <Expandable title="Summary properties">
    <ResponseField name="totalReferrals" type="number">
      Total number of referrals made.
    </ResponseField>

    <ResponseField name="pending" type="number">
      Referrals that haven't been acted on yet.
    </ResponseField>

    <ResponseField name="friendConverted" type="number">
      Referrals where the friend has signed up but not yet completed the required action.
    </ResponseField>

    <ResponseField name="completed" type="number">
      Fully completed referrals.
    </ResponseField>

    <ResponseField name="expired" type="number">
      Referrals that have expired.
    </ResponseField>

    <ResponseField name="availableRewards" type="number">
      Number of unclaimed referral rewards.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="data.referrals" type="array">
  List of individual referrals.

  <Expandable title="Referral properties">
    <ResponseField name="id" type="string">
      The referral ID.
    </ResponseField>

    <ResponseField name="friendEmail" type="string">
      Email address of the referred friend.
    </ResponseField>

    <ResponseField name="status" type="string">
      Current status (`"pending"`, `"friend_converted"`, `"completed"`, `"expired"`).
    </ResponseField>

    <ResponseField name="createdAt" type="string">
      ISO 8601 timestamp of when the referral was created.
    </ResponseField>
  </Expandable>
</ResponseField>

## Sample response

```json theme={null}
{
  "success": true,
  "data": {
    "summary": {
      "totalReferrals": 5,
      "pending": 2,
      "friendConverted": 1,
      "completed": 2,
      "expired": 0,
      "availableRewards": 1
    },
    "referrals": [
      {
        "id": "ref_abc",
        "friendEmail": "friend@example.com",
        "status": "completed",
        "createdAt": "2024-06-01T12:00:00.000Z"
      }
    ]
  }
}
```
