Generate customer referral URL
(Re)registers the short referral link for the logged-in customer. The link is normally created automatically when the customer joins the program, so most integrations never need to call this.
No request body and no customer ID parameter. The customer is taken from the Shopify session that the App Proxy attaches to the request (logged_in_customer_id) — a customer ID can't be passed in.
The response body is empty. To read the link itself, call GET /apps/loyalty/cp/api/customer-loyalty and use the referralLink field.
Example (JavaScript running on the storefront while the customer is logged in):
await fetch('/apps/loyalty/cp/api/add-customer-referral-url', {
method: 'POST',
headers: { 'X-Requested-With': 'XMLHttpRequest' }
});
const { referralLink } = await (await fetch('/apps/loyalty/cp/api/customer-loyalty')).json();
Server-side / headless: use the Admin API instead — GET /api/external/customer-loyalty?customerId={id} with the X-API-Key header returns the same referralLink.
Request
- Base URLhttps://your-store.myshopify.com/apps
- URLhttps://your-store.myshopify.com/apps/loyalty/cp/api/add-customer-referral-url
- Authnone declared
Response
Referral link registered. The response body is empty.
Changes
No recorded changes to this operation across all 14 revisions of this API.