Screenshots

Screenshot of a URL or HTML (ScreenshotOne compatible)

Captures a public URL or an HTML document and returns the image (or PDF). Nothing is stored. Retrying is safe: a render has no side effects and nothing is stored, so a repeated request never creates a duplicate. Retry 408, 429 and 503 with an increasing wait (for example 2, 4 and 8 seconds); do not retry other 4xx errors.

get/take

Request

  • Base URL: https://api.sahifa.dev
  • URL: https://api.sahifa.dev/take
  • Auth: one of:
    • API key in header X-API-Key
    • API key in query parameter access_key

Query parameters

urlstring uri

Public http(s) address to capture. Send exactly one of url and html.

htmlstring

HTML document to capture.

format'png' | 'jpeg' | 'jpg' | 'webp' | 'pdf'
image_qualityinteger

For jpeg and webp.

omit_backgroundboolean
full_pageboolean
viewport_widthinteger
viewport_heightinteger
device_scale_factornumber
selectorstring

CSS selector of one element to capture; 404 if nothing matches.

clip_xinteger
clip_yinteger
clip_widthinteger
clip_heightinteger
dark_modeboolean
reduced_motionboolean
user_agentstring
authorizationstring

Authorization header sent to the page.

headersstring[]

Name=value pairs.

cookiesstring[]

name=value pairs.

delaynumber

Seconds.

timeoutnumber

Seconds; capped at 30.

wait_until'load' | 'domcontentloaded' | 'networkidle' | 'commit'
wait_for_selectorstring
response_type'by_format' | 'json'
cacheboolean

Accepted and ignored.

block_adsboolean
block_trackersboolean
block_cookie_bannersboolean
block_chatsboolean
hide_selectorsstring[]
block_requestsstring[]

URL patterns, * as wildcard.

block_resourcesstring[]

Response

The image or PDF, or JSON when response_type=json

successboolean
content_typestring
datastring byte
sizeinteger

Changes

No recorded changes to this operation across all 1 revision of this API.