♔ API Overview

Welcome to the ChessMaster Forum API. Our RESTful API allows you to integrate chess games, forum discussions, tournament data, and user profiles directly into your applications. All endpoints return JSON responses and require authentication.

💡 Pro Tip

Start with the Authentication section to generate your API key, then explore the endpoint examples below.

🔐 Authentication

Access to the API is secured using Bearer tokens. Include your API key in the Authorization header of every request.

HTTP Header
Authorization: Bearer YOUR_API_KEY_HERE

Generate your key from the Developer Dashboard. Keys are scoped to either read or read+write permissions.

🌐 Base URL & Headers

All requests should be made to:

Base URL
https://api.chessmasterforum.com/v1

Standard headers required:

HeaderTypeDescription
Content-TypestringMust be application/json
Acceptstringapplication/json
X-Client-VersionstringOptional. SDK version for tracking

Get Current User

GET /users/me

Returns the authenticated user's profile, rating, and subscription tier.

Response (200 OK)
{
  "id": "usr_8x9k2m4p",
  "username": "grandmaster_alex",
  "email": "alex@example.com",
  "rating": {
    "blitz": 2450,
    "rapid": 2380,
    "classical": 2510
  },
  "tier": "premium",
  "joined_at": "2022-03-15T08:30:00Z",
  "is_verified": true
}

Create New Game

POST /games/new

Initiates a new chess match. Requires a target user ID or open lobby configuration.

ParameterTypeRequiredDescription
opponent_idstringYesTarget user ID to challenge
time_controlstringYesFormat: m+increment (e.g., 5+3)
variantstringOptionalDefault: standard. Options: standard, chess960, bughouse
color_preferencestringOptionalwhite, black, or random
Request Body
{
  "opponent_id": "usr_7h3j9n1q",
  "time_control": "10+5",
  "variant": "standard",
  "color_preference": "random"
}

Submit Move

PUT /games/{game_id}/moves

Records a move for an active game. Uses standard algebraic notation (SAN).

Response (200 OK)
{
  "success": true,
  "move_index": 14,
  "fen": "r1bqkb1r/pppp1ppp/2n2n2/4p2Q/2B1P3/8/PPPP1PPP/RNB1K1NR w KQkq - 4 4",
  "is_check": true,
  "time_remaining": 342
}

List Forum Threads

GET /forum/threads

Retrieves paginated forum discussions. Supports filtering by category, tag, and sort order.

Query ParamTypeDescription
categorystringFilter by: openings, tactics, general, bugs
sortstringlatest, top, unresolved
pageintegerPage number (default: 1)
limitintegerItems per page (max: 50)

Upcoming Tournaments

GET /tournaments

Returns active and upcoming tournament brackets, schedules, and registration status.

Response (200 OK)
{
  "data": [
    {
      "id": "trn_9m2x4k8p",
      "name": "Weekly Blitz Championship",
      "format": "Swiss 9-round",
      "time_control": "3+2",
      "starts_at": "2025-06-15T18:00:00Z",
      "status": "registration_open",
      "participants": 842,
      "prize_pool": 2500
    }
  ]
}

⚠️ Error Handling

The API uses standard HTTP status codes. All errors return a structured JSON response.

CodeMeaningResolution
200SuccessRequest completed
400Bad RequestCheck payload format & params
401UnauthorizedInvalid or missing API key
403ForbiddenInsufficient permissions
429Rate LimitedSlow down. Check X-RateLimit-Reset
500Server ErrorRetry with exponential backoff
Error Response Format
{
  "error": {
    "code": "INVALID_MOVE",
    "message": "Move 'Qh7#' is illegal in current position",
    "details": {
      "game_id": "gm_3x8k2m9p",
      "move_index": 12
    }
  }
}