Endpoint
Request
This endpoint does not require any parameters.cURL
Response
Whether the refresh endpoint is currently in cooldown
Number of minutes remaining in the cooldown period. Returns 0 if not in cooldown.
Response Examples
Cooldown Active
Cooldown Expired
No Previous Refresh
If no refresh has ever been performed (fresh app state):Behavior
Cooldown Calculation
The endpoint calculates cooldown status by:- Retrieving the last refresh timestamp from Redis (
classrooms:last_refreshkey) - Comparing it against the current time in America/New_York timezone
- Checking if less than 30 minutes have elapsed
- Calculating the remaining time if in cooldown
Return Values
| Condition | in_cooldown | remaining_minutes |
|---|---|---|
| Less than 30 minutes since last refresh | true | Time left (e.g., 15.3) |
| 30+ minutes since last refresh | false | 0 |
| No previous refresh exists | false | 0 |
| Error reading timestamp | false | 0 |
Error Handling
This endpoint is designed to be resilient and never returns an error response. If there’s an issue reading the cooldown status from Redis:- Returns
in_cooldown: falseandremaining_minutes: 0 - Logs the error server-side
- Allows the caller to proceed (fail-open behavior)
Error Fallback
The fail-open behavior ensures the UI remains functional even if Redis is temporarily unavailable. The actual
/api/refresh endpoint will still enforce the cooldown if possible.Example Usage
Check Before Refresh
JavaScript
Display Cooldown Timer
React Example
Python
cURL
Use Cases
- UI Button States: Enable/disable refresh buttons based on cooldown status
- Countdown Timers: Display remaining cooldown time to users
- Automated Scripts: Wait for cooldown to expire before refreshing
- Error Prevention: Avoid 429 errors by checking cooldown first
Best Practices
For the best user experience, check this endpoint before allowing users to click a refresh button, and display the remaining time if in cooldown.
Notes
- The
remaining_minutesvalue is a floating-point number with decimal precision - Round or format the value appropriately for display (e.g., “Wait 15 minutes”)
- The cooldown is shared globally - one user’s refresh affects all users
- The cooldown is tied to the last successful refresh, not failed attempts