# Earning programs

## List programs

> Get a list of all earning programs.

```json
{"openapi":"3.0.0","info":{"title":"Joy Loyalty Program - API REST","version":"1.0.0"},"tags":[{"name":"Earning programs"}],"servers":[{"url":"https://dev-api.joy.so"}],"paths":{"/rest_api/v1/earning":{"get":{"tags":["Earning programs"],"summary":"List programs","description":"Get a list of all earning programs.","parameters":[{"name":"X-Joy-Loyalty-App-Key","in":"header","schema":{"type":"string"},"description":"App ID of your shop which retrieved from the Settings page"},{"name":"X-Joy-Loyalty-Secret-Key","in":"header","schema":{"type":"string"},"description":"Secret Key of your shop which retrieved from the Settings page"}],"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":"string"}},"Vary":{"schema":{"type":"string"}},"alt-svc":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"showLoyaltyPage":{"type":"boolean"},"social":{"type":"string"},"urlLocation":{"type":"string"},"limitUnit":{"type":"string"},"urlAccount":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"priority":{"type":"integer"},"earnPoint":{"type":"integer"},"signUpGuide":{"type":"string"},"enabledAntiCheat":{"type":"boolean"},"hasLimit":{"type":"boolean"},"action":{"type":"string"},"earnPointsTiers":{"type":"object","additionalProperties":{"type":"object","properties":{"earnPoint":{"type":"integer"},"limitUnit":{"type":"string"}}}},"shopId":{"type":"string"},"event":{"type":"string"},"startDate":{"type":"string","format":"date"},"expired":{"type":"boolean"},"id":{"type":"string"},"changeProgramTitle":{"type":"boolean"},"isDraft":{"type":"boolean"},"rateMoney":{"type":"string"},"translateTitle":{"type":"object","additionalProperties":{"type":"string"}},"createdAt":{"type":"string","format":"date-time"},"giftStatus":{"type":"string"},"status":{"type":"boolean"},"updatedAt":{"type":"string","format":"date-time"}}}}}}}}}}}}}}
```

## Get an earning program

> Retrieve an earning program by its ID.

```json
{"openapi":"3.0.0","info":{"title":"Joy Loyalty Program - API REST","version":"1.0.0"},"tags":[{"name":"Earning programs"}],"servers":[{"url":"https://dev-api.joy.so"}],"paths":{"/rest_api/v1/earning/{programId}":{"get":{"tags":["Earning programs"],"summary":"Get an earning program","description":"Retrieve an earning program by its ID.","parameters":[{"name":"X-Joy-Loyalty-App-Key","in":"header","schema":{"type":"string"},"description":"App ID of your shop which retrieved from the Settings page"},{"name":"X-Joy-Loyalty-Secret-Key","in":"header","schema":{"type":"string"},"description":"Secret Key of your shop which retrieved from the Settings page"},{"name":"programId","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":"string"}},"Vary":{"schema":{"type":"string"}},"alt-svc":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"program":{"type":"object","properties":{"id":{"type":"string"},"limitUnit":{"type":"string"},"includeProducts":{"type":"array","items":{}},"autoRemovePoints":{"type":"boolean"},"earnBy":{"type":"string"},"type":{"type":"string"},"title":{"type":"string"},"priority":{"type":"integer"},"productPointsCalculator":{"type":"object","properties":{"color":{"type":"string"},"fontSize":{"type":"integer"},"type":{"type":"string"},"font":{"type":"string"}}},"earnPoint":{"type":"integer"},"hasLimit":{"type":"boolean"},"typeProductMatch":{"type":"string"},"priorityPlaceOrder":{"type":"integer"},"typeCondition":{"type":"string"},"statusProductPointsCalculator":{"type":"boolean"},"shopId":{"type":"string"},"event":{"type":"string"},"conditions":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"typeMatch":{"type":"string"},"content":{"type":"string"}}}},"excludeProducts":{"type":"array","items":{}},"statusUseCondition":{"type":"boolean"},"status":{"type":"boolean"},"limitInterval":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"rateMoney":{"type":"integer"},"updatedAt":{"type":"string","format":"date-time"},"appliedCollectionIds":{"type":"array","items":{}}}}}}}}}}}}}}
```

## GET /rest\_api/v1/earning-programs-by-customer

> List all earning programs available to a specific customer

