POST /api/v1/auth/login
Authenticate a user and receive a JWT token for accessing protected endpoints.Request
Registered username
- Min length: 4 characters
- Max length: 50 characters
User password
- Min length: 6 characters
- Max length: 100 characters
Response
Success message
Unique identifier for the authenticated user
Authenticated username
JWT token valid for 24 hours
Code Examples
Response Example
200 OK
400 Bad Request
401 Unauthorized
The login endpoint also sets an HttpOnly cookie named
jwt-token with the JWT value. Web browsers will automatically include this cookie in subsequent requests.POST /api/v1/auth/register
Register a new surgeon account in the system.Request
Desired username
- Min length: 4 characters
- Max length: 50 characters
- Must be unique
User password
- Min length: 6 characters
- Max length: 100 characters
- Will be hashed with BCrypt
Response
Success or error message
Error description (only present on failure)
Code Examples
Response Examples
200 OK
400 Bad Request - Existing User
400 Bad Request - Validation Error
GET /api/v1/auth/me
Retrieve information about the currently authenticated user.Authentication
This endpoint requires a valid JWT token in the Authorization header or jwt-token cookie.
Request
No request body required. Include JWT token:Response
User’s unique identifier
User’s username
User’s role (
ROLE_SURGEON or ROLE_AI)Code Examples
Response Examples
200 OK
401 Unauthorized
Default Credentials
The application initializes with default accounts for testing:| Username | Password | Role |
|---|---|---|
surgeon_master | justina2024 | ROLE_SURGEON |
ia_justina | ia_secret_2024 | ROLE_AI |
Error Handling
All authentication endpoints return consistent error responses with:timestamp- ISO 8601 formatted error timestatus- HTTP status codeerror- HTTP status reason phrasemessage- Human-readable error descriptionpath- Request path that caused the error
Common Validation Errors
- Username too short/long
- Password too short/long
- Missing required fields
- Username already exists (registration)
- Invalid credentials (login)
Next Steps
JWT Authentication
Learn about JWT token structure and security
Surgery Endpoints
Access surgical trajectory and analysis data