> For the complete documentation index, see [llms.txt](https://devdocs.joy.so/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://devdocs.joy.so/joy-rest-api-v1-deprecated/api-references/referral.md).

# Referral

## POST /rest\_api/v1/referral/getLink

> Get referral link

```json
{"openapi":"3.0.0","info":{"title":"Joy Loyalty Program - API REST","version":"1.0.0"},"tags":[{"name":"Referral"}],"servers":[{"url":"https://dev-api.joy.so"}],"paths":{"/rest_api/v1/referral/getLink":{"post":{"tags":["Referral"],"summary":"Get referral link","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"}},"required":["email"]}}}},"parameters":[{"name":"X-Joy-Loyalty-App-Key","in":"header","schema":{"type":"string"}},{"name":"X-Joy-Loyalty-Secret-Key","in":"header","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","headers":{"Connection":{"schema":{"type":"string"}},"Content-Length":{"schema":{"type":"integer"}},"Access-Control-Allow-Origin":{"schema":{"type":"string"}},"Cache-Control":{"schema":{"type":"string"}},"Content-Type":{"schema":{"type":"string"}},"Function-Execution-Id":{"schema":{"type":"string"}},"Server":{"schema":{"type":"string"}},"Strict-Transport-Security":{"schema":{"type":"string"}},"X-Cloud-Trace-Context":{"schema":{"type":"string"}},"X-Country-Code":{"schema":{"type":"string"}},"Accept-Ranges":{"schema":{"type":"string"}},"Date":{"schema":{"type":"string"}},"X-Served-By":{"schema":{"type":"string"}},"X-Cache":{"schema":{"type":"string"}},"X-Cache-Hits":{"schema":{"type":"integer"}},"X-Timer":{"schema":{"type":"number"}},"Vary":{"schema":{"type":"string"}},"alt-svc":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"urlReferral":{"type":"string","description":"Link referral of customer"}}}}}}}}}}}}}
```

## GET /rest\_api/v1/referral/{shopifyCustomerId}

> Get list refer by shopify customer id

```json
{"openapi":"3.0.0","info":{"title":"Joy Loyalty Program - API REST","version":"1.0.0"},"tags":[{"name":"Referral"}],"servers":[{"url":"https://dev-api.joy.so"}],"paths":{"/rest_api/v1/referral/{shopifyCustomerId}":{"get":{"tags":["Referral"],"summary":"Get list refer by shopify customer id","parameters":[{"name":"X-Joy-Loyalty-App-Key","in":"header","schema":{"type":"string"}},{"name":"X-Joy-Loyalty-Secret-Key","in":"header","schema":{"type":"string"}},{"name":"shopifyCustomerId","in":"path","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"OK","headers":{"Connection":{"schema":{"type":"string"}},"Content-Length":{"schema":{"type":"integer"}},"Access-Control-Allow-Origin":{"schema":{"type":"string"}},"Cache-Control":{"schema":{"type":"string"}},"Content-Type":{"schema":{"type":"string"}},"Function-Execution-Id":{"schema":{"type":"string"}},"Server":{"schema":{"type":"string"}},"Strict-Transport-Security":{"schema":{"type":"string"}},"X-Cloud-Trace-Context":{"schema":{"type":"string"}},"X-Country-Code":{"schema":{"type":"string"}},"Accept-Ranges":{"schema":{"type":"string"}},"Date":{"schema":{"type":"string"}},"X-Served-By":{"schema":{"type":"string"}},"X-Cache":{"schema":{"type":"string"}},"X-Cache-Hits":{"schema":{"type":"integer"}},"X-Timer":{"schema":{"type":"number"}},"Vary":{"schema":{"type":"string"}},"alt-svc":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"referralCustomerEmail":{"type":"string","description":"Email of the inviting customer"},"statusReferral":{"type":"string","enum":["pending_referral","complete_referral","cancel_referral"],"description":"Status of referral"},"customerId":{"type":"string","description":"The customer id is identified by joy"},"couponCode":{"type":"string","description":"The coupon code is generated by Joy"},"email":{"type":"string","description":"The email of invited customer"},"updatedAt":{"type":"string","format":"date-time","description":"The date and time when the record was updated"},"createdAt":{"type":"string","format":"date-time","description":"The date and time when the record was created"}}}},"count":{"type":"integer"},"pageInfo":{"type":"object","properties":{"hasPre":{"type":"boolean"},"hasNext":{"type":"boolean"}}}}}}}}}}}}}
```

## GET /rest\_api/v1/referral/summary/{shopifyCustomerId}

> Get total redeemed coupons and points earned from referrals

```json
{"openapi":"3.0.0","info":{"title":"Joy Loyalty Program - API REST","version":"1.0.0"},"tags":[{"name":"Referral"}],"servers":[{"url":"https://dev-api.joy.so"}],"paths":{"/rest_api/v1/referral/summary/{shopifyCustomerId}":{"get":{"tags":["Referral"],"summary":"Get total redeemed coupons and points earned from referrals","parameters":[{"name":"X-Joy-Loyalty-App-Key","in":"header","schema":{"type":"string"}},{"name":"X-Joy-Loyalty-Secret-Key","in":"header","schema":{"type":"string"}},{"name":"shopifyCustomerId","in":"path","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"OK","headers":{"Connection":{"schema":{"type":"string"}},"Content-Length":{"schema":{"type":"integer"}},"Access-Control-Allow-Origin":{"schema":{"type":"string"}},"Cache-Control":{"schema":{"type":"string"}},"Content-Type":{"schema":{"type":"string"}},"Date":{"schema":{"type":"string"}},"X-Served-By":{"schema":{"type":"string"}},"X-Cache":{"schema":{"type":"string"}},"X-Cache-Hits":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"totalRedeemCoupon":{"type":"integer","description":"Total redeemed coupons by referral"},"totalPointEarnRefer":{"type":"integer","description":"Total points earned from referrals"}}}}}}}}}}}}}
```

## GET /rest\_api/v1/referral/analytics/clicks-usage

> Get analytics on referral link clicks and coupon code usage

```json
{"openapi":"3.0.0","info":{"title":"Joy Loyalty Program - API REST","version":"1.0.0"},"tags":[{"name":"Referral"}],"servers":[{"url":"https://dev-api.joy.so"}],"paths":{"/rest_api/v1/referral/analytics/clicks-usage":{"get":{"tags":["Referral"],"summary":"Get analytics on referral link clicks and coupon code usage","parameters":[{"name":"X-Joy-Loyalty-App-Key","in":"header","schema":{"type":"string"}},{"name":"X-Joy-Loyalty-Secret-Key","in":"header","schema":{"type":"string"}},{"name":"shopifyCustomerId","in":"query","schema":{"type":"string"},"description":"Shopify customer ID to get specific customer analytics"}],"responses":{"200":{"description":"OK","headers":{"Connection":{"schema":{"type":"string"}},"Content-Length":{"schema":{"type":"integer"}},"Access-Control-Allow-Origin":{"schema":{"type":"string"}},"Cache-Control":{"schema":{"type":"string"}},"Content-Type":{"schema":{"type":"string"}},"Date":{"schema":{"type":"string"}},"X-Served-By":{"schema":{"type":"string"}},"X-Cache":{"schema":{"type":"string"}},"X-Cache-Hits":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"countReferralLinkClicks":{"type":"integer","description":"Total number of clicks on referral links"},"countCouponCodeUsage":{"type":"integer","description":"Total number of times coupon codes have been used"},"totalLinkClickers":{"type":"integer","description":"Total number of link clickers for the specific Shopify customer","nullable":true}}}}}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://devdocs.joy.so/joy-rest-api-v1-deprecated/api-references/referral.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
