The sync endpoint triggers an immediate Codeforces data refresh for a single student identified by their Codeforces handle. Unlike the scheduled background sync, this endpoint bypasses the cache entirely to guarantee the student’s profile, contest history, and submission data are up to date at the moment of the request.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/aakash811/Student-Progress-Tracker/llms.txt
Use this file to discover all available pages before exploring further.
Request
Path parameters
The student’s Codeforces username. Must match the
codeforcesHandle field stored on the student record in MongoDB.How it works
When the endpoint is called, the following steps execute in order:-
Cache invalidation — All three Redis keys for the given handle are deleted in parallel before any data is fetched:
cf:info:<handle>— cached user info (rating, rank, maxRating)cf:contest:<handle>— cached contest historycf:submissions:<handle>— cached submission list
-
Parallel data fetch — After invalidation, three Codeforces API calls are made concurrently:
user.info— retrieves current rating, rank, and max ratinguser.rating— retrieves the full contest rating historyuser.status— retrieves up to 10,000 most recent submissions
-
lastActiveAt computation — The most recent submission with a verdict of
OKis identified and its timestamp is used to setlastActiveAton the student record. -
MongoDB update — The student document is updated with
currRating,rank,maxRating,contestData,submissions,lastActiveAt, andlastSyncedAt(set to the current server time). The query matches oncodeforcesHandle.
Example request
Response
200 OK
Returns the updated student document as stored in MongoDB after the sync.Error responses
| Status | Cause |
|---|---|
404 | No student with the given Codeforces handle exists in the database |
500 | Sync failed — Codeforces API unreachable, network timeout, or unexpected server error |
This endpoint is invoked by the per-row sync button in the student list table and by the Sync button on the individual student detail page. It is intended for on-demand refreshes; routine data updates are handled by the background sync scheduler.