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

# List customers

> List all loyalty program customers.

List all loyalty customers for the shop.

## Query parameters

| Parameter                | Type    | Description                                                                                                       |
| ------------------------ | ------- | ----------------------------------------------------------------------------------------------------------------- |
| `filter[email]`          | string  | Partial, case-insensitive email match                                                                             |
| `filter[loyalty_status]` | string  | Filter by `member` or `excluded`                                                                                  |
| `sort`                   | string  | Sort field. Prefix with `-` for descending. Options: `created_at`, `points`, `lifetime_points`, `redeemed_points` |
| `page[number]`           | integer | Page number (default: `1`)                                                                                        |
| `page[size]`             | integer | Results per page (default: `20`, max: `100`)                                                                      |

## Response

Returns a paginated list of [customer objects](/api-reference/customers/object) with a `meta` object describing the page.

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
    --url 'https://api.mageloyalty.com/v1/customers?page[size]=20&sort=-lifetime_points' \
    --header 'Authorization: <api-key>'
  ```

  ```javascript Node theme={null}
  const response = await fetch(
    "https://api.mageloyalty.com/v1/customers?page[size]=20&sort=-lifetime_points",
    {
      method: "GET",
      headers: {
        Authorization: "<api-key>",
      },
    }
  );

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

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

  response = requests.get(
      "https://api.mageloyalty.com/v1/customers",
      headers={"Authorization": "<api-key>"},
      params={"page[size]": 20, "sort": "-lifetime_points"},
  )

  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init("https://api.mageloyalty.com/v1/customers?page[size]=20&sort=-lifetime_points");
  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"
        }
      }
    ],
    "meta": {
      "total": 1,
      "page": 1,
      "per_page": 20,
      "total_pages": 1
    }
  }
  ```
</ResponseExample>
