Skip to content

Tic-Tac-Toe Forfeit ​

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

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.

Parameters ​

ParameterRequiredDescription
gameYesThe game identifier
usernameYesThe username forfeiting
sessionYesThe user's session identifier

Good to know

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

Response Fields ​

FieldTypeDescription
messagestringConfirmation of the forfeit
winnerstringUsername of the winner (opponent)
loserstringUsername of the player who forfeit

Code Examples ​

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "game": "VWXYZ",
    "username": "alice",
    "session": "abc123"
  }' \
  "https://api.sylvain.sh/v6/tic-tac-toe/forfeit"

Try It ​

Error Handling ​

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

Error MessageDescription
Session ID mismatchSession doesn't match the player