# 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>'
// 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();
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
$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);
{
"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"
}
}
}
{
"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"
}
}
}
{
"errors": [
{
"status": "404",
"title": "Not Found",
"detail": "Customer '6789012345' not found"
}
]
}
Customers
Retrieve a customer
Retrieve a single customer by Shopify ID or email.
GET
/
v1
/
customers
/
{identifier}
# 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>'
// 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();
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
$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);
{
"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"
}
}
}
{
"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"
}
}
}
{
"errors": [
{
"status": "404",
"title": "Not Found",
"detail": "Customer '6789012345' not found"
}
]
}
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. Whenexclude_vip=true, the vip_tier field is null.
Errors
| Status | Scenario |
|---|---|
404 | Customer not found |
# 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>'
// 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();
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
$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);
{
"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"
}
}
}
{
"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"
}
}
}
{
"errors": [
{
"status": "404",
"title": "Not Found",
"detail": "Customer '6789012345' not found"
}
]
}
⌘I