diff --git a/src/content/docs/browser-rendering/reference/timeouts.mdx b/src/content/docs/browser-rendering/reference/timeouts.mdx new file mode 100644 index 000000000000000..c62cf75eb6b5452 --- /dev/null +++ b/src/content/docs/browser-rendering/reference/timeouts.mdx @@ -0,0 +1,28 @@ +--- +pcx_content_type: reference +title: REST API Timeouts +sidebar: + order: 5 +--- +import { Tabs, TabItem } from "~/components"; + +Browser Rendering uses several independent timers to manage how long different parts of a request can take. +If any of these timers exceed their limit, the request returns a timeout error. + +Each timer controls a specific part of the rendering lifecycle — from page load, to selector load, to action. + +| Timer | Scope |Default |Max | +| -------------------------------------- | --------------- || --------------- || --------------- | +| `goToOptions.timeout` | How long to wait for the page to load. | 30 s | 60 s | +| `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 | — | +| `waitForSelector` | Waits for a specific element to appear on the page. Can be any CSS selector. | null | 60 s | +| `waitForTimeout` | After the page has loaded, waits an additional fixed time before proceeding. | null | 60 s | +| `actionTimeout` | How long to wait for the action itself (screenshot, PDF, scrape, etc.) to complete after loading finishes. | null | 5 min | +| `PDFOptions.timeout` | Same as `actionTimeout`, but only applies to the [/pdf endpoint](/browser-rendering/rest-api/pdf-endpoint/). | 30 s | 5 min | + +## Notes and recommendations +You can set multiple timers — as long as one is complete, the request will fire. + +If you’re not getting the expected output: +— Try increasing `goToOptions.timeout` (up to 60 s). +— If waiting for a specific element, use `waitForSelector`. Otherwise, use `goToOptions.waitUntil` set to `networkidle2` to ensure the page has finished loading dynamic content.