cURL
curl --request POST \
--url https://api.loyaltylion.com/headless/2025-06/{site_id}/referrals/shares \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_merchant_id": "100001",
"channel": "whatsapp"
}
'import requests
url = "https://api.loyaltylion.com/headless/2025-06/{site_id}/referrals/shares"
payload = {
"customer_merchant_id": "100001",
"channel": "whatsapp"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({customer_merchant_id: '100001', channel: 'whatsapp'})
};
fetch('https://api.loyaltylion.com/headless/2025-06/{site_id}/referrals/shares', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.loyaltylion.com/headless/2025-06/{site_id}/referrals/shares",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customer_merchant_id' => '100001',
'channel' => 'whatsapp'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.loyaltylion.com/headless/2025-06/{site_id}/referrals/shares"
payload := strings.NewReader("{\n \"customer_merchant_id\": \"100001\",\n \"channel\": \"whatsapp\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.loyaltylion.com/headless/2025-06/{site_id}/referrals/shares")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer_merchant_id\": \"100001\",\n \"channel\": \"whatsapp\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.loyaltylion.com/headless/2025-06/{site_id}/referrals/shares")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer_merchant_id\": \"100001\",\n \"channel\": \"whatsapp\"\n}"
response = http.request(request)
puts response.read_body{
"error": {
"message": "<string>",
"details": {}
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"details": {}
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "<string>"
}
}{
"error": {
"code": "customer_not_enrolled"
}
}{
"error": {
"code": "rate_limited"
}
}Referrals
Track Share
POST
/
headless
/
2025-06
/
{site_id}
/
referrals
/
shares
cURL
curl --request POST \
--url https://api.loyaltylion.com/headless/2025-06/{site_id}/referrals/shares \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_merchant_id": "100001",
"channel": "whatsapp"
}
'import requests
url = "https://api.loyaltylion.com/headless/2025-06/{site_id}/referrals/shares"
payload = {
"customer_merchant_id": "100001",
"channel": "whatsapp"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({customer_merchant_id: '100001', channel: 'whatsapp'})
};
fetch('https://api.loyaltylion.com/headless/2025-06/{site_id}/referrals/shares', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.loyaltylion.com/headless/2025-06/{site_id}/referrals/shares",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customer_merchant_id' => '100001',
'channel' => 'whatsapp'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.loyaltylion.com/headless/2025-06/{site_id}/referrals/shares"
payload := strings.NewReader("{\n \"customer_merchant_id\": \"100001\",\n \"channel\": \"whatsapp\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.loyaltylion.com/headless/2025-06/{site_id}/referrals/shares")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer_merchant_id\": \"100001\",\n \"channel\": \"whatsapp\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.loyaltylion.com/headless/2025-06/{site_id}/referrals/shares")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer_merchant_id\": \"100001\",\n \"channel\": \"whatsapp\"\n}"
response = http.request(request)
puts response.read_body{
"error": {
"message": "<string>",
"details": {}
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"details": {}
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "<string>"
}
}{
"error": {
"code": "customer_not_enrolled"
}
}{
"error": {
"code": "rate_limited"
}
}Record that a customer shared their referral link, and on which channel. This
is what populates the share counts in your referral analytics — without it,
your dashboard shows referral visits and purchases but no shares, so call it
whenever a shopper completes a share in your storefront or app (for example,
after the native share sheet confirms, or when they copy their link).
The
channel must be one of the channels that appear in the customer’s
referral_urls, and should match the link they actually shared —
device_share for a native share sheet, direct for a copied link, and so
on. Shares are categorized by channel in your referral analytics.
The customer must be enrolled in the program and not blocked. A guest
referrer has links
to share, but their shares can’t be recorded.
A successful request returns 204 with no body.Authorizations
Body
application/json
Body
The ID, in your platform or ecommerce store, of the customer who shared their referral link. For Shopify stores this can be either a GID or a regular numeric ID
This must be a customer whose state is enrolled. Shares made with the links a guest referrer is given cannot be recorded
Minimum string length:
1Example:
"100001"
Which of the customer's referral_urls was shared. Pass the key you took the link from, not the link itself — we re-derive the referral code from the customer and the channel, so you never have to parse one out of a URL
Available options:
direct, facebook, twitter, email, whatsapp, instagram, device_share Example:
"whatsapp"
Response
204