This section presents all requests related to user account operations.
Allows you to register a new account.
POST /api/register
{
"login": "email@example.com",
"password": "Pa$$w0rd!",
"nickname": "nickname"
}
login: any string up to 64 characters (an email is a good choice).password: at least 6 characters.nickname: 3–16 characters, latin letters, digits, _ or -. It is public and shown to opponents.201{
"id": "66c9f1b2e4b0a1c2d3e4f5a6",
"login": "email@example.com",
"nickname": "nickname"
}
| Status | error |
|—|—|
| 400 | Login, password and nickname required. / validation messages |
| 409 | Login already exists. / Nickname already exists. |
Allows you to log in to your account and create a session.
POST /api/login
{
"login": "email@example.com",
"password": "Pa$$w0rd!"
}
200{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": "66c9f1b2e4b0a1c2d3e4f5a6",
"login": "email@example.com",
"nickname": "nickname"
}
}
The token is valid for 7 days. Send it in the Authorization: Bearer <token> header.
| Status | error |
|—|—|
| 400 | Login and password required |
| 401 | Invalid credentials |
POST /api/change-password
Authorization: Bearer <token>
{
"oldPassword": "Pa$$w0rd!",
"newPassword": "N3wPa$$w0rd!"
}
200{ "success": true }
| Status | error |
|—|—|
| 400 | Old and new password required / Password must be at least 6 characters. |
| 401 | No token provided / Invalid token |
| 403 | Old password incorrect |