Wait
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
index.ts
https://romj--8d56e5903a2911f0a9269e149126039e.web.val.run
A simple API endpoint that waits for a specified duration and returns a success message.
Make a GET request to the endpoint with a seconds
query parameter:
GET /?seconds=5
seconds
(required): Duration to wait in seconds. Must be a non-negative number.
Success (200):
{ "success": true, "message": "Wait completed successfully", "requestedSeconds": 5, "actualDurationMs": 5001, "cappedAt": null }
Error (400):
{ "error": "Seconds parameter is required. Provide duration in seconds as a query parameter." }
- Validates seconds parameter (must be non-negative number)
- Caps duration at 60 seconds (Val Town free tier timeout limit)
- Pro accounts support up to 10 minutes
- Returns actual wait time for verification
- Indicates if duration was capped
- Free accounts: Maximum 60 seconds
- Pro accounts: Maximum 10 minutes (600 seconds)
This endpoint automatically caps the duration based on the free tier limit. For longer durations, upgrade to Pro.
# Wait for 2 seconds curl "https://your-val-url/?seconds=2" # Wait for 10 seconds curl "https://your-val-url/?seconds=10" # Error: missing seconds curl "https://your-val-url/" # Error: invalid seconds curl "https://your-val-url/?seconds=invalid"