Create Homework Submission
This endpoint allows students to upload their homework files for review.
Path Parameters
The UUID of the homework being submitted
Request Body
The ID of the student submitting the homework
The files containing the student’s homework solution (max 10 files)
Your API authentication key
Response
The unique identifier for the submission
The ID of the homework being submitted
The ID of the chat session created for this submission review
The current status of the submission. Possible values: ‘submitted’ (initial state), ‘reviewed’ (AI has reviewed), ‘approved’ (meets requirements), or ‘needs_revision’ (requires changes).
URL for the chat interface
Timestamp when the submission was created
AI analysis of the submission
Grade assigned to the submission. Possible values: ‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’.
{
"id" : "sub_123456789" ,
"homeworkId" : "123e4567-e89b-12d3-a456-426614174000" ,
"chatId" : "chat_987654321" ,
"status" : "submitted" ,
"chatIframeUrl" : "https://chat.lexiconlabs.ai/?chat_id=chat_987654321" ,
"createdAt" : "2023-07-15T14:32:17Z" ,
"analysis" : "" ,
"grade" : ""
}
Error Responses
Invalid input parameters
Invalid or missing API key
Homework not found
500: Internal Server Error
Processing error
Example Usage
cURL
curl -X POST "https://api.lexiconlabs.ai/v1/homeworks/123e4567-e89b-12d3-a456-426614174000/submissions" \
-H "Content-Type: multipart/form-data" \
-H "x-tenant-api-secret: YOUR_API_KEY" \
-F "studentId=student123" \
-F "[email protected] " \
-F "[email protected] "
JavaScript
const formData = new FormData ();
formData . append ( 'studentId' , 'student123' );
formData . append ( 'files' , fileInput . files [ 0 ]);
formData . append ( 'files' , fileInput . files [ 1 ]);
// Replace with the actual homework UUID
const homeworkId = '123e4567-e89b-12d3-a456-426614174000' ;
fetch ( `https://api.lexiconlabs.ai/v1/homeworks/ ${ homeworkId } /submissions` , {
method: 'POST' ,
headers: {
'x-tenant-api-secret' : 'YOUR_API_KEY'
},
body: formData
})
. then ( response => response . json ())
. then ( data => {
const chatId = data . chatId ;
// Redirect to chat interface or embed iframe
window . location . href = `https://chat.lexiconlabs.ai/?chat_id= ${ chatId } ` ;
})
. catch ( error => console . error ( 'Error:' , error ));