> ## 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.

# getCustomerDetails

> Retrieve details for the logged-in customer, including points, VIP tier, and earning history.

Retrieve the full profile for the currently logged-in customer. Returns points balance, VIP tier, earning history, and referral earnings.

## Usage

```javascript theme={null}
MageSDK.getCustomerDetails().then(function(resp) {
  if (resp.success) {
    console.log(resp.data.customer);
  }
});
```

## Response

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

<ResponseField name="data.customer" type="object">
  The customer object.

  <Expandable title="Customer properties">
    <ResponseField name="id" type="string">
      Internal Mage customer ID.
    </ResponseField>

    <ResponseField name="shopifyCustomerId" type="string">
      The Shopify customer ID.
    </ResponseField>

    <ResponseField name="email" type="string">
      Customer email address.
    </ResponseField>

    <ResponseField name="firstName" type="string">
      Customer first name.
    </ResponseField>

    <ResponseField name="lastName" type="string">
      Customer last name.
    </ResponseField>

    <ResponseField name="points" type="number">
      Current available points balance.
    </ResponseField>

    <ResponseField name="lifetimePoints" type="number">
      Total points earned over the customer's lifetime.
    </ResponseField>

    <ResponseField name="redeemedPoints" type="number">
      Total points redeemed.
    </ResponseField>

    <ResponseField name="isExcluded" type="boolean">
      Whether the customer is excluded from the loyalty program.
    </ResponseField>

    <ResponseField name="dateOfBirth" type="string | null">
      Customer date of birth in ISO 8601 format.
    </ResponseField>

    <ResponseField name="referralCode" type="string | null">
      The customer's unique referral code.
    </ResponseField>

    <ResponseField name="referralUrl" type="string | null">
      The customer's full referral URL that can be shared.
    </ResponseField>

    <ResponseField name="tier" type="object | null">
      The customer's current VIP tier, or `null` if no tier is assigned.
    </ResponseField>

    <ResponseField name="tierProgressValue" type="number">
      The customer's progress value toward the next tier.
    </ResponseField>

    <ResponseField name="earningHistory" type="array">
      List of point earning events.
    </ResponseField>

    <ResponseField name="referralEarnings" type="array">
      List of earnings from referrals.
    </ResponseField>

    <ResponseField name="createdAt" type="string">
      ISO 8601 timestamp of when the customer was enrolled.
    </ResponseField>

    <ResponseField name="updatedAt" type="string">
      ISO 8601 timestamp of the last update.
    </ResponseField>
  </Expandable>
</ResponseField>

## Sample response

```json theme={null}
{
  "success": true,
  "data": {
    "customer": {
      "id": "abc123",
      "shopifyCustomerId": "6789012345",
      "email": "jane@example.com",
      "firstName": "Jane",
      "lastName": "Doe",
      "points": 450,
      "lifetimePoints": 1200,
      "redeemedPoints": 750,
      "isExcluded": false,
      "dateOfBirth": "1990-05-15T00:00:00.000Z",
      "referralCode": "ABC123",
      "referralUrl": "https://mystore.com?referral_code=ABC123",
      "tier": {
        "id": "tier_abc",
        "name": "Gold",
        "description": "Our most valued customers",
        "pointsRequired": 500,
        "pointsMultiplier": 1.5,
        "badgeImageUrl": null,
        "badgeColor": "#FFD700"
      },
      "tierProgressValue": 1200,
      "earningHistory": [
        {
          "id": "cer_abc",
          "earningRuleId": "rule_abc",
          "status": "approved",
          "points": 150,
          "createdAt": "2024-06-01T12:00:00.000Z",
          "earningRule": {
            "id": "rule_abc",
            "name": "Points for purchase"
          }
        }
      ],
      "referralEarnings": [],
      "createdAt": "2024-01-15T10:00:00.000Z",
      "updatedAt": "2024-06-20T14:30:00.000Z"
    }
  }
}
```
