Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.foodsave.kz/llms.txt

Use this file to discover all available pages before exploring further.

Loyalty API

Base path: /api/v1/loyalty

Overview

Loyalty endpoints expose score, referral and promo-code workflows.
The score endpoint is read-only, while referral and promo application mutate user state and should be retried carefully.

GET /api/v1/loyalty/score

Return the current user’s score.
{ "userId":"u-1", "points": 340, "level":"Silver", "foodSavedGrams": 1250, "ordersCompleted": 19, "referralCode":"SAVE-ABCD" }
points
number
level
string

POST /api/v1/loyalty/referral

Attach a referral code.
curl --request POST \
  --url https://api.foodsave.kz/api/v1/loyalty/referral \
  -H 'Authorization: Bearer $CUSTOMER_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"referralCode":"SAVE-ABCD"}'
{ "userId":"u-1", "points": 340, "level":"Silver" }

POST /api/v1/loyalty/promo/apply

Validate a promo code and compute discount.
{ "valid": true, "discountCents": 500, "error": null }
Promo validation does not reserve inventory or lock pricing; apply the promo only after order re-check.

Errors

CodeMeaningHow to fix
400INVALID_PROMOCheck code and minimum order amount

POST /api/v1/admin/promo/create

Create a promo code.
{ "id":"promo-1", "code":"WELCOME10", "active":true }
id
string
active
boolean

PUT /api/v1/admin/promo/{id}/active

Enable or disable a promo.
{ "id":"promo-1", "active":false }
id
string
active
boolean