Docly Developers
Function API only Updated 17 Oct 2026

sleep(milliseconds)

Pauses the script for the given number of milliseconds — for example between retries against an external API. The pause counts toward the script's execution time limit.

Parameters

millisecondsnumberrequired

How long to wait. 0 or a negative value does nothing.

Returns

null.

Example

Normal JavaScript, running in the browser or on the Docly™ server.
// Retry an external call up to three times
let result = null;
for (let i = 0; i < 3; i++) {
    result = docly.httpGet("https://api.example.com/status");
    if (!result.DoclyError) break;
    docly.sleep(1000);
}
return result;