Take Endpoint

On this page, we’ll dive into the take endpoint you can use to render a website.


GET/v1/take

Render a Website

This endpoint lets you render a website.

Required attributes

  • Name
    url
    Type
    string
    Description

    The URL of the website you want to render.

Optional attributes

  • Name
    format
    Type
    string
    Description

    The format of the image returned. Supported: jpg, jpeg, png, gif, webp (jpeg is treated as an alias for jpg). Default value is png.

  • Name
    quality
    Type
    integer
    Description

    The quality of the image returned. Only supported when the format is jpg or jpeg. Default value is 80.

  • Name
    full_page
    Type
    boolean
    Description

    To take the screenshot of the full page, set full_page=1. Default value is 0.

  • Name
    viewport_width
    Type
    integer
    Description

    The width of the browser viewport in pixels. The browser's viewport is the window area where you can see the website. Default value is 1280.

  • Name
    viewport_height
    Type
    integer
    Description

    The height of the browser viewport in pixels. The browser's viewport is the window area where you can see the website. Default value is 800.

  • Name
    device_scale_factor
    Type
    number
    Description

    The device scale factor (device pixel ratio) used when rendering the page. Use 2 to emulate a retina/high-DPI display: the viewport size stays the same, but the returned image contains twice as many pixels in each dimension. Must be between 0.5 and 3. Default value is 1.

  • Name
    ip_country_code
    Type
    string
    Description

    The country code (ISO 3166-1 alpha-2) to use for the IP address when taking the screenshot. This allows you to simulate requests from different countries. Must be a lowercase code from the supported country list below — the value is case-sensitive, so use us, not US.

  • Name
    delay
    Type
    integer
    Description

    The delay in seconds to wait before taking the screenshot. Minimum value is 0, maximum value is 30. Default value is 0.

  • Name
    timeout
    Type
    integer
    Description

    The timeout in seconds for the page load. Minimum value is 5, maximum value is 60. Default value is 60.

  • Name
    wait_until
    Type
    string
    Description

    Determines when the screenshot should be taken based on page load state. Supported values:

    • load: Waits for the load event (entire page and all resources loaded)
    • domcontentloaded: Waits for HTML document to be loaded and parsed
    • networkidle0: Waits until there are no active network connections for 500ms
    • networkidle2: Waits until there are no more than two active network connections for 500ms Default value is load.
  • Name
    block_cookie_banners
    Type
    boolean
    Description

    Whether to block cookie banners on the page. Set to 1 to enable, 0 to disable. Default value is 0.

  • Name
    block_ads
    Type
    boolean
    Description

    Whether to block ads on the page. Set to 1 to enable, 0 to disable. Default value is 0.

  • Name
    block_chats
    Type
    boolean
    Description

    Whether to block chat widgets on the page. Set to 1 to enable, 0 to disable. Default value is 0.

  • Name
    hide_selectors
    Type
    array
    Description

    An array of CSS selectors to hide on the page. Elements matching these selectors will be hidden using CSS display: none and visibility: hidden. You can pass multiple selectors by using the parameter multiple times. Maximum 255 characters per selector. Example: hide_selectors[]=.cookie-banner&hide_selectors[]=#newsletter-popup

  • Name
    styles
    Type
    string
    Description

    Custom CSS styles to inject into the page before taking the screenshot. This allows you to modify the page's appearance using any valid CSS. You should urlencode this value. Maximum 10,000 characters. Example: body { background-color: red !important; }

  • Name
    upload
    Type
    boolean
    Description

    When set to 1, the screenshot is stored on our CDN and the response is a JSON object containing its public url instead of the image binary. Default value is 0.

  • Name
    attachment_name
    Type
    string
    Description

    The filename (without extension) used for the downloaded image. The file extension is appended automatically based on the chosen format. Maximum 255 characters.

Response

By default, the response body is the raw image binary (image/png, image/jpeg, image/gif or image/webp), served as a download. If you pass upload=1, the screenshot is stored and you receive a JSON object with its public URL instead.

Successful image (binary) responses include the following headers. Note that the JSON response returned with upload=1 does not currently include them.

  • Name
    X-Cost
    Type
    integer
    Description

    The number of requests this call counted against your quota.

  • Name
    X-Execution-Time
    Type
    number
    Description

    Server-side processing time in milliseconds.

Error responses are returned as JSON — see the status codes page for the full list of error codes and messages.

Request

GET
/v1/take
curl -G "https://api.screenshotbase.com/v1/take?url=https%3A%2F%2Fbbc.com" \
    -H "apikey: YOUR-API-KEY"

Response (upload=1)

{
    "url": "https://cdn.screenshotbase.com/screenshots/1337/abc123.png"
}

Error response

{
    "message": "The target website took too long to load."
}

Supported countries

The ip_country_code parameter accepts the following lowercase ISO 3166-1 alpha-2 country codes. The value is case-sensitive — uppercase codes are rejected with a 422 validation error.

Supported ip_country_code values

ae, al, am, ar, at, au, az, ba, bd, be, bg, bh, bn, bo, br, bw, by, ca, cg, ch,
cl, cm, cn, co, cr, cy, cz, de, dk, do, dz, ec, ee, eg, es, fi, fr, gb, ge, gh,
gr, gt, hk, hr, hu, id, ie, il, im, in, iq, is, it, jm, jo, jp, ke, kg, kh, kr,
kw, kz, la, li, lk, lt, lu, lv, ma, md, mk, mm, mo, mw, mx, my, mz, ng, nl, no,
nz, om, pa, pe, ph, pk, pl, pr, pt, py, qa, ro, rs, ru, sa, sc, se, sg, si, sk,
sl, th, tj, tm, tn, tr, tw, tz, ua, us, uy, uz, ve, vn, za, zm, zw