curl --request POST \
--url https://your-api-host/api/teacher/assignment \
--header 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' \
--header 'Content-Type: application/json' \
--data '{
"classId": 301,
"title": "Chapter 5 Homework",
"dueDate": "2026-04-15T23:59:00.000Z"
}'
{
"_id": "64f2c3d4e5f6a7b8c9d0e1f2",
"classId": 301,
"title": "Chapter 5 Homework",
"dueDate": "2026-04-15T23:59:00.000Z",
"teacherId": "64f1a2b3c4d5e6f7a8b9c0d9",
"__v": 0
}
Create a new assignment for a class. Requires a valid teacher JWT and TEACHER role.
curl --request POST \
--url https://your-api-host/api/teacher/assignment \
--header 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' \
--header 'Content-Type: application/json' \
--data '{
"classId": 301,
"title": "Chapter 5 Homework",
"dueDate": "2026-04-15T23:59:00.000Z"
}'
{
"_id": "64f2c3d4e5f6a7b8c9d0e1f2",
"classId": 301,
"title": "Chapter 5 Homework",
"dueDate": "2026-04-15T23:59:00.000Z",
"teacherId": "64f1a2b3c4d5e6f7a8b9c0d9",
"__v": 0
}
Creates a new assignment record and associates it with the authenticated teacher. TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/praveenarya123/sps-backend/llms.txt
Use this file to discover all available pages before exploring further.
teacherId is extracted automatically from the JWT — it cannot be set manually in the request body.
TEACHER role. Requests from authenticated users with any other role will receive a 403 Access denied response. Ensure your JWT was issued to an account with the TEACHER role before calling this endpoint.Authorization header.
Authorization: <your-jwt-token>
teacherId is automatically set from your JWT payload (req.user.id). Do not include teacherId in the request body — it will be ignored."Chapter 5 Homework" or "Midterm Essay"."2026-04-15T23:59:00.000Z".| Status | Message | Cause |
|---|---|---|
401 | Unauthorized | No Authorization header was provided. |
403 | Access denied | A valid token was provided but the user does not have the TEACHER role. |
curl --request POST \
--url https://your-api-host/api/teacher/assignment \
--header 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' \
--header 'Content-Type: application/json' \
--data '{
"classId": 301,
"title": "Chapter 5 Homework",
"dueDate": "2026-04-15T23:59:00.000Z"
}'
{
"_id": "64f2c3d4e5f6a7b8c9d0e1f2",
"classId": 301,
"title": "Chapter 5 Homework",
"dueDate": "2026-04-15T23:59:00.000Z",
"teacherId": "64f1a2b3c4d5e6f7a8b9c0d9",
"__v": 0
}