Skip to main content

Overview

Bots can create challenges to other players, and receive and respond to challenges from other players. Challenges are received through the event stream.

Accept a Challenge

POST /api/challenge//accept

Accept an incoming challenge.

Authentication

Requires OAuth token with challenge:write, bot:play, or board:play scope.

Parameters

string
required
The challenge ID received from the event stream
string
Accept the challenge and request a specific color: white or black. If not specified, color is random.

Request

Response

boolean
Success status

Rate Limits

Bots can accept challenges but are subject to:
  • Maximum concurrent games (typically 5 for bots)
  • Opponent-specific limits to prevent spam

Decline a Challenge

POST /api/challenge//decline

Decline an incoming challenge.

Authentication

Requires OAuth token with challenge:write, bot:play, or board:play scope.

Parameters

string
required
The challenge ID to decline
string
Reason for declining. Options:
  • generic - No specific reason
  • later - Will play later
  • tooFast - Time control too fast
  • tooSlow - Time control too slow
  • timeControl - Don’t like the time control
  • rated - Don’t want to play rated
  • casual - Don’t want to play casual
  • standard - Only play standard chess
  • variant - Don’t play this variant
  • noBot - Don’t play with bots
  • onlyBot - Only play with bots

Request

Response

boolean
Success status

Cancel a Challenge

POST /api/challenge//cancel

Cancel a challenge that you created.

Authentication

Requires OAuth token with challenge:write, bot:play, or board:play scope.

Parameters

string
required
The challenge ID to cancel
string
OAuth token of the opponent (only needed for special cases)

Request

Response


Create a Challenge

POST /api/challenge/

Challenge another player to a game.

Authentication

Requires OAuth token with challenge:write, bot:play, or board:play scope.

Parameters

string
required
Username of the player to challenge
boolean
default:"false"
Whether the game should be rated
integer
Clock initial time in seconds (for real-time games)
integer
Clock increment in seconds (for real-time games)
integer
Days per turn (for correspondence games, 1-15)
string
default:"random"
Your color: white, black, or random
string
default:"standard"
Chess variant:
  • standard
  • chess960
  • crazyhouse
  • antichess
  • atomic
  • horde
  • kingOfTheHill
  • racingKings
  • threeCheck
string
Custom initial position in FEN notation
boolean
default:"false"
Keep the stream open to receive challenge status updates
string[]
Game rules/modifiers:
  • noAbort - Players cannot abort the game
  • noRematch - Players cannot offer a rematch
  • noGiveTime - Players cannot give extra time
  • noClaimWin - Players cannot claim victory when opponent is disconnected
  • noEarlyDraw - Players cannot offer draw before ply 40
string
OAuth token of the opponent for instant acceptance

Request

Response

object
The created challenge

Open Challenge

POST /api/challenge/open

Create an open challenge that anyone can accept. Generates unique URLs for white and black.
Open challenges are useful for creating challenge links that can be shared publicly or embedded on websites.

Authentication

Requires OAuth token with challenge:write scope, or anonymous access for verified users.

Parameters

Same parameters as Create a Challenge, except no username is needed.
boolean
default:"false"
Whether the game should be rated
integer
Clock initial time in seconds
integer
Clock increment in seconds
integer
Days per turn (for correspondence, 1-15)
string
default:"standard"
Chess variant
string
Custom initial position in FEN
string
Optional challenge name/description
string[]
Game rules (same as regular challenges)

Request

Response

object
The created challenge
string
URL for accepting as white
string
URL for accepting as black

Get Challenge Info

GET /api/challenge//show

Get information about a challenge.

Authentication

Requires OAuth token with challenge:read scope.

Request


List Challenges

GET /api/challenge

List all challenges created by or targeted at the authenticated user.

Authentication

Requires OAuth token.

Request

Response

array
Challenges received
array
Challenges sent

Challenge Handling Best Practices

Auto-Accept Logic

Rate Limiting

Be aware of rate limits:
  • Bot concurrent games: Typically 5 active games maximum
  • Challenge creation: Limited to prevent spam
  • Challenge to specific user: Higher rate limit for friends, lower for strangers

Error Handling

Common errors when creating challenges:
  • "No such user" - Username doesn’t exist
  • "User does not follow you" - Required for non-friends in some cases
  • "Cannot challenge yourself" - Self-explanatory
  • "This user does not accept challenges" - User has disabled challenges
  • "Too many requests" - Rate limited

See Also