Authentication API¶
All auth endpoints are prefixed with /api/auth.
Schemas¶
UserCreate¶
Request body for user registration.
Field |
Type |
Required |
Notes |
|---|---|---|---|
|
string |
Yes |
Valid email address |
|
string |
Yes |
Minimum 8 characters |
|
string |
Yes |
2 – 100 characters |
|
ProficiencyLevel |
No |
Default: |
|
GoalEnum[] |
No |
Array; default |
|
FocusAreaEnum[] |
No |
Array; default |
UserLogin¶
Request body for email/password login.
Field |
Type |
Required |
Notes |
|---|---|---|---|
|
string |
Yes |
|
|
string |
Yes |
TokenResponse¶
Returned by login, signup, and OAuth endpoints.
Field |
Type |
Notes |
|---|---|---|
|
string |
JWT; expires in 24 h |
|
string |
Always |
|
integer |
Seconds until expiry (86400) |
|
string |
Used with |
|
UserResponse |
Current user object |
UserResponse¶
Field |
Type |
Notes |
|---|---|---|
|
string (UUID) |
|
|
string |
|
|
string |
|
|
string | null |
|
|
string |
|
|
ProficiencyLevel | null |
|
|
GoalEnum[] |
|
|
FocusAreaEnum[] |
|
|
string (ISO 8601) |
OnboardingUpdate¶
Request body for updating learning preferences.
Field |
Type |
Required |
Notes |
|---|---|---|---|
|
ProficiencyLevel |
No |
|
|
GoalEnum[] |
No |
|
|
FocusAreaEnum[] |
No |
Enumerations¶
ProficiencyLevel
Beginner | Elementary | Intermediate | Advanced | Fluent
GoalEnum
Travel & Tourism | Business & Work | Education |
Daily Conversation | Culture & Entertainment | Family & Friends
FocusAreaEnum
Speaking | Listening | Reading | Writing |
Vocabulary | Grammar
Endpoints¶
POST /api/auth/signup¶
Register a new user with email and password.
Request
POST /api/auth/signup HTTP/1.1
Content-Type: application/json
{
"email": "jane@example.com",
"password": "securepass",
"full_name": "Jane Doe",
"proficiency_level": "Intermediate",
"goals": ["Education", "Daily Conversation"],
"focus_areas": ["Reading", "Writing"]
}
Response 201 Created
{
"access_token": "eyJhbGci...",
"token_type": "bearer",
"expires_in": 86400,
"refresh_token": "...",
"user": { ... }
}
Error responses
Status |
Detail |
|---|---|
|
|
|
Pydantic validation failure (e.g. password too short) |
POST /api/auth/login¶
Authenticate with email and password.
Request
POST /api/auth/login HTTP/1.1
Content-Type: application/json
{
"email": "jane@example.com",
"password": "securepass"
}
Response 200 OK — TokenResponse
Error responses
Status |
Detail |
|---|---|
|
|
|
Supabase session rejected |
POST /api/auth/google/url¶
Obtain the Google OAuth authorisation URL to redirect the browser.
Request
POST /api/auth/google/url HTTP/1.1
Content-Type: application/json
{
"redirect_uri": "https://yourdomain.com/auth/callback"
}
Response 200 OK
{
"url": "https://accounts.google.com/o/oauth2/v2/auth?..."
}
POST /api/auth/google/callback¶
Exchange the authorisation code returned by Google for a session.
Request
POST /api/auth/google/callback HTTP/1.1
Content-Type: application/json
{
"code": "<oauth_code>"
}
Response 200 OK — TokenResponse
POST /api/auth/google/token¶
Sign in using a Google ID token obtained by the native mobile SDK
(google_sign_in). Use this for Android/iOS clients.
Request
POST /api/auth/google/token HTTP/1.1
Content-Type: application/json
{
"id_token": "<google_id_token>"
}
Response 200 OK — TokenResponse
POST /api/auth/refresh¶
Exchange a refresh token for a new access token.
Request
POST /api/auth/refresh HTTP/1.1
Content-Type: application/json
{
"refresh_token": "<refresh_token>"
}
Response 200 OK — TokenResponse
Error responses
Status |
Detail |
|---|---|
|
Token expired or invalid |
POST /api/auth/logout¶
Invalidate the current session.
Request
POST /api/auth/logout HTTP/1.1
Authorization: Bearer <access_token>
Response 200 OK
{
"message": "Logged out successfully",
"success": true
}
GET /api/auth/me¶
Return the currently authenticated user’s profile.
Request
GET /api/auth/me HTTP/1.1
Authorization: Bearer <access_token>
Response 200 OK — UserResponse
Error responses
Status |
Detail |
|---|---|
|
Missing or invalid token |
PUT /api/auth/onboarding¶
Update learning preferences collected during onboarding. Requires authentication.
Request
PUT /api/auth/onboarding HTTP/1.1
Authorization: Bearer <access_token>
Content-Type: application/json
{
"proficiency_level": "Intermediate",
"goals": ["Business & Work", "Education"],
"focus_areas": ["Speaking", "Grammar"]
}
Response 200 OK
{
"message": "Onboarding updated successfully",
"success": true
}
Error responses
Status |
Detail |
|---|---|
|
Missing or invalid token |
|
Profile update failed |
Summary Table¶
Method |
Path |
Auth required |
Returns |
|---|---|---|---|
|
|
No |
|
|
|
No |
|
|
|
No |
|
|
|
No |
|
|
|
No |
|
|
|
No |
|
|
|
Yes |
|
|
|
Yes |
|
|
|
Yes |
|