Manage user accounts, authentication, and profiles.
Get Current User
GET /api/user
Get information about the current user associated with the authentication token.
Authentication: Required
curl https://opentogethertube.com/api/user \
-H "Authorization: Bearer YOUR_TOKEN"
Response (Logged In)
Whether the user is logged into an account
Whether the user has linked their Discord account
{
"username": "john_doe",
"loggedIn": true,
"discordLinked": true
}
Response (Not Logged In)
{
"username": "guest-swift-otter",
"loggedIn": false
}
Update Username
POST /api/user
Update the username for the current session.
Authentication: Required
Request Body
New username (max 20 characters)
curl -X POST https://opentogethertube.com/api/user \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"username": "new_username"}'
Response
Error: Username Taken
{
"success": false,
"error": {
"name": "UsernameTaken",
"message": "Somebody else is already using that username."
}
}
Register Account
POST /api/user/register
Register a new user account.
Authentication: Required (token will be upgraded to registered session)
Request Body
curl -X POST https://opentogethertube.com/api/user/register \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"username": "john_doe",
"email": "[email protected]",
"password": "securepassword123"
}'
Response
{
"success": true,
"user": {
"username": "john_doe",
"email": "[email protected]"
}
}
Error Response
{
"success": false,
"error": {
"name": "ValidationError",
"message": "Username is already taken",
"fields": ["username"]
}
}
Login
POST /api/user/login
Log into an existing account.
Authentication: Required (token will be upgraded to registered session)
Request Body
Optional username (for backwards compatibility)
curl -X POST https://opentogethertube.com/api/user/login \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "securepassword123"
}'
Response
{
"success": true,
"user": {
"username": "john_doe",
"email": "[email protected]"
}
}
Error Response (Invalid Credentials)
{
"success": false,
"error": {
"name": "AuthenticationError",
"message": "Invalid email or password"
}
}
Login attempts are rate-limited:
- 100 attempts per IP per day
- 10 consecutive failed attempts per username/IP combination blocks access for 1 hour
Logout
POST /api/user/logout
Log out of the current account session.
Authentication: Required
curl -X POST https://opentogethertube.com/api/user/logout \
-H "Authorization: Bearer YOUR_TOKEN"
Response
After logout, the token remains valid but is no longer associated with the logged-in user account. A new guest username is assigned.
Get Owned Rooms
GET /api/user/owned-rooms
Get all permanent rooms owned by the currently logged-in user.
Authentication: Required (must be logged in)
curl https://opentogethertube.com/api/user/owned-rooms \
-H "Authorization: Bearer YOUR_TOKEN"
Response
{
"success": true,
"data": [
{
"name": "my-room",
"title": "My Personal Room",
"description": "A room I created",
"isTemporary": false,
"visibility": "public",
"queueMode": "manual",
"currentSource": null,
"users": 0
}
]
}
Error Response (Not Logged In)
{
"success": false,
"error": {
"name": "Unauthorized",
"message": "Not logged in."
}
}
Account Recovery
POST /api/user/recover/start
Initiate account recovery process.
Request Body
Email address associated with the account
curl -X POST https://opentogethertube.com/api/user/recover/start \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]"}'
Response
A recovery email is sent to the address if an account exists.
POST /api/user/recover/verify
Complete account recovery with verification key.
Request Body
Verification key from recovery email
curl -X POST https://opentogethertube.com/api/user/recover/verify \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"verifyKey": "abc123...",
"password": "newpassword123"
}'
Response
OAuth (Discord)
GET /api/user/auth/discord
Initiate Discord OAuth flow for linking Discord account.
curl https://opentogethertube.com/api/user/auth/discord
Redirects to Discord authorization page.
GET /api/user/auth/discord/callback
Discord OAuth callback. Handled automatically by the server.
Common Error Responses
Rate Limited
{
"success": false,
"error": {
"name": "RateLimitError",
"message": "Too many requests. Try again later."
}
}
Validation Error
{
"success": false,
"error": {
"name": "ValidationError",
"message": "Invalid input",
"fields": ["email", "password"]
}
}
Length Out of Range
{
"success": false,
"error": {
"name": "LengthOutOfRangeException",
"message": "Username length must be less than or equal to 20"
}
}