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

# Retrieve a customer

> Retrieve a single customer by Shopify ID or email.

Fetch a single customer. The `identifier` can be:

* A **Shopify customer ID** (numeric string, e.g. `6789012345`)
* An **email address** (e.g. `jane@example.com`)

## Query parameters

| Parameter     | Type   | Description                                                                    |
| ------------- | ------ | ------------------------------------------------------------------------------ |
| `exclude_vip` | `true` | When set to `true`, omits the VIP tier lookup and returns `vip_tier` as `null` |

## Response

Returns the [customer object](/api-reference/customers/object). When `exclude_vip=true`, the `vip_tier` field is `null`.

## Errors

| Status | Scenario           |
| ------ | ------------------ |
| `404`  | Customer not found |

<RequestExample>
  ```bash cURL theme={null}
  # By Shopify customer ID
  curl --request GET \
    --url https://api.mageloyalty.com/v1/customers/6789012345 \
    --header 'Authorization: <api-key>'

  # By email address
  curl --request GET \
    --url https://api.mageloyalty.com/v1/customers/jane@example.com \
    --header 'Authorization: <api-key>'
  ```

  ```javascript Node theme={null}
  // By Shopify customer ID
  const response = await fetch(
    "https://api.mageloyalty.com/v1/customers/6789012345",
    {
      method: "GET",
      headers: {
        Authorization: "<api-key>",
      },
    }
  );

  const data = await response.json();
  ```

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

  # By email address
  response = requests.get(
      "https://api.mageloyalty.com/v1/customers/jane@example.com",
      headers={"Authorization": "<api-key>"},
  )

  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init("https://api.mageloyalty.com/v1/customers/6789012345");
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_HTTPHEADER => [
          "Authorization: <api-key>",
      ],
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "data": {
      "type": "customer",
      "id": "6789012345",
      "attributes": {
        "shopify_customer_id": "6789012345",
        "email": "jane@example.com",
        "first_name": "Jane",
        "last_name": "Doe",
        "current_points": 450,
        "lifetime_points": 1200,
        "redeemed_points": 750,
        "loyalty_status": "member",
        "date_of_birth": "1990-05-15T00:00:00.000Z",
        "referral_url": "https://mystore.myshopify.com?referral_code=ABC123",
        "referral_code": "ABC123",
        "vip_tier": {
          "id": "tier_abc",
          "name": "Gold",
          "threshold": 500,
          "points_multiplier": 1.5,
          "badge_image_url": null,
          "badge_color": "#FFD700"
        },      "created_at": "2024-01-15T10:00:00.000Z",
        "updated_at": "2024-06-20T14:30:00.000Z"
      }
    }
  }
  ```

  ```json 200 OK (exclude_vip=true) theme={null}
  {
    "data": {
      "type": "customer",
      "id": "6789012345",
      "attributes": {
        "shopify_customer_id": "6789012345",
        "email": "jane@example.com",
        "first_name": "Jane",
        "last_name": "Doe",
        "current_points": 450,
        "lifetime_points": 1200,
        "redeemed_points": 750,
        "loyalty_status": "member",
        "date_of_birth": "1990-05-15T00:00:00.000Z",
        "referral_url": "https://mystore.myshopify.com?referral_code=ABC123",
        "referral_code": "ABC123",
        "vip_tier": null,      "created_at": "2024-01-15T10:00:00.000Z",
        "updated_at": "2024-06-20T14:30:00.000Z"
      }
    }
  }
  ```

  ```json 404 Not Found theme={null}
  {
    "errors": [
      {
        "status": "404",
        "title": "Not Found",
        "detail": "Customer '6789012345' not found"
      }
    ]
  }
  ```
</ResponseExample>
