Menu

Wait options

Reference for the wait options of the shotkit screenshot API, with an example request for each.

When to take the shot. By default, after the load event, once the network is briefly idle, the page has stopped changing, and fonts and visible images have loaded.

wait_until

Navigation events to wait for. networkidle0: no requests for 500 ms. networkidle2: at most 2 open requests for 500 ms. Several values wait for all of them.

Type: enum list · Default: load

Values: load, domcontentloaded, networkidle0, networkidle2

curl -X POST "https://shotkit.net/api/take" \
  -H "X-Access-Key: YOUR_ACCESS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","wait_until":["networkidle0"]}' \
  --fail-with-body -o shot.jpg

delay

Extra seconds to wait before capture.

Type: number · Default: 0 · Range: 0–30

curl -X POST "https://shotkit.net/api/take" \
  -H "X-Access-Key: YOUR_ACCESS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","delay":2}' \
  --fail-with-body -o shot.jpg

timeout

Total request timeout (s). Up to 90, or 600 with async (render time only). Covers the whole request, including waiting for a free browser. Above 90 seconds requires async=true, where it covers only the render.

Type: number · Default: 60 · Range: 5–600

curl -X POST "https://shotkit.net/api/take" \
  -H "X-Access-Key: YOUR_ACCESS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","timeout":30}' \
  --fail-with-body -o shot.jpg

Navigation timeout (s).

Type: number · Default: 30 · Range: 1–30

curl -X POST "https://shotkit.net/api/take" \
  -H "X-Access-Key: YOUR_ACCESS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","navigation_timeout":15}' \
  --fail-with-body -o shot.jpg

wait_for_selector

Wait for this selector to appear. Comma-separated selectors wait for any one of them, or all of them with wait_for_selector_algorithm=at_least_by_count.

Type: string

curl -X POST "https://shotkit.net/api/take" \
  -H "X-Access-Key: YOUR_ACCESS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","wait_for_selector":".chart canvas"}' \
  --fail-with-body -o shot.jpg

wait_for_selector_algorithm

How comma-separated selectors are matched.

Type: enum · Default: at_least_one

Values: at_least_one, at_least_by_count

curl -X POST "https://shotkit.net/api/take" \
  -H "X-Access-Key: YOUR_ACCESS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","wait_for_selector":".chart, .table","wait_for_selector_algorithm":"at_least_by_count"}' \
  --fail-with-body -o shot.jpg