Skip to main content

REST API Endpoints

Base URL

Development: Retrieved from VITE_API_URL environment variable

Authentication

All REST API requests are sent with the X-Player-Token header:

headers: {
"X-Player-Token": launchUrlToken // Token from URL
}

Endpoints

1. Health Check

GET /v1

Response:

{
"type": "success",
"status": 200,
"message": "API is healthy"
}

2. Get Room List

GET /v1/rooms

Query Parameters:

  • min_bet_amount (number, optional): Minimum bet amount
  • max_bet_amount (number, optional): Maximum bet amount
  • player_limit (number, optional): Player limit (2 or 4)
  • status (string, optional): Room status ("waiting", "playing", "finished")
  • currency (string, optional): Currency
  • page (number, optional): Page number (default: 1)
  • limit (number, optional): Records per page (default: 20, max: 100)

Response:

{
"type": "success",
"status": 200,
"data": {
"rooms": [
{
"id": "room-123",
"name": "Test Room",
"bet_amount": 10.5,
"currency": "USD",
"current_players": 2,
"max_players": 4,
"player_limit": 4,
"status": "waiting",
"is_joinable": true,
"is_incremental": false,
"rake_percentage": 5,
"time_bank": 30,
"turn": 1,
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z",
"players": [
{
"id": "player-1",
"name": "Player 1",
"joined_at": "2024-01-01T00:00:00Z"
}
],
"url": "https://example.com/room/room-123"
}
],
"active_rooms": [],
"total": 10,
"page": 1,
"limit": 20,
"total_pages": 1
}
}

3. Get Room Details

GET /v1/rooms/{room_id}

Response:

{
"type": "success",
"status": 200,
"data": {
"id": "room-123",
"name": "Test Room",
"bet_amount": 10.5,
"currency": "USD",
"current_players": 2,
"max_players": 4,
"player_limit": 4,
"status": "waiting",
"is_joinable": true,
"players": [...]
}
}

4. Create Room

POST /v1/rooms

Request Body:

{
"name": "My Room",
"bet_amount": 10.5,
"currency": "USD",
"player_limit": 4,
"turn": 30,
"time_bank": 30,
"is_incremental": false,
"rake_percentage": 5
}

Request Body Descriptions:

  • name (string, required, 1-50 characters): Room name
  • bet_amount (number, required, min: 0.01): Bet amount
  • currency (string, required, 1-10 characters): Currency
  • player_limit (number, required): Player limit (2 or 4)
  • turn (number, required, min: 1): Turn duration (seconds)
  • time_bank (number, optional): Time bank duration (0, 30, 45, 60, 90)
  • is_incremental (boolean, optional): Incremental bet mode
  • rake_percentage (number, optional, 0-100): Rake percentage

Response:

{
"type": "success",
"status": 200,
"data": {
"id": "room-123",
"name": "My Room",
"bet_amount": 10.5,
"currency": "USD",
"current_players": 1,
"max_players": 4,
"player_limit": 4,
"status": "waiting",
"is_joinable": true,
"url": "https://example.com/room/room-123"
}
}

5. Player Information

GET /v1/player/me

Response:

{
"type": "success",
"status": 200,
"data": {
"username": "player1",
"balance": "1000.00",
"currency": "USD",
"avatar": {
"name": "avatar1",
"url": "https://example.com/avatar1.png"
}
}
}

6. Query Balance

GET /v1/player/balance

Response:

{
"type": "success",
"status": 200,
"data": {
"balance": "1000.00",
"currency": "USD"
}
}