Skip to content

Commit b6d8cdc

Browse files
authored
Create timeouts.mdx
new REST API timeouts page
1 parent ce609de commit b6d8cdc

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
pcx_content_type: reference
3+
title: REST API Timeouts
4+
sidebar:
5+
order: 5
6+
---
7+
import { Tabs, TabItem } from "~/components";
8+
9+
Browser Rendering uses several independent timers to manage how long different parts of a request can take.
10+
If any of these timers exceed their limit, the request returns a timeout error.
11+
12+
Each timer controls a specific part of the rendering lifecycle — from page load, to selector load, to action.
13+
14+
| Timer | Scope |Default |Max |
15+
| -------------------------------------- | --------------- || --------------- || --------------- |
16+
| `goToOptions.timeout` | How long to wait for the page to load. | 30 s | 60 s |
17+
| `goToOptions.waitUntil` | Waits for an event to fire. load (default) — waits for the full load event.domcontentloaded — waits for the DOMContentLoaded event.networkidle0 — waits until there are no more than 0 network connections for at least 500 ms.networkidle2 — waits until there are no more than 2 network connections for at least 500 ms. | Load is the default ||
18+
| `waitForSelector` | Waits for a specific element to appear on the page. Can be any CSS selector. | null | 60 s |
19+
| `waitForTimeout` | After the page has loaded, waits an additional fixed time before proceeding. | null | 60 s |
20+
| `actionTimeout` | How long to wait for the action itself (screenshot, PDF, scrape, etc.) to complete after loading finishes. | null | 5 min |
21+
| `PDFOptions.timeout` | Same as `actionTimeout`, but only applies to the [/pdf endpoint](/browser-rendering/rest-api/pdf-endpoint/). | 30 s | 5 min |
22+
23+
## Notes and recommendations
24+
You can set multiple timers — as long as one is complete, the request will fire.
25+
26+
If you’re not getting the expected output:
27+
— Try increasing `goToOptions.timeout` (up to 60 s).
28+
— If waiting for a specific element, use `waitForSelector`. Otherwise, use `goToOptions.waitUntil` set to `networkidle2` to ensure the page has finished loading dynamic content.

0 commit comments

Comments
 (0)