Menu

Customization options

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

Change the page before capture: hide elements, inject CSS or JavaScript, click and hover. They run after the page has loaded, in the order listed here.

hide_selectors

Hide every element matching each selector. Elements get display: none !important.

Type: list

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","hide_selectors":[".newsletter-popup","#promo-bar"]}' \
  --fail-with-body -o shot.jpg

styles

CSS injected before capture.

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","styles":"header { position: static !important }"}' \
  --fail-with-body -o shot.jpg

scripts

JavaScript executed before capture. Runs in the page after it loads, before clicks and the capture. If it throws, the request fails with script_triggers_error. If it navigates, set scripts_wait_until.

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","scripts":"document.querySelector('\''details'\'')?.setAttribute('\''open'\'', '\'''\'')"}' \
  --fail-with-body -o shot.jpg

scripts_wait_until

Wait for these events after scripts run.

Type: enum list

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","scripts":"document.querySelector('\''a.next'\'').click()","scripts_wait_until":["networkidle2"]}' \
  --fail-with-body -o shot.jpg

click

Click this selector before capture. Waits for the element to become visible first.

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","click":"button.load-more"}' \
  --fail-with-body -o shot.jpg

hover

Hover this selector before capture.

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","hover":"nav .products"}' \
  --fail-with-body -o shot.jpg

error_on_click_selector_not_found

Fail if the click target is missing.

Type: boolean · Default: true

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","click":"#close-promo","error_on_click_selector_not_found":false}' \
  --fail-with-body -o shot.jpg

error_on_hover_selector_not_found

Fail if the hover target is missing.

Type: boolean · Default: true

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","hover":"nav .products","error_on_hover_selector_not_found":false}' \
  --fail-with-body -o shot.jpg