Skip to content

Mini-games ​

Use the loyalty service’s mini-game player, session, score, and points operations. Most operations require a customer token.

Access labels such as Origin + Brand key + Customer are defined in Headers and access. Each endpoint ends in a Try it console; set the host and keys once in its Settings tab or on the overview.

Get the current mini-game player (v2) ​

MethodURL pathRequired access
GET/api/v2/brand/mini-game/userOrigin + Brand key + Customer

Request fields: no body, query, or path fields are read by this controller. Context comes from the headers/middleware above.

Example:

bash
curl -X GET "$BASE_URL/api/v2/brand/mini-game/user" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY" \
  -H "Authorization: Bearer $CUSTOMER_TOKEN"

Response: Upstream/service JSON is returned directly, without an extra envelope. The response schema belongs to the separate loyalty service; local service failures return {"success":false,"error":"..."}.

Source: app/v2/controller/miniGames_controller.ts:17 → getMiniGameUser; routes: routes/v2/miniGames_routes.ts:59; service: _getMiniGameUser (app/v2/service/miniGames_services.ts:54).

List mini-game player records (v2) ​

MethodURL pathRequired access
GET/api/v2/brand/mini-game/user/allOrigin + Brand key + Customer

Request fields:

FieldTypeRequiredRules / meaning
queryobjectoptional—
query.limitnumberoptional—
query.offsetnumberoptional—

Example:

bash
curl -X GET "$BASE_URL/api/v2/brand/mini-game/user/all?limit=10&offset=0" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY" \
  -H "Authorization: Bearer $CUSTOMER_TOKEN"

Response: Upstream/service JSON is returned directly, without an extra envelope. The response schema belongs to the separate loyalty service; local service failures return {"success":false,"error":"..."}.

Source: app/v2/controller/miniGames_controller.ts:33 → getAllMiniGameUser; routes: routes/v2/miniGames_routes.ts:66; service: _getAllMiniGameUser (app/v2/service/miniGames_services.ts:78).

Get mini game leaderboard (v2) ​

MethodURL pathRequired access
GET/api/v2/brand/mini-game/leaderboardOrigin + Brand key + Customer

Request fields: no body, query, or path fields are read by this controller. Context comes from the headers/middleware above.

Example:

bash
curl -X GET "$BASE_URL/api/v2/brand/mini-game/leaderboard" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY" \
  -H "Authorization: Bearer $CUSTOMER_TOKEN"

Response: Upstream/service JSON is returned directly, without an extra envelope. The response schema belongs to the separate loyalty service; local service failures return {"success":false,"error":"..."}.

Source: app/v2/controller/miniGames_controller.ts:61 → getMiniGameLeaderboard; routes: routes/v2/miniGames_routes.ts:73; service: _getMiniGameLeaderboard (app/v2/service/miniGames_services.ts:108).

Start a mini-game session (v2) ​

MethodURL pathRequired access
POST/api/v2/brand/mini-game/sessionOrigin + Brand key + Customer

Request fields:

FieldTypeRequiredRules / meaning
body.payloadobjectyes—
body.payload.mini_game_idnumberyes—

Example:

bash
curl -X POST "$BASE_URL/api/v2/brand/mini-game/session" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY" \
  -H "Authorization: Bearer $CUSTOMER_TOKEN" \
  -H 'Content-Type: application/json' \
  --data-raw '{"payload":{"mini_game_id":1}}'

Response: Upstream/service JSON is returned directly, without an extra envelope. The response schema belongs to the separate loyalty service; local service failures return {"success":false,"error":"..."}.

Source: app/v2/controller/miniGames_controller.ts:77 → postMiniGameSession; routes: routes/v2/miniGames_routes.ts:80; service: _postMiniGameSession (app/v2/service/miniGames_services.ts:135).

Submit a mini-game score (v2) ​

MethodURL pathRequired access
POST/api/v2/brand/mini-game/scoreOrigin + Brand key + Customer

Request fields:

FieldTypeRequiredRules / meaning
body.payloadobjectyes—
body.payload.session_idstringyes—
body.payload.scorenumberyesMinimum (0)

Example:

bash
curl -X POST "$BASE_URL/api/v2/brand/mini-game/score" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY" \
  -H "Authorization: Bearer $CUSTOMER_TOKEN" \
  -H 'Content-Type: application/json' \
  --data-raw '{"payload":{"session_id":"<SESSION_ID>","score":100}}'

Response: Upstream/service JSON is returned directly, without an extra envelope. The response schema belongs to the separate loyalty service; local service failures return {"success":false,"error":"..."}.

Source: app/v2/controller/miniGames_controller.ts:104 → postMiniGameScore; routes: routes/v2/miniGames_routes.ts:87; service: _postMiniGameScore (app/v2/service/miniGames_services.ts:164).

Convert a session score to loyalty points (v2) ​

MethodURL pathRequired access
POST/api/v2/brand/mini-game/score-conversionOrigin + Brand key + Customer

Request fields:

FieldTypeRequiredRules / meaning
body.payloadobjectyes—
body.payload.session_idstringyes—

Example:

bash
curl -X POST "$BASE_URL/api/v2/brand/mini-game/score-conversion" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY" \
  -H "Authorization: Bearer $CUSTOMER_TOKEN" \
  -H 'Content-Type: application/json' \
  --data-raw '{"payload":{"session_id":"<SESSION_ID>"}}'

Response: Upstream/service JSON is returned directly, without an extra envelope. The response schema belongs to the separate loyalty service; local service failures return {"success":false,"error":"..."}.

Source: app/v2/controller/miniGames_controller.ts:132 → postMiniGameScoreConversion; routes: routes/v2/miniGames_routes.ts:94; service: _postMiniGameScoreConversion (app/v2/service/miniGames_services.ts:196).

Spend points on mini-game lives (v2) ​

MethodURL pathRequired access
POST/api/v2/brand/mini-game/consume-pointsOrigin + Brand key + Customer

Request fields:

FieldTypeRequiredRules / meaning
body.payloadobjectyes—
body.payload.itemstringyesAllowed values ("lives")
body.payload.mini_game_idnumberoptionalInteger; Positive

Example:

bash
curl -X POST "$BASE_URL/api/v2/brand/mini-game/consume-points" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY" \
  -H "Authorization: Bearer $CUSTOMER_TOKEN" \
  -H 'Content-Type: application/json' \
  --data-raw '{"payload":{"item":"lives"}}'

Response: Upstream/service JSON is returned directly, without an extra envelope. The response schema belongs to the separate loyalty service; local service failures return {"success":false,"error":"..."}.

Source: app/v2/controller/miniGames_controller.ts:162 → postMiniGameConsumePoints; routes: routes/v2/miniGames_routes.ts:101; service: _postMiniGameConsumePoints (app/v2/service/miniGames_services.ts:227).

Lifecycle ​

These endpoints forward to the separate loyalty service, which owns the session and its rules; this API validates the request shape and nothing more. The order the calls must come in, from the fields each one requires:

Buying lives with points — Spend points on mini-game lives — sits outside the session. What the loyalty service does with a second score or a second conversion for the same session is not visible from this backend.

Batch platform, Shopify app and API documentation