Skip to content
moxon home

Tic-Tac-Toe Forfeit

The /tic-tac-toe/forfeit endpoint forfeits (abandons) a game.

posthttps://api.moxon.dev/v6/tic-tac-toe/forfeit

Changed in 6.0.0

This endpoint moved from DELETE to POST, and its identifier left the URL: game is now sent in the JSON body. PATCH and DELETE no longer exist anywhere in the API.

Try itpost/v6/tic-tac-toe/forfeit

Parameters

  • gamestringrequired

    The game identifier

  • usernamestringrequired

    The username forfeiting

  • sessionstringrequired

    The user's session identifier

Good to know

All parameters are sent as a JSON body with Content-Type: application/json.

Response Fields

  • messagestring

    Confirmation of the forfeit

  • winnerstring|null

    Username of the winner (opponent), null if the player was alone in the game

  • loserstring

    Username of the player who forfeit

The game is deleted after a forfeit.

Code Examples

Error Handling

If parameters are missing or invalid, the API will return an error:

  • 400Please provide a username (?username={username})The username parameter is missing
  • 400Please provide a valid session ID (&session={ID})The session parameter is missing
  • 400Please provide a game ID (&game={ID})The game parameter is missing
  • 400Game not foundThe game does not exist
  • 400Session ID mismatchSession doesn't match the player
  • 400You are not a player in this gameThe player is not part of this game