Skip to content

Open a Box

Request LoyaltyGyre to open a specific reward box for a player. This endpoint initiates the game logic on LoyaltyGyre’s backend, generates a prize, and returns the details of the item won by the player.

Endpoint

POST /box/open

Query Parameters

Parameter Type Description
player_id
Required
string / number The unique identifier for the player in the casino's system.
box_id
Required
string / number The unique identifier for the box to be opened.

Example Request

cURL
curl -X POST "https://app.loyaltygyre.com/api/box/open" \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{"player_id": "12345", "box_id": "58"}'

Responses

200 OK

The box was successfully opened, and the prize details are returned, including the ID of the item won by the player.

Response
{
  "status": "success",
  "message": "Box opened successfully",
  "prize": {
    "id": "202"
  }
}


400 Bad Request

The request is missing required parameters or contains invalid data.

Response
{
  "status": "error",
  "message": "Missing or invalid player_id or box_id"
}

401 Unauthorized

The API key is missing or invalid.

Response
{
  "status": "error",
  "message": "Invalid or missing API key"
}

404 Not Found

The specified box was not found or is unavailable for the player.

Response
{
  "status": "error",
  "message": "Box not found or unavailable"
}

500 Internal Server Error

An internal error occurred while processing the request.

Response
{
  "status": "error",
  "message": "An error occurred while opening the box."
}