API Documentation

REST API endpoints for oneup arena puzzle competition tracker

API Overview

Base URL: https://oneuparena.app

Authentication: Session-based using NextAuth.js. Most endpoints require an authenticated session.

Content Type: application/json for all POST requests

Response Format: JSON with status codes (200, 400, 401, 404, 500)

Authentication

POST/api/auth/register
Register a new user account with email and password
Auth:None
Parameters:email, password, name
POST/api/auth/[...nextauth]
NextAuth.js authentication endpoints for signin, signout, and session management
Auth:None
Parameters:Varies by NextAuth provider
POST/api/auth/forgot-password
Request password reset token via email
Auth:None
Parameters:email
POST/api/auth/reset-password
Reset password using token from email
Auth:None
Parameters:token, newPassword

Rooms

GET/api/room?roomCode=CODE
Get room details including members and current standings
Auth:Session (optional)
Parameters:roomCode (query)
POST/api/room
Create a new competition room
Auth:Session required
Parameters:roomName, roomType, isPublic, password (optional)
DELETE/api/room?roomCode=CODE
Delete a room (admin only)
Auth:Session required
Parameters:roomCode (query)
GET/api/rooms
List public rooms available to join
Auth:None
Parameters:None
POST/api/room/[roomCode]/member
Join a room or leave a room
Auth:Session required
Parameters:roomCode (path), action (join/leave), password (optional)
POST/api/room/[roomCode]/member/admin
Assign or remove admin privileges (admin only)
Auth:Session required
Parameters:roomCode (path), userId, action (assign/remove)
POST/api/room/[roomCode]/base-score
Set base score for historical data import
Auth:Session required
Parameters:roomCode (path), baseScore (number)
GET/api/room/[roomCode]/analysis
Get detailed room analysis and statistics
Auth:Session required
Parameters:roomCode (path)

Puzzles

POST/api/puzzle/time
Submit puzzle completion time for a room
Auth:Session required
Parameters:roomCode, puzzleNumber, time (seconds), size (e.g., '6x6')
POST/api/cron/daily-puzzle
Generate daily puzzles for all rooms (cron job)
Auth:Cron secret required
Parameters:secret (authorization)

User & Statistics

GET/api/user/profile
Get current user profile information
Auth:Session required
Parameters:None
GET/api/user/stats
Get current user's competition statistics
Auth:Session required
Parameters:None
GET/api/user-rooms
Get all rooms the current user is a member of
Auth:Session required
Parameters:None
GET/api/stats
Get room statistics and leaderboard data
Auth:Session optional
Parameters:roomCode (query)

Data Models

Room Types

HEAD_TO_HEAD | SMALL | MEDIUM | LARGE | UNLIMITED

Puzzle Sizes

6x6 | 7x7 | 8x8 | 9x9

Score Calculation

score = baseScore + wins - penalties

Usage Guidelines

Need Help?

Check out our guides for practical examples and use cases