API ReferenceChallenges
Accept a challenge
Accepts a pending incoming challenge from another user. After accepting, a new chess match is created between both players.
Triggers the challenge:accepted ws event to the target user.
Path Parameters
challenge_id*string
Header Parameters
Response Body
application/json
curl -X POST "https://example.com/api/me/challenges/string/accept"{ "success": true, "data": { "challenge": { "id": 1, "createdAt": "2024-01-01T12:00:00Z", "fromId": "123e4567-e89b-12d3-a456-426614174000", "toId": "987e6543-e21b-34d5-a678-426614174000", "challengerColor": "random", "status": "pending", "matchId": null, "from": { "id": "123e4567-e89b-12d3-a456-426614174000", "name": "John Doe", "username": "johndoe", "createdAt": "2024-01-01T12:00:00Z", "updatedAt": "2024-01-01T12:00:00Z", "botOwnerId": null, "rating": 1200, "rd": 350, "vol": 0.06 }, "to": { "id": "987e6543-e21b-34d5-a678-426614174000", "name": "Jane Doe", "username": "janedoe", "createdAt": "2024-01-01T12:00:00Z", "updatedAt": "2024-01-01T12:00:00Z", "botOwnerId": null, "rating": 1200, "rd": 350, "vol": 0.06 }, "ranked": true }, "match": { "id": 1, "createdAt": "2024-01-01T12:00:00Z", "status": "active", "whiteId": "123e4567-e89b-12d3-a456-426614174000", "blackId": "987e6543-e21b-34d5-a678-426614174000", "endReason": null, "fen": "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", "pgn": "[Event \"Casual\"]\n[Site \"https://chessnow.angelcmh.com\"]\n[Date \"2024.01.01\"]\n[Round \"0\"]\n[White \"johndoe\"]\n[Black \"janedoe\"]\n[Result \"*\"]\n\n*", "finishedAt": null, "whitePlayer": { "id": "123e4567-e89b-12d3-a456-426614174000", "name": "John Doe", "username": "johndoe", "createdAt": "2024-01-01T12:00:00Z", "updatedAt": "2024-01-01T12:00:00Z", "botOwnerId": null, "rating": 1200, "rd": 350, "vol": 0.06 }, "blackPlayer": { "id": "987e6543-e21b-34d5-a678-426614174000", "name": "Jane Doe", "username": "janedoe", "createdAt": "2024-01-01T12:00:00Z", "updatedAt": "2024-01-01T12:00:00Z", "botOwnerId": null, "rating": 1200, "rd": 350, "vol": 0.06 }, "whiteRatingDiff": null, "blackRatingDiff": null, "activeDrawRequest": null, "whiteRequestedDraw": false, "blackRequestedDraw": false, "ranked": true } }}Request a challenge POST
Requests a new chess challenge to a user by their username. This creates a pending challenge record which, once the target user accepts, starts a match. Triggers the `challenge:request` ws event to the target user.
Deny a challenge POST
Declines a pending incoming challenge. This updates the challenge status to declined. Doesn't create a match. Triggers the `challenge:denied` ws event to the target user.