Complete API documentation with request/response examples for the Luminary Backend.
POST /api/users/
Request Body:
{
"display_name": "John Doe"
}Response (201):
{
"id": 1,
"display_name": "John Doe",
"current_attempt_id": null,
"current_attempt": null,
"constellation_attempts": [],
"sessions": [],
"posts": []
}GET /api/users/
Response (200):
{
"users": [
{
"id": 1,
"display_name": "John Doe",
"current_attempt_id": 2,
"current_attempt": {
"id": 2,
"user_id": 1,
"constellation_id": 1,
"stars_completed": 3
},
"constellation_attempts": [
{
"id": 2,
"user_id": 1,
"constellation_id": 1,
"stars_completed": 3
}
],
"sessions": [
{
"id": 1,
"user_id": 1,
"constellation_attempt_id": 2,
"is_completed": true,
"minutes": 45
}
],
"posts": [
{
"id": 1,
"post_type": "completion",
"message": "Just completed Cassiopeia! Amazing learning experience 🌟",
"study_duration": 45,
"created_at": "2025-12-01T10:30:00"
}
]
}
]
}GET /api/users/1/
Response (200):
{
"id": 1,
"display_name": "John Doe",
"current_attempt_id": 2,
"current_attempt": {
"id": 2,
"user_id": 1,
"constellation_id": 1,
"stars_completed": 3
},
"constellation_attempts": [
{
"id": 2,
"user_id": 1,
"constellation_id": 1,
"stars_completed": 3
}
],
"sessions": [
{
"id": 1,
"user_id": 1,
"constellation_attempt_id": 2,
"is_completed": true,
"minutes": 45
}
],
"posts": []
}GET /api/users/1/total_minutes/
Response (200):
{
"user_id": 1,
"display_name": "John Doe",
"total_minutes": 180
}GET /api/users/1/completed_constellations/
Response (200):
{
"user_id": 1,
"display_name": "John Doe",
"completed_constellations": [
{
"id": 1,
"name": "Triangulum",
"weight": 3,
"user_attempts": [
{
"id": 1,
"user_id": 1,
"constellation_id": 1,
"stars_completed": 3
}
],
"posts": [
{
"id": 1,
"post_type": "completion",
"message": "Just completed Triangulum! Great start! 🌟",
"study_duration": 30,
"created_at": "2025-12-02T10:15:00"
}
]
},
{
"id": 2,
"name": "Delphinus",
"weight": 5,
"user_attempts": [
{
"id": 2,
"user_id": 1,
"constellation_id": 2,
"stars_completed": 5
}
],
"posts": [
{
"id": 3,
"post_type": "completion",
"message": "Delphinus conquered! Moving up in difficulty! 🐬",
"study_duration": 75,
"created_at": "2025-12-02T14:30:00"
}
]
}
],
"num_completed": 2
}GET /api/users/1/current-attempt/
{
"id": 3,
"user_id": 1,
"constellation_id": 2,
"stars_completed": 0,
"user": {
"id": 1,
"display_name": "kaylee"
},
"constellation": {
"id": 2,
"name": "Delphinus",
"weight": 5
},
"sessions": []
}POST /api/constellations/
Request Body:
{
"name": "Cassiopeia",
"weight": 5
}Response (201):
{
"id": 1,
"name": "Cassiopeia",
"weight": 5,
"user_attempts": [],
"posts": []
}GET /api/constellations/
Response (200):
{
"constellations": [
{
"id": 1,
"name": "Cassiopeia",
"weight": 5,
"user_attempts": [
{
"id": 2,
"user_id": 1,
"constellation_id": 1,
"stars_completed": 3
}
],
"posts": [
{
"id": 1,
"post_type": "completion",
"message": "Just completed Cassiopeia! Amazing learning experience 🌟",
"study_duration": 45,
"created_at": "2025-12-01T10:30:00"
}
]
}
]
}GET /api/constellations/1/
Response (200):
{
"id": 1,
"name": "Cassiopeia",
"weight": 5,
"user_attempts": [
{
"id": 2,
"user_id": 1,
"constellation_id": 1,
"stars_completed": 3
}
],
"posts": []
}PUT /api/constellations/1/
Request Body:
{
"name": "Big Dipper",
"weight": 7
}Response (200):
{
"id": 1,
"name": "Big Dipper",
"weight": 7,
"user_attempts": [],
"posts": []
}DELETE /api/constellations/1/
Response (200):
{
"message": "Constellation deleted successfully!"
}POST /api/users/1/constellation_attempts/
Request Body:
{
"constellation_id": 1
}Response (201):
{
"id": 2,
"user_id": 1,
"constellation_id": 1,
"stars_completed": 0,
"user": {
"id": 1,
"display_name": "John Doe"
},
"constellation": {
"id": 1,
"name": "Cassiopeia",
"weight": 5
},
"sessions": []
}GET /api/constellation_attempts/
Response (200):
{
"constellation_attempts": [
{
"id": 2,
"user_id": 1,
"constellation_id": 1,
"stars_completed": 3,
"user": {
"id": 1,
"display_name": "John Doe"
},
"constellation": {
"id": 1,
"name": "Cassiopeia",
"weight": 5
},
"sessions": [
{
"id": 1,
"user_id": 1,
"constellation_attempt_id": 2,
"is_completed": true,
"minutes": 45
}
]
}
]
}GET /api/constellation_attempts/2/
Response (200):
{
"id": 2,
"user_id": 1,
"constellation_id": 1,
"stars_completed": 3,
"user": {
"id": 1,
"display_name": "John Doe"
},
"constellation": {
"id": 1,
"name": "Cassiopeia",
"weight": 5
},
"sessions": [
{
"id": 1,
"user_id": 1,
"constellation_attempt_id": 2,
"is_completed": true,
"minutes": 45
}
]
}GET /api/users/1/constellation_attempts/
Response (200):
{
"constellation_attempts": [
{
"id": 2,
"user_id": 1,
"constellation_id": 1,
"stars_completed": 3,
"user": {
"id": 1,
"display_name": "John Doe"
},
"constellation": {
"id": 1,
"name": "Cassiopeia",
"weight": 5
},
"sessions": []
}
]
}PUT /api/constellation_attempts/2/
Response (200):
{
"id": 2,
"user_id": 1,
"constellation_id": 1,
"stars_completed": 4,
"user": {
"id": 1,
"display_name": "John Doe"
},
"constellation": {
"id": 1,
"name": "Cassiopeia",
"weight": 5
},
"sessions": []
}PUT /api/constellation_attempts/2/complete
Response (200):
{
"attempt": {
"id": 2,
"user_id": 1,
"constellation_id": 1,
"stars_completed": 5,
"user": {
"id": 1,
"display_name": "John Doe"
},
"constellation": {
"id": 1,
"name": "Cassiopeia",
"weight": 5
},
"sessions": []
},
"user_updated": true,
"message": "Constellation completed successfully!"
}DELETE /api/constellation_attempts/2/
Response (200):
{
"message": "Constellation Attempt deleted successfully!"
}POST /api/sessions/
Request Body:
{
"user_id": 1,
"constellation_attempt_id": 2,
"minutes": 45
}Response (201):
{
"id": 1,
"user_id": 1,
"constellation_attempt_id": 2,
"is_completed": false,
"minutes": 45,
"user": {
"id": 1,
"display_name": "John Doe"
},
"constellation_attempt": {
"id": 2,
"user_id": 1,
"constellation_id": 1,
"stars_completed": 3
}
}GET /api/sessions/
Response (200):
{
"sessions": [
{
"id": 1,
"user_id": 1,
"constellation_attempt_id": 2,
"is_completed": true,
"minutes": 45,
"user": {
"id": 1,
"display_name": "John Doe"
},
"constellation_attempt": {
"id": 2,
"user_id": 1,
"constellation_id": 1,
"stars_completed": 3
}
}
]
}GET /api/sessions/1/
Response (200):
{
"id": 1,
"user_id": 1,
"constellation_attempt_id": 2,
"is_completed": true,
"minutes": 45,
"user": {
"id": 1,
"display_name": "John Doe"
},
"constellation_attempt": {
"id": 2,
"user_id": 1,
"constellation_id": 1,
"stars_completed": 3
}
}GET /api/constellation_attempts/2/sessions/
Response (200):
{
"sessions": [
{
"id": 1,
"user_id": 1,
"constellation_attempt_id": 2,
"is_completed": true,
"minutes": 45,
"user": {
"id": 1,
"display_name": "John Doe"
},
"constellation_attempt": {
"id": 2,
"user_id": 1,
"constellation_id": 1,
"stars_completed": 3
}
}
]
}PUT /api/sessions/1/complete/
Response (200):
{
"id": 1,
"user_id": 1,
"constellation_attempt_id": 2,
"is_completed": true,
"minutes": 45,
"user": {
"id": 1,
"display_name": "John Doe"
},
"constellation_attempt": {
"id": 2,
"user_id": 1,
"constellation_id": 1,
"stars_completed": 3
}
}PUT /api/sessions/1/cancel/
Response (200):
{
"id": 1,
"user_id": 1,
"constellation_attempt_id": 2,
"is_completed": false,
"minutes": 45,
"user": {
"id": 1,
"display_name": "John Doe"
},
"constellation_attempt": {
"id": 2,
"user_id": 1,
"constellation_id": 1,
"stars_completed": 3
}
}POST /api/posts/
Request Body:
{
"user_id": 1,
"constellation_id": 1,
"post_type": "completion",
"message": "Just completed Cassiopeia! Amazing learning experience 🌟",
"study_duration": 45
}Note:
post_typemust be either:"completion"- when a constellation is fully completed"progress"- when a session/star is completed
message(optional): Text message for the poststudy_duration(optional): Study time in minutes
Response (201):
{
"id": 1,
"user_id": 1,
"constellation_id": 1,
"post_type": "completion",
"message": "Just completed Cassiopeia! Amazing learning experience 🌟",
"study_duration": 45,
"created_at": "2025-12-01T10:30:00",
"user": {
"id": 1,
"display_name": "John Doe"
},
"constellation": {
"id": 1,
"name": "Cassiopeia",
"weight": 5
}
}GET /api/posts/
Response (200):
{
"posts": [
{
"id": 1,
"user_id": 1,
"constellation_id": 1,
"post_type": "completion",
"message": "Just completed Cassiopeia! Amazing learning experience 🌟",
"study_duration": 45,
"created_at": "2025-12-01T10:30:00",
"user": {
"id": 1,
"display_name": "John Doe"
},
"constellation": {
"id": 1,
"name": "Cassiopeia",
"weight": 5
}
}
]
}GET /api/posts/1/
Response (200):
{
"id": 1,
"user_id": 1,
"constellation_id": 1,
"post_type": "completion",
"message": "Just completed Cassiopeia! Amazing learning experience 🌟",
"study_duration": 45,
"created_at": "2025-12-01T10:30:00",
"user": {
"id": 1,
"display_name": "John Doe"
},
"constellation": {
"id": 1,
"name": "Cassiopeia",
"weight": 5
}
}GET /users/1/posts/
Response (200):
{
"posts": [
{
"id": 1,
"user_id": 1,
"constellation_id": 1,
"post_type": "completion",
"message": "Just completed Cassiopeia! Amazing learning experience 🌟",
"study_duration": 45,
"created_at": "2025-12-01T10:30:00",
"user": {
"id": 1,
"display_name": "John Doe"
},
"constellation": {
"id": 1,
"name": "Cassiopeia",
"weight": 5
}
}
]
}GET /constellations/1/posts/
Response (200):
{
"posts": [
{
"id": 1,
"user_id": 1,
"constellation_id": 1,
"post_type": "completion",
"message": "Just completed Cassiopeia! Amazing learning experience 🌟",
"study_duration": 45,
"created_at": "2025-12-01T10:30:00",
"user": {
"id": 1,
"display_name": "John Doe"
},
"constellation": {
"id": 1,
"name": "Cassiopeia",
"weight": 5
}
}
]
}DELETE /api/posts/1/
Response (200):
{
"message": "Post deleted successfully!"
}GET /api/feed/
Response (200):
{
"posts": [
{
"id": 2,
"user_id": 1,
"constellation_id": 1,
"post_type": "progress",
"message": "Made great progress on Cassiopeia today! 3 stars completed ⭐",
"study_duration": 30,
"created_at": "2025-12-01T14:22:00",
"user": {
"id": 1,
"display_name": "John Doe"
},
"constellation": {
"id": 1,
"name": "Cassiopeia",
"weight": 5
}
},
{
"id": 1,
"user_id": 1,
"constellation_id": 1,
"post_type": "completion",
"message": "Just completed Cassiopeia! Amazing learning experience 🌟",
"study_duration": 45,
"created_at": "2025-12-01T10:30:00",
"user": {
"id": 1,
"display_name": "John Doe"
},
"constellation": {
"id": 1,
"name": "Cassiopeia",
"weight": 5
}
}
]
}All error responses follow this format:
404 Not Found:
{
"error": "User not found!"
}400 Bad Request:
{
"error": "Missing required fields"
}- All timestamps are in ISO 8601 format
- All IDs are integers starting from 1
- Minutes are tracked as integers
- Automatic Minute Calculation: User
total_minutesare automatically updated when sessions change (completed, modified, or deleted) - Post types:
"completion"- when a constellation is fully completed"progress"- when a session/star is completed
- Post fields:
message(optional): Custom text message for the poststudy_duration(optional): Study time in minutes for this session
- Sessions default to
is_completed: falsewhen created - Constellation attempts start with
stars_completed: 0 - The
total_minutesfield in user responses reflects real-time calculations from completed sessions