NewAPI

Custom CSS and JavaScript before the capture.

New custom_css and custom_js options change the page before the screenshot, to hide an element, open a tab, or wait until your content is ready.

Two new parameters, each up to 4,096 characters:

  • custom_css is added to the page after it loads, as its last stylesheet. It works on every plan.
  • custom_js runs after the CSS. If it returns a promise, the screenshot waits for it, up to timeout_ms. It needs a paid plan: on Free, a request with it is rejected with invalid_request and costs nothing.
curl -G "https://api.urlshot.io/v1/screenshot" \
  -H "Authorization: Bearer $URLSHOT_API_KEY" \
  --data-urlencode "url=https://example.com" \
  --data-urlencode "custom_css=.newsletter { display: none !important }" \
  --output screenshot.png

A script that throws, or never finishes, fails the request with script_failed and your own error message, and the render costs one credit. Both work on pages with a strict Content-Security-Policy. We never store your CSS or JavaScript: request logs record only whether you used them.

Read the documentation

Try it on your own pages.

Everything in this changelog is live. 100 free screenshots a month, no credit card needed.