Submit public contest attempt (v1)
Method & Path
POST /api/v1/public/contest/:token/attempts/:attemptId/submit
Optional slug-scoped path with same suffix.
Description
Scores answers, records duration in seconds (capped by time limit), rejects if contest is not open or time window exceeded (with small grace). Returns provisional rank among submissions so far.
Authentication
None.
Request Body
{
"answers": [
{ "questionId": "...", "optionId": "..." }
]
}
Response 200 OK
{
"scoreCorrect": 8,
"totalQuestions": 10,
"durationSeconds": 95,
"rank": 3
}
Common Errors
- 404 Not Found: Token or attempt
- 409 Conflict: Already submitted or contest closed
- 422 Unprocessable: Missing answers, invalid option, or time exceeded
- 500 Internal Server Error