# Signed In Customer Reward Points

## Retrieving reward points of a signed-in customer

> Fetches the number of reward points of a currently signed-in customer.\
> \
> \*\*Note:\*\* This public API endpoint is accessible to all customers.

```json
{"openapi":"3.0.0","info":{"title":"Reward Points Service","version":"0.0.1"},"tags":[{"name":"Signed-In Customer Reward Points"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"CustomerAccessToken":[]}],"components":{"securitySchemes":{"CustomerAccessToken":{"type":"http","scheme":"bearer"}},"responses":{"trait_unauthorized_401":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"trait_forbidden_403":{"description":"Given authorization scopes are not sufficient and do not match required scopes.\n","content":{"application/json":{"schema":{"title":"error","description":"Schema for API specified errors.","type":"object","properties":{"code":{"minimum":100,"maximum":599,"description":"Original HTTP error code, should be consistent with the response HTTP code","type":"integer"},"status":{"pattern":"[a-z]+[a-z_]*[a-z]+","description":"Classification of the error type in the lower case with underscore format, for example: `validation_failure`","type":"string"},"message":{"description":"Descriptive error message for debugging","type":"string"},"details":{"description":"List of problems causing this error","type":"array","items":{"title":"errorDetail","description":"Schema for a specific error cause","type":"string"}}},"required":["code","status"]}}}},"trait_internal_500":{"description":"Internal error","content":{"application/json":{"schema":{"title":"error","description":"Schema for API specified errors.","type":"object","properties":{"timestamp":{"description":"Timestamp when the error occurred.","type":"string"},"status":{"description":"Original HTTP error code, should be consistent with the response HTTP code","type":"integer"},"error":{"description":"Descriptive error message for debugging","type":"string"},"path":{"description":"Path of a resource that caused the error.","type":"string"}}}}}}}},"paths":{"/reward-points/public/customer":{"get":{"description":"Fetches the number of reward points of a currently signed-in customer.\n\n**Note:** This public API endpoint is accessible to all customers.","operationId":"GET-reward-points-fetch-logged-customer-points","tags":["Signed-In Customer Reward Points"],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"title":"pointsOut","type":"integer"}}}},"401":{"$ref":"#/components/responses/trait_unauthorized_401"},"403":{"$ref":"#/components/responses/trait_forbidden_403"},"500":{"$ref":"#/components/responses/trait_internal_500"}},"parameters":[],"summary":"Retrieving reward points of a signed-in customer"}}}}
```

## Retrieving a reward points summary of a signed-in customer

> Retrieves a detailed summary of added and redeemed reward points of a signed-in customer.\
> \
> \*\*Note:\*\* This public API endpoint is accessible to all customers.

```json
{"openapi":"3.0.0","info":{"title":"Reward Points Service","version":"0.0.1"},"tags":[{"name":"Signed-In Customer Reward Points"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"CustomerAccessToken":[]}],"components":{"securitySchemes":{"CustomerAccessToken":{"type":"http","scheme":"bearer"}},"schemas":{"pointsSummaryOut":{"title":"pointsSummaryOut","type":"object","properties":{"customerId":{"type":"string","description":"Id of the customer to whom the points are assigned"},"activePoints":{"type":"integer","description":"Active points that can be redeemed"},"summary":{"$ref":"#/components/schemas/customerSummary"}}},"customerSummary":{"title":"customerSummary","type":"object","properties":{"addedPointsList":{"type":"array","items":{"$ref":"#/components/schemas/addedPoints"}},"redeemedPointsList":{"type":"array","items":{"$ref":"#/components/schemas/redeemedPoints"}}},"required":["addedPointsList"]},"addedPoints":{"title":"addedPoints","type":"object","properties":{"id":{"type":"string"},"reference-id":{"type":"string","description":"Order Id for which the points were created","nullable":true},"description":{"type":"string","description":"Auto-generated description"},"points":{"type":"integer","description":"Number of points added in the operation"},"createdAt":{"type":"string","format":"date-time"},"validUntil":{"format":"date-time","type":"string","description":"The date until when the points can be redeemed"},"allPointsAfterCreation":{"type":"integer","description":"Number of points after creation"},"usedPoints":{"type":"integer","description":"Number of points already used"},"usedWith":{"type":"array","items":{"type":"string"}}},"required":["points"]},"redeemedPoints":{"title":"redeemedPoints","type":"object","properties":{"id":{"type":"string","description":"Identifier of the redeemed points"},"description":{"type":"string","description":"A comment for the redeem operation"},"points":{"type":"integer","description":"The amount of the redeemed points"},"createdAt":{"type":"string","format":"date-time","description":"Timestamp when the points were redeemed"},"allPointsAfterCreation":{"type":"integer","description":"Number of points after creation"}},"required":["points"]}},"responses":{"trait_unauthorized_401":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"trait_forbidden_403":{"description":"Given authorization scopes are not sufficient and do not match required scopes.\n","content":{"application/json":{"schema":{"title":"error","description":"Schema for API specified errors.","type":"object","properties":{"code":{"minimum":100,"maximum":599,"description":"Original HTTP error code, should be consistent with the response HTTP code","type":"integer"},"status":{"pattern":"[a-z]+[a-z_]*[a-z]+","description":"Classification of the error type in the lower case with underscore format, for example: `validation_failure`","type":"string"},"message":{"description":"Descriptive error message for debugging","type":"string"},"details":{"description":"List of problems causing this error","type":"array","items":{"title":"errorDetail","description":"Schema for a specific error cause","type":"string"}}},"required":["code","status"]}}}},"trait_internal_500":{"description":"Internal error","content":{"application/json":{"schema":{"title":"error","description":"Schema for API specified errors.","type":"object","properties":{"timestamp":{"description":"Timestamp when the error occurred.","type":"string"},"status":{"description":"Original HTTP error code, should be consistent with the response HTTP code","type":"integer"},"error":{"description":"Descriptive error message for debugging","type":"string"},"path":{"description":"Path of a resource that caused the error.","type":"string"}}}}}}}},"paths":{"/reward-points/public/customer/summary":{"get":{"description":"Retrieves a detailed summary of added and redeemed reward points of a signed-in customer.\n\n**Note:** This public API endpoint is accessible to all customers.","operationId":"GET-reward-points-retrieve-logged-customer-reward-summary","tags":["Signed-In Customer Reward Points"],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/pointsSummaryOut"}}}},"401":{"$ref":"#/components/responses/trait_unauthorized_401"},"403":{"$ref":"#/components/responses/trait_forbidden_403"},"500":{"$ref":"#/components/responses/trait_internal_500"}},"parameters":[],"summary":"Retrieving a reward points summary of a signed-in customer"}}}}
```

