Authentication
On this page, we'll dive into the different authentication endpoints you can use to login and registration.
Register a new user
This endpoint allows you to create a new user by registering with a username and chat id.
Required attributes
- Name
username
- Type
- string
- Description
The username of the user you want to register.
- Name
password
- Type
- string
- Description
The password of the user you want to register.
- Name
account
- Type
- string
- Description
The telegram chat id of the user you want to register.
Request
curl -X POST https://watchdog-api.zeroruka.moe/v1/register/ \
-d username={username} \
-d password={password} \
-d account={chat_id}
Response
{
"message": "User {username} was created",
"id": {id},
"chat_id": {chat_id}
}
Login to an existing user account
This endpoint allows you to login to an existing user account. You will receive a Bearer token that you can use to authenticate yourself in other endpoints.
Required attributes
- Name
username
- Type
- string
- Description
The username of the user you want to login.
- Name
password
- Type
- string
- Description
The password of the user you want to login.
Request
curl -X POST https://watchdog-api.zeroruka.moe/v1/login/ \
-d username={username} \
-d password={password}
Response
{
"token": {token}
}
Change password
This endpoint allows you to change your password for the current user authenticated by the Bearer token.
Required attributes
- Name
old_password
- Type
- string
- Description
The old password of the user you want to change, it must match the current password.
- Name
new_password
- Type
- string
- Description
The new password of the user you want to change.
Request
curl -X POST https://watchdog-api.zeroruka.moe/v1/change-password/ \
-H "Authorization: Bearer {token}" \
-d old_password={old_password} \
-d new_password={new_password}
Response
{
"message": "Password changed successfully"
}