v1

latestOpenAPI 3.0.02026-08-065720.9 KB
render

Render image

post/render

Query parameters

api_keystring required

API key for authorization

Request body

htmlstring required

This refers to the HTML content you wish to render. You can submit either a snippet of HTML (for example, <div>Your content</div>) or a full webpage.

cssstring

This refers to the CSS styling for your rendered image. If used in conjunction with a URL, it will be incorporated into the webpage.

device_scalenumber

Modifies the pixel density of the screenshot. By default, it is set to 2, mirroring the quality of a 4K monitor. The minimum value allowed is 1, while the maximum is 3.

viewport_widthnumber

This allows you to determine the width of Chrome's viewing area, which will deactivate the auto-cropping feature. If you're using either parameter, both the height and width settings need to be specified.

viewport_heightnumber

This allows you to specify the height of Chrome's viewing area, which in turn deactivates the auto-cropping feature. Both the height and width parameters need to be established if you choose to use either one.

full_screenboolean

This parameter allows you take screenshot of entire webpage.

selectorstring

Advanced Option: Specify a CSS selector corresponding to an element in the HTML. The image will be cropped precisely to this designated element.

ms_delaynumber

Incorporates additional delay to ensure JavaScript execution is complete. This option is useful if you encounter blank images while using JavaScript. The default setting is 0, but you can begin with a 500 millisecond delay if necessary.

Example request

{
  "html": "<div>This is something</div>",
  "css": ".h1 {color: red}",
  "device_scale": 1,
  "viewport_width": 640,
  "viewport_height": 480,
  "selector": ".tweet-text",
  "ms_delay": 500
}

Response

Rendered image URL.

imageUrlstring required

URL to generated image

Example response

{
  "imageUrl": "https://api.canvasflare.com/image/8d063c49-3f15-46c1-91c7-9cf61e6758c6"
}