## Redeeming a logged-in customer's reward points for a coupon code

> Gets the logged-in customer's reward points, swaps them for a coupon code by using the given redemption option ID, and returns a coupon code.\
> \
> \*\*Note:\*\* This public API endpoint is accessible to all customers and is meant to be used on the storefront.

```json
{"openapi":"3.0.0","info":{"title":"Reward Points Service","version":"0.0.1"},"tags":[{"name":"Signed-In Customer Reward Points"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"CustomerAccessToken":[]}],"components":{"securitySchemes":{"CustomerAccessToken":{"type":"http","scheme":"bearer"}},"schemas":{"redeemCouponOut":{"title":"CouponCode","type":"object","properties":{"code":{"type":"string","description":"Coupon code received after exchanging points"}}}},"responses":{"trait_badRequest_400":{"description":"Request syntactically incorrect. Details of the error are included in the response payload.","content":{"application/json":{"schema":{"title":"error","description":"Schema for API specified errors.","type":"object","properties":{"status":{"minimum":100,"maximum":599,"description":"Original HTTP error code, should be consistent with the response HTTP code","type":"integer"},"title":{"pattern":"[a-z]+[a-z_]*[a-z]+","description":"Classification of the error type in the lower case with underscore format, for example: `validation_failure`","type":"string"},"type":{"description":"Type of the error.","type":"string"},"instance":{"type":"string","description":"Resource link"},"detail":{"description":"Detailed information about the error.","type":"string"}}}}}},"trait_forbidden_403":{"description":"Given authorization scopes are not sufficient and do not match required scopes.\n","content":{"application/json":{"schema":{"title":"error","description":"Schema for API specified errors.","type":"object","properties":{"code":{"minimum":100,"maximum":599,"description":"Original HTTP error code, should be consistent with the response HTTP code","type":"integer"},"status":{"pattern":"[a-z]+[a-z_]*[a-z]+","description":"Classification of the error type in the lower case with underscore format, for example: `validation_failure`","type":"string"},"message":{"description":"Descriptive error message for debugging","type":"string"},"details":{"description":"List of problems causing this error","type":"array","items":{"title":"errorDetail","description":"Schema for a specific error cause","type":"string"}}},"required":["code","status"]}}}},"trait_notFound_404":{"description":"Entity not found.\n","content":{"application/json":{"schema":{"title":"error","description":"Schema for API specified errors.","type":"object","properties":{"type":{"description":"Classification of the error type in the lower case with underscore format, for example: `validation_failure`","type":"string"},"status":{"description":"Original HTTP error code, should be consistent with the response HTTP code","type":"integer"},"message":{"description":"Descriptive error message for debugging","type":"string"},"details":{"description":"List of problems causing this error","type":"array","items":{"title":"errorDetail","description":"Schema for a specific error cause","type":"string"}}}}}}},"trait_internal_500":{"description":"Internal error","content":{"application/json":{"schema":{"title":"error","description":"Schema for API specified errors.","type":"object","properties":{"timestamp":{"description":"Timestamp when the error occurred.","type":"string"},"status":{"description":"Original HTTP error code, should be consistent with the response HTTP code","type":"integer"},"error":{"description":"Descriptive error message for debugging","type":"string"},"path":{"description":"Path of a resource that caused the error.","type":"string"}}}}}}},"parameters":{"siteCode":{"name":"siteCode","in":"query","required":false,"schema":{"type":"string","default":"main"},"description":"Site code, defined when a site is created."}}},"paths":{"/reward-points/public/customer/redeem":{"post":{"description":"Gets the logged-in customer's reward points, swaps them for a coupon code by using the given redemption option ID, and returns a coupon code.\n\n**Note:** This public API endpoint is accessible to all customers and is meant to be used on the storefront.","operationId":"POST-reward-points-redeem-logged-customer-reward-points-coupon","tags":["Signed-In Customer Reward Points"],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/redeemCouponOut"}}}},"400":{"$ref":"#/components/responses/trait_badRequest_400"},"403":{"$ref":"#/components/responses/trait_forbidden_403"},"404":{"$ref":"#/components/responses/trait_notFound_404"},"500":{"$ref":"#/components/responses/trait_internal_500"}},"parameters":[{"$ref":"#/components/parameters/siteCode"}],"requestBody":{"content":{"application/json":{"schema":{"title":"redeemOptionIn","type":"object","properties":{"id":{"type":"string","description":"The ID of the redeem option used to convert points into a coupon."}},"required":["id"]}}}},"summary":"Redeeming a logged-in customer's reward points for a coupon code"}}}}
```
