API Reference

Complete API documentation for developers building on Solwagers.

Base URL

https://solwagers.com/api

Public API

All endpoints are publicly accessible and do not require authentication.

Get Game Winner

GET/api/public/game/[gameId]/winner

Get the winner of a completed game.

Response
GET /api/public/game/abc123/winner

Response:
{
  "gameId": "abc123",
  "status": "completed",
  "winner": "player1",
  "winnerInfo": {
    "player": "player1",
    "wallet": "7xKXtg2...",
    "username": "player1_username",
    "userId": "user_id_here"
  },
  "wagerAmount": 0.1,
  "gameType": "chess",
  "completedAt": "2025-01-15T10:30:00Z"
}

Get Player Portfolio

GET/api/public/portfolio/[username]

Get a player's portfolio statistics and recent games by username.

Response
GET /api/public/portfolio/player_username

Response:
{
  "userId": "user_id_here",
  "username": "player_username",
  "image": "https://cdn.discordapp.com/avatars/...",
  "rating": 1200,
  "stats": {
    "totalGames": 50,
    "totalWins": 30,
    "totalLosses": 18,
    "totalDraws": 2,
    "winRate": 60.0,
    "totalEarnings": 2.5,
    "totalWagered": 5.0,
    "rating": 1200
  },
  "recentGames": [
    {
      "gameId": "abc123",
      "gameType": "chess",
      "title": "Quick Match",
      "result": "win",
      "wagerAmount": 0.1,
      "ratingChange": 15,
      "opponent": {
        "username": "opponent_name",
        "wallet": "7xKXtg2C..."
      },
      "completedAt": "2025-01-15T10:30:00Z"
    }
  ]
}

Error Responses

All errors follow a consistent format:

Error Format
{
  "error": "Human-readable error message"
}

Common HTTP status codes:

  • 400 — Bad request (missing or invalid parameters)
  • 404 — Resource not found
  • 500 — Internal server error

© 2026 SolWagers. All rights reserved.