GET

/url/image

This endpoint is for simple URL to Image requests that do not require advanced options, if you need advanced options you should use the POST method described below.

This endpoint supports a few configuration options specified in the table below. These options are passed into the method as URL query strings.

ParamDescription
url
(string)

Source URL to use for generating the image.

Required
timeout
(number)

Amount of time that Chrome is allowed to run, if exceeded your job will be terminated and you will not be charged.

Default: 30000 ms (30 seconds)
    {
  "url": "",
  "timeout": 30000
}
Copied!
Examples
    wget --header="X-API-Key: <api-key>" \
"https://api.cloudlayer.io/v1/url/image?url=http://google.com" \
-O google.jpg
Copied!

POST

/url/image

This endpoint allows full configuration options to be defined for converting a URL to an image.

ParamDescription
url
(string)

Source URL to use for generating the image.

Required
timeout
(number)

Amount of time that Chrome is allowed to run, if exceeded your job will be terminated and you will not be charged.

Default: 30000 ms (30 seconds)
delay
(number)

The amount of time in milliseconds to wait for the page to complete rendering before conversion.

Default: 0
filename
(string)

If used with the inline:false, will set the Content-Disposition filename so that the downloaded file will be set to this value in the users browser. For inline:true it has no effect.

Default: 'file.pdf'
inline
(boolean)

If set to true, set's the Content-Disposition to 'inline', if set to false it will set the Content-Disposition to 'attachment'. See 'filename' property if you want to set the filename value for the attachment.

Default: false
waitForSelector
(waitForSelector)
selector
(string)
A selector of an element on the page to wait for until starting conversion.
options
(waitForSelectorOptions)

Different wait options

visible
(boolean)
Wait until the selector is visible. If you set hidden to true, it will negate this option.
hidden
(boolean)
Wait until the selector is hidden. If you set visible to true, it will negate this option.
timeout
(number)
Amount of time to wait for either of the options within waitForSelector to complete before aborting the request. This is inclusive to timeout property, and delay is additive occurring after this completes.
preferCSSPageSize
(boolean)

Give any CSS @page size declared in the page priority over what is declared in width and height or format options.

Default: false
scale
(boolean)

Scale of the webpage rendering. Defaults to 1. Scale amount must be between 0.1 and 2.

Default: 1
height
(string)

Paper height, accepts values labeled with units.

Default: (empty)
width
(string)

Paper width, accepts values labeled with units.

Default: (empty)
landscape
(boolean)

Paper orientation, false sets it to portrait and true to landscape.

Default: false
pageRanges
(string)

Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.

Default: (empty"
autoScroll
(boolean)

Will attempt to auto scroll the page down to the very end. Useful for forcing lazy-loaded content to load.

Default: false
waitUntil
(waitUntil)

When to consider navigation succeeded, defaults to networkidle2 Must be one one of the following values: load, domcontentloaded, networkidle0, networkidle2.

load Consider navigation to be finished when the load event is fired.
domcontentloaded Consider navigation to be finished when the DOMContentLoaded event is fired.
networkidle0 Consider navigation to be finished when there are no more than 0 network connections for at least 500 ms.
networkidle2 Consider navigation to be finished when there are no more than 2 network connections for at least 500 ms.
    {
  "url": "",
  "timeout": 30000,
  "delay": 0,
  "filename": "file.pdf",
  "inline": false,
  "waitForSelector": {
    "selector": "",
    "options": {
      "visible": false,
      "hidden": false,
      "timeout": 0
    }
  },
  "preferCSSPageSize": false,
  "scale": 1,
  "height": "",
  "width": "",
  "landscape": false,
  "pageRanges": "",
  "autoScroll": false,
  "waitUntil": "networkidle2"
}
Copied!
Examples
    wget --method POST \
--header 'X-API-Key: <api-key>' \
--header 'Content-Type: application/json' \
--body-data '{
  "url": "https://google.com"
}' \
https://api.cloudlayer.io/v1/url/image
Copied!
Result