Skip to content

Tic-Tac-Toe Forfeit ​

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

Parameters ​

ParameterRequiredDescription
gameYesThe game identifier (URL parameter)
usernameYesThe username forfeiting
sessionYesThe user's session identifier

Good to know

The game parameter is part of the URL path. The other 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 DELETE \
  -H "Content-Type: application/json" \
  -d '{
    "username": "alice",
    "session": "abc123"
  }' \
  "https://api.sylvain.sh/v4/tic-tac-toe/VWXYZ"

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