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

# Enroll a customer

> Enroll a customer in the loyalty program.

Enroll a customer in the loyalty program. If the customer is already enrolled, their existing record is returned with `200 OK` instead.

Only `shopify_customer_id` is required — the endpoint fetches the customer's name, email, and account creation date directly from Shopify.

## Side effects on first enrollment

* Assigns the customer to the lowest VIP tier
* Awards signup points if a signup earning rule is configured
* Generates a referral link
* Sets birthday metafields on the Shopify customer record

## Request body

| Field                 | Type   | Required | Description                        |
| --------------------- | ------ | -------- | ---------------------------------- |
| `shopify_customer_id` | string | Yes      | The customer's Shopify customer ID |

```json theme={null}
{
  "shopify_customer_id": "6789012345"
}
```

## Response

Returns `201 Created` on successful enrollment, or `200 OK` if the customer was already enrolled.

The response shape matches the [customer object](/api-reference/customers/object).

## Errors

| Status | Scenario                                      |
| ------ | --------------------------------------------- |
| `400`  | `shopify_customer_id` missing or invalid JSON |
| `404`  | No Shopify customer found with that ID        |
| `503`  | Unable to connect to Shopify                  |
