API Reference¶
The LinguaAI API is a RESTful HTTP API built with FastAPI. All endpoints are
served under the /api prefix.
Base URL¶
http://<host>:8000
During local development the host is typically 127.0.0.1 or the LAN IP
configured in frontend/lib/services/api_config.dart.
Interactive Documentation¶
FastAPI automatically generates interactive documentation:
Swagger UI —
http://<host>:8000/docsReDoc —
http://<host>:8000/redocOpenAPI JSON —
http://<host>:8000/openapi.json
Authentication¶
Protected endpoints require a JWT access token sent as a Bearer token in the
Authorization header:
GET /api/auth/me HTTP/1.1
Authorization: Bearer <access_token>
Tokens are obtained from the login, signup, or Google OAuth endpoints and
expire after 24 hours. Use POST /api/auth/refresh to obtain a new
token before expiry.
Response Format¶
All responses use application/json.
Successful response example:
{
"access_token": "eyJhbGci...",
"token_type": "bearer",
"expires_in": 86400,
"refresh_token": "...",
"user": {
"id": "uuid",
"email": "user@example.com",
"full_name": "Jane Doe",
"avatar_url": null,
"provider": "email",
"proficiency_level": "Intermediate",
"goals": ["Education"],
"focus_areas": ["Reading", "Writing"],
"created_at": "2026-03-06T12:00:00Z"
}
}
Error response example:
{
"detail": "Invalid email or password"
}
HTTP Status Codes¶
Code |
Meaning |
|---|---|
|
Request succeeded |
|
Resource created (e.g. new user on signup) |
|
Bad request — invalid input or business logic error |
|
Unauthorised — missing, expired, or invalid token |
|
Validation error — request body failed Pydantic validation |
|
Internal server error |
General Endpoints¶
Method |
Path |
Description |
|---|---|---|
|
|
Returns the root HTML welcome page |
|
|
Database connectivity health check |