```json
{"openapi":"3.0.0","info":{"title":"Joy Loyalty Program - API REST","version":"1.0.0"},"tags":[{"name":"Earning programs"}],"servers":[{"url":"https://dev-api.joy.so"}],"paths":{"/rest_api/v1/earning-programs-by-customer":{"get":{"tags":["Earning programs"],"summary":"List all earning programs available to a specific customer","parameters":[{"name":"X-Joy-Loyalty-App-Key","in":"header","schema":{"type":"string"},"description":"App ID of your shop which retrieved from the Settings page"},{"name":"X-Joy-Loyalty-Secret-Key","in":"header","schema":{"type":"string"},"description":"Secret Key of your shop which retrieved from the Settings page"},{"name":"","in":"header","schema":{"type":"string"}},{"name":"customerId","in":"query","schema":{"type":"string"},"description":"At least one of customerId or shopifyCustomerId is required. priority"}],"responses":{"200":{"description":"OK","headers":{"Vary":{"schema":{"type":"string"}},"access-control-allow-origin":{"schema":{"type":"string"}},"content-type":{"schema":{"type":"string"}},"date":{"schema":{"type":"string"}},"connection":{"schema":{"type":"string"}},"keep-alive":{"schema":{"type":"string"}},"cache-control":{"schema":{"type":"string"}},"Content-Encoding":{"schema":{"type":"string"}},"Transfer-Encoding":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"excludePOSOrderProducts":{"type":"boolean"},"limitUnit":{"type":"string"},"includeProducts":{"type":"array","items":{"type":"object","properties":{"image":{"type":"object","properties":{"src":{"type":"string"}}},"images":{"type":"array","items":{"type":"object"}},"options":{"type":"array","items":{"type":"object"}},"handle":{"type":"string"},"id":{"type":"integer"},"variants":{"type":"array","items":{"type":"object"}},"title":{"type":"string"}}}},"rateMoney":{"type":"integer"},"autoRemovePoints":{"type":"boolean"},"earnBy":{"type":"string"},"type":{"type":"string"},"title":{"type":"string"},"excludeOSOrderProducts":{"type":"boolean"},"priority":{"type":"integer"},"hasLimit":{"type":"boolean"},"typeProductMatch":{"type":"string"},"typeCondition":{"type":"string"},"shopId":{"type":"string"},"event":{"type":"string"},"conditions":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"typeMatch":{"type":"string"},"content":{"type":"string"}}}},"limitInterval":{"type":"integer"},"giftStatus":{"type":"string"},"status":{"type":"boolean"},"excludeProducts":{"type":"array","items":{"type":"object","properties":{"image":{"type":"object","properties":{"src":{"type":"string"}}},"images":{"type":"array","items":{"type":"object"}},"options":{"type":"array","items":{"type":"object"}},"handle":{"type":"string"},"id":{"type":"integer"},"variants":{"type":"array","items":{"type":"object"}},"title":{"type":"string"}}}},"statusUseCondition":{"type":"boolean"},"changeProgramTitle":{"type":"boolean"},"expired":{"type":"boolean"},"isDraft":{"type":"boolean"},"appliedPlaceOrderTo":{"type":"string"},"earnPoint":{"type":"integer"},"earnPointsTiers":{"type":"object","additionalProperties":{"type":"object","properties":{"earnPoint":{"type":"integer"}}}},"createdAt":{"type":"string","format":"date-time"},"translateTitle":{"type":"string"},"updatedAt":{"type":"string","format":"date-time"},"isEarned":{"type":"boolean"}}}}}}}}}}}}}}
```

## Calculate Earning Points

> Calculate the points a user would earn for a given activity without actually awarding the points.

```json
{"openapi":"3.0.0","info":{"title":"Joy Loyalty Program - API REST","version":"1.0.0"},"tags":[{"name":"Earning programs"}],"servers":[{"url":"https://dev-api.joy.so"}],"paths":{"/rest_api/v1/earn/calc-points":{"post":{"tags":["Earning programs"],"summary":"Calculate Earning Points","description":"Calculate the points a user would earn for a given activity without actually awarding the points.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"products":{"type":"array","items":{"type":"object","properties":{"id":{"type":"number"},"quantity":{"type":"number"},"price":{"type":"number"}},"required":["id","price","quantity"]}},"shopifyCustomerId":{"type":"number"},"sourceName":{"type":"string","enum":["web","pos"]}},"required":["products"]}}}},"parameters":[{"name":"X-Joy-Loyalty-App-Key","in":"header","schema":{"type":"string"},"description":"App ID of your shop which retrieved from the Settings page"},{"name":"X-Joy-Loyalty-Secret-Key","in":"header","schema":{"type":"string"},"description":"Secret Key of your shop which retrieved from the Settings page"}],"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":"string"}},"Vary":{"schema":{"type":"string"}},"alt-svc":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"pointsEarn":{"type":"number"},"products":{"type":"array"}}},"success":{"type":"boolean"}}}}}}}}}}}
```

## Social Interaction Points

> Calculate and award points for a social interaction activity.

```json
{"openapi":"3.0.0","info":{"title":"Joy Loyalty Program - API REST","version":"1.0.0"},"tags":[{"name":"Earning programs"}],"servers":[{"url":"https://dev-api.joy.so"}],"paths":{"/rest_api/v1/earn/interact-social":{"post":{"tags":["Earning programs"],"summary":"Social Interaction Points","description":"Calculate and award points for a social interaction activity.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"shopifyCustomerId":{"type":"number"},"earningId":{"type":"number"}},"required":["shopifyCustomerId","earningId"]}}}},"parameters":[{"name":"X-Joy-Loyalty-App-Key","in":"header","schema":{"type":"string"},"description":"App ID of your shop which is retrieved from the Settings page"},{"name":"X-Joy-Loyalty-Secret-Key","in":"header","schema":{"type":"string"},"description":"Secret Key of your shop which is retrieved from the Settings page"}],"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"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"newPoint":{"type":"number"}}}}}}}}}}}}}
```


---

# Agent Instructions: 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:

```
GET https://devdocs.joy.so/joy-rest-api-v1-deprecated/api-references/earning-programs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
