curl -X GET "https://gachabe-staging.fly.dev/api/v1/chests/550e8400-e29b-41d4-a716-446655440000/open" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/vnd.api+json"
{
  "data": {
    "chest_id": "550e8400-e29b-41d4-a716-446655440000",
    "opened_at": "2024-01-15T14:35:22Z",
    "collectibles": [
      {
        "type": "collectible",
        "id": "collectible_001",
        "attributes": {
          "name": "Ancient Dragon Scale",
          "description": "A shimmering scale from an ancient dragon",
          "rarity": "legendary",
          "collection_id": "dragon-artifacts",
          "images": [
            "https://example.com/images/dragon-scale.png"
          ]
        }
      },
      {
        "type": "collectible",
        "id": "collectible_002",
        "attributes": {
          "name": "Dragon Tooth Pendant",
          "description": "A pendant carved from a dragon's tooth",
          "rarity": "rare",
          "collection_id": "dragon-artifacts",
          "images": [
            "https://example.com/images/dragon-pendant.png"
          ]
        }
      },
      {
        "type": "collectible",
        "id": "collectible_003",
        "attributes": {
          "name": "Fire Gem",
          "description": "A gem that burns with eternal flame",
          "rarity": "common",
          "collection_id": "elemental-gems",
          "images": [
            "https://example.com/images/fire-gem.png"
          ]
        }
      }
    ],
    "statistics": {
      "total_items": 3,
      "rarity_breakdown": {
        "legendary": 1,
        "rare": 1,
        "common": 1
      }
    }
  },
  "meta": {
    "chest_consumed": true,
    "experience_gained": 150,
    "message": "Congratulations! You found some amazing treasures!"
  }
}
Open a chest to reveal its contents. This endpoint returns a randomly generated list of collectibles based on the chest’s internal rules and rarity settings.
Opening a chest consumes it from the player’s inventory. This action cannot be undone.

Path Parameters

id
string
required
Unique identifier of the chest to open. Must be a valid UUID format and the chest must be owned by the authenticated player.
curl -X GET "https://gachabe-staging.fly.dev/api/v1/chests/550e8400-e29b-41d4-a716-446655440000/open" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/vnd.api+json"
{
  "data": {
    "chest_id": "550e8400-e29b-41d4-a716-446655440000",
    "opened_at": "2024-01-15T14:35:22Z",
    "collectibles": [
      {
        "type": "collectible",
        "id": "collectible_001",
        "attributes": {
          "name": "Ancient Dragon Scale",
          "description": "A shimmering scale from an ancient dragon",
          "rarity": "legendary",
          "collection_id": "dragon-artifacts",
          "images": [
            "https://example.com/images/dragon-scale.png"
          ]
        }
      },
      {
        "type": "collectible",
        "id": "collectible_002",
        "attributes": {
          "name": "Dragon Tooth Pendant",
          "description": "A pendant carved from a dragon's tooth",
          "rarity": "rare",
          "collection_id": "dragon-artifacts",
          "images": [
            "https://example.com/images/dragon-pendant.png"
          ]
        }
      },
      {
        "type": "collectible",
        "id": "collectible_003",
        "attributes": {
          "name": "Fire Gem",
          "description": "A gem that burns with eternal flame",
          "rarity": "common",
          "collection_id": "elemental-gems",
          "images": [
            "https://example.com/images/fire-gem.png"
          ]
        }
      }
    ],
    "statistics": {
      "total_items": 3,
      "rarity_breakdown": {
        "legendary": 1,
        "rare": 1,
        "common": 1
      }
    }
  },
  "meta": {
    "chest_consumed": true,
    "experience_gained": 150,
    "message": "Congratulations! You found some amazing treasures!"
  }
}

Response Fields

data
object
required
Chest opening results and rewards
meta
object
Additional information about the opening

Opening Mechanics

Each chest contains predefined rules that determine:
  • Number of items to drop
  • Rarity distribution probabilities
  • Specific collectible pools to draw from
  • Bonus rewards or special conditions
1

Verify ownership

Ensure the authenticated player owns the chest before attempting to open it.
Check the player’s chest inventory using the Get Player Chests endpoint.
2

Open the chest

Call this endpoint to reveal the chest contents.
The chest will be immediately consumed and cannot be opened again.
3

Process rewards

Handle the returned collectibles and update the player’s collection.
All collectibles are automatically added to the player’s inventory.
4

Update UI

Display the rewards to the player with appropriate animations or effects.
Use the rarity information to show special effects for rare items.

Error Scenarios

Status: 403 ForbiddenThe player doesn’t own this chest or it has already been opened.Solution: Verify chest ownership before showing open options to the player.
The collectibles received are immediately added to the player’s permanent collection. Use the Get Collections endpoint to view organized collections.