Yoruba Learning App — API Documentation
Base URL
localhost
All endpoints are JSON.
For protected routes, include Authorization: Bearer in headers.
1️⃣ Auth Endpoints
Register
URL: /auth/register
Method: POST
Body:
{
"name": "Abdul",
"email": "abdul@example.com",
"password": "password123"
}
Response (200):
{
"_id": "64a2b123abc123...",
"name": "Abdul",
"email": "abdul@example.com",
"level": "Beginner",
"streak": 0,
"wordsLearned": 0,
"lessonsCompleted": 0,
"createdAt": "2025-12-10T10:00:00.000Z"
}
Login
URL: /auth/login
Method: POST
Body:
{
"email": "abdul@example.com",
"password": "password123"
}
Response (200):
{
"user": {
"_id": "64a2b123abc123...",
"name": "Abdul",
"email": "abdul@example.com",
"level": "Beginner",
"streak": 0,
"wordsLearned": 0,
"lessonsCompleted": 0
},
"token": " "
}
2️⃣ Lessons Endpoints
Get All Lessons
URL: /lessons
Method: GET
Query Params: level=Beginner|Intermediate|Advanced (optional)
Headers: Authorization: Bearer
Response (200):
[
{
"_id": "64a2c456def456...",
"title": "Greetings",
"level": "Beginner",
"yorubaWord": "Ẹ káàárọ̀",
"englishTranslation": "Good morning",
"pronunciation": "Eh kaa-roh",
"examples": ["Ẹ káàárọ̀, Bawo ni?", "Ẹ káàárọ̀, Ṣé dáadáa ni?"],
"audioUrl": "
example.com"
}
]
Get Single Lesson
URL: /lessons/:id
Method: GET
Headers: Authorization: Bearer
Response (200):
{
"_id": "64a2c456def456...",
"title": "Greetings",
"level": "Beginner",
"yorubaWord": "Ẹ káàárọ̀",
"englishTranslation": "Good morning",
"pronunciation": "Eh kaa-roh",
"examples": ["Ẹ káàárọ̀, Bawo ni?", "Ẹ káàárọ̀, Ṣé dáadáa ni?"],
"audioUrl": "
example.com"
}
3️⃣ Flashcards Endpoints
Get Flashcards
URL: /flashcards
Method: GET
Headers: Authorization: Bearer
Response (200):
[
{
"_id": "64a2f123abc789...",
"yoruba": "Ẹ ṣé",
"english": "Thank you",
"pronunciation": "Eh sheh",
"audioUrl": "
example.com"
}
]
4️⃣ AI Tutor Endp …