Waiting Rooms allow you to queue visitors when your website experiences high traffic, ensuring a smooth user experience and protecting your origin servers from being overwhelmed.
Create a waiting room
Creates a new waiting room for a zone.
const waitingRoom = await client.waitingRooms.create({
zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
host: 'shop.example.com',
name: 'production_webinar',
new_users_per_minute: 200,
total_active_users: 200,
});
The hostname to which this waiting room will be applied (no wildcards). The hostname must be the primary domain, subdomain, or custom hostname of this zone.
A unique name to identify the waiting room. Only alphanumeric characters, hyphens, and underscores are allowed.
The number of new users that will be let into the route every minute.
The total number of active user sessions on the route at a point in time.
Sets the path within the host to enable the waiting room on. The waiting room will be enabled for all subpaths as well. Defaults to /.
A description of the waiting room.
Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to the route. Defaults to 5 minutes.
Disables automatic renewal of session cookies. Defaults to false.
Suspends the waiting room, allowing all traffic through. Defaults to false.
Whether to queue all visitors, regardless of traffic levels. Defaults to false.
If true, requests to the waiting room with the header Accept: application/json will receive a JSON response object.
Custom HTML to display while users are in the waiting room.
default_template_language
The language to use for the default waiting room page. Available languages: de-DE, en-US, es-ES, fr-FR, id-ID, it-IT, ja-JP, ko-KR, nl-NL, pl-PL, pt-BR, tr-TR, zh-CN, zh-TW.
Configures cookie attributes for the waiting room cookie.SameSite attribute: auto, lax, none, or strict
Secure attribute: auto, always, or never
Additional hostname and path combinations to which this waiting room will be applied.The hostname for this additional route
The path for this additional route
The waiting room identifier
Timestamp when the waiting room was created
Timestamp when the waiting room was last modified
The hostname where the waiting room is applied
The path where the waiting room is applied
The total number of active user sessions allowed
The number of new users admitted per minute
Update a waiting room
Updates a configured waiting room.
const waitingRoom = await client.waitingRooms.update(
'699d98642c564d2e855e9661899b7252',
{
zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
host: 'shop.example.com',
name: 'production_webinar',
new_users_per_minute: 300,
total_active_users: 300,
},
);
The waiting room identifier
List waiting rooms
Lists all waiting rooms for an account or zone.
for await (const waitingRoom of client.waitingRooms.list({
zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
})) {
console.log(waitingRoom.name);
}
The zone identifier (use either zone_id or account_id)
The account identifier (use either zone_id or account_id)
Get a waiting room
Fetches details for a single configured waiting room.
const waitingRoom = await client.waitingRooms.get(
'699d98642c564d2e855e9661899b7252',
{ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
);
The waiting room identifier
Edit a waiting room
Patches a configured waiting room, updating only the specified fields.
const waitingRoom = await client.waitingRooms.edit(
'699d98642c564d2e855e9661899b7252',
{
zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
suspended: true,
},
);
The waiting room identifier
Delete a waiting room
Deletes a waiting room.
await client.waitingRooms.delete(
'699d98642c564d2e855e9661899b7252',
{ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
);
The waiting room identifier
Preview waiting room
Get a preview of how a waiting room will look.
const preview = await client.waitingRooms.page.preview({
zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
waiting_room_id: '699d98642c564d2e855e9661899b7252',
});
Waiting room events
Manage scheduled events for waiting rooms to handle predictable traffic surges.
// Create an event
const event = await client.waitingRooms.events.create({
zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
waiting_room_id: '699d98642c564d2e855e9661899b7252',
name: 'Black Friday Sale',
event_start_time: '2026-11-27T12:00:00Z',
event_end_time: '2026-11-27T18:00:00Z',
new_users_per_minute: 500,
total_active_users: 1000,
});
// List events
for await (const event of client.waitingRooms.events.list({
zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
waiting_room_id: '699d98642c564d2e855e9661899b7252',
})) {
console.log(event.name);
}
Waiting room rules
Manage rules to bypass or customize waiting room behavior.
// Create a rule
const rule = await client.waitingRooms.rules.create({
zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
waiting_room_id: '699d98642c564d2e855e9661899b7252',
action: 'bypass_waiting_room',
expression: 'http.request.uri.path contains "/admin"',
});
Get waiting room status
Get the current status and metrics for a waiting room.
const status = await client.waitingRooms.statuses.get({
zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
waiting_room_id: '699d98642c564d2e855e9661899b7252',
});
Waiting room settings
Manage zone-level waiting room settings.
// Get settings
const settings = await client.waitingRooms.settings.get({
zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
});
// Update settings
await client.waitingRooms.settings.edit({
zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
search_engine_crawler_bypass: true,
});