API Introduction

The CloudBrowser screenshot and PDF creation service has been exposed to our customers as a standard RESTful API. A joint effort between our community and CloudBrowser has resulted in native API wrappers, bindings, and code snippets in multiple languages. Authentication is as simple as appending your API key to the request URL. Though we provide one of the most flexible rendering APIs. Please get in touch if you need any help at all!

https://api.cloudbrowser.co/v1/

Authentication

To authenticate your HTTP request all that must be done is to append your API key to the URI. An example has been provided below to demonstrate the format the URL should take. Your request is now authenticated and logged in your API call log.

https://api.cloudbrowser.co/v1/image?key=YOUR_KEY_HERE

In a real request scenario you would also append other GET parameters such as the URL to the source that you would like to render and export.

https://api.cloudbrowser.co/v1/image?key=YOUR_KEY_HERE

In a real request scenario, you would also append other GET parameters such as the URL to the source that you would like to render and export.

https://api.cloudbrowser.co/v1/image?key=YOUR_KEY_HERE

In a real request scenario, you would also append other GET parameters such as the URL to the source that you would like to render and export.

https://api.cloudbrowser.co/v1/image?key=YOUR_KEY_HERE

In a real request scenario, you would also append other GET parameters such as the URL to the source that you would like to render and export.

https://api.cloudbrowser.co/v1/image?key=YOUR_KEY_HERE

In a real request scenario, you would also append other GET parameters such as the URL to the source that you would like to render and export.

https://api.cloudbrowser.co/v1/image?key=YOUR_KEY_HERE

In a real request scenario, you would also append other GET parameters such as the URL to the source that you would like to render and export.

https://api.cloudbrowser.co/v1/image?key=YOUR_KEY_HERE

In a real request scenario, you would also append other GET parameters such as the URL to the source that you would like to render and export.

HTTP Response Codes

The API uses standard HTTP response codes to communicate the result of an API call. We have endeavoured to match the original meaning of the HTTP response code to our adopted meaning, however the meaning may not always be clear. In such an eventuality please use the below table to understand the API response codes you receive.

In general all 2xx will respond with the rendered requested resource. All 4xx responses indicate a stopping error, meaning your request was not processed.

HTTP Response Codes
  • Great Success 200

    The command was processed successfully. Check the response body for your requested resources.

  • Command unknown 400

    The end-point you have sent the request to is not valid (for example, the end point should be /image instead of /nonExistentEndPoint)

  • Unauthorized 401

    The request was not authorised. This can occur when using an incorrect key, if the server IP is not on the account whitelist, or if the account is banned.

  • Billing 402

    The request was refused due to a billing issue with the associated account.

  • Command invalid
    405

    The HTTP request method used is not compatible with the selected end-point. This can occur when using POST rather than GET for example.

  • Command malformed 409

    The request has been incorrectly constructed. This can occur when omitting required parameters or providing them in the wrong type.

  • Unprocessable
    422

    Well formatted request however some technical issue is preventing the serving of the request

  • Too many requests
    429

    You have exceeded your allocated concurrent request allowance - for this reason you have been rate limited.

  • Internal Server Error
    500


    The client did everything correctly, but we've had an internal issue.

Native Libraries

This section provides a list of current opensource native API bindings and libraries to help kick start your development. We fully welcome and support our community in creating pull requests and shaping the future of each library. If you have developed your own code to consume our API please let us know and we can link to it here to share it with the community!

Screenshot / Screencapture API

This end-point performs a render and screen grab of a given URL/source and supplies the result in your requested format, PNG or JPEG.

Both HTTP GET and POST are supported for all parameters on this end-point for convince and flexibility. If you are sending large amounts of raw HTML, or injecting copious amounts of JS or CSS please perform a POST request to avoid the size limitations of GET requests that can sometimes cause odd behaviour.

https://api.cloudbrowser.co/v1/image
Request GET Parameters
source The URL to the webpage to capture OR pass raw HTML by this parameter to capture and render. When passing raw HTML you must encode it using base64.
output_file_type The desired file type of the image. Acceptable values are listed below:
  • 1 = JPEG
  • 2 = PNG
Defaults to 1 (JPEG).
output_return_method Specifies the method used to serve the screenshot, currently the following types (i.e. acceptable values to pass) are supported:
  • 1 = return a base64 encoded version of the image
  • 2 = return a HTTP link to the image hosted on our file server, available for 5 minutes
Defaults to 1 (a base64 string).
client_width The width of the client used to render the webpage, specified in pixels (only numbers, no need for the 'px' suffix).
Defaults to 1920.
client_height The height of the client used to render the webpage, specified in pixels (only numbers, no need for the 'px' suffix).
Defaults to 1080.
client_touch This parameter controls the type of pointing device the webpage perceives, a standard pointer such as a USB mouse, or a finger for touch screen emulation, such as on tablets and smart phones.
  • 1 = Touch simulation enabled
  • 2 = Touch simulation disabled
Defaults to 2 (touch simulation disabled).
client_scale_factor This setting expects a whole or real number and sets the scale factor of the client.
Defaults to 1.
client_images This setting allows you to block or allow the download and display of external images, does not affect Base64, SVG, or other inline images from rendering.
  • 1 = Images enabled
  • 2 = Images disabled
Defaults to 1 (images enabled).
client_js Choose to enable or disable execution of client side JavaScript (ES6, evaluated by V8).
  • 1 = JavaScript enabled
  • 2 = JavaScript disabled
Defaults to 1 (JS enabled).
client_plugin Select 1 or more plugins to load into the rendering environment before rendering your source. It is possible to enable multiple plugins by passing a comma-separated list to this parameter.
  • 1 = No plugin
  • 2 = Adblock plus
Defaults to no enabled plugins.
client_ua Pass a custom browser user agent string to imperseonate any browser or device.
Defaults to one of the most common desktop user agents: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3264.0 Safari/537.36.
inject_css Supply Base64 encoded custom CSS styles to be evaluated inline on the document. We recommend that you set a `capture_timeout` (e.g. 1000ms) to allow the new CSS to be rendered.
No Default.
inject_js Supply Base64 encoded custom JavaScript styles to be evaluated inline on the document.
No Default.
capture_quality A number between 1 and 100 (inclusive) that dictates the quality of the screen grab with 100 being best quality. This setting is only available on jpeg exports. PNG Images will always be rendered at the highest quality.
Defaults to 90 (for Jpeg, PNG images are never compressed).
capture_region Supply a standard JS query selector to receive a rendered export of just that element and all of it's child elements. For example:
  • By ID: #footer
  • By Class: .nav
Defaults to capturing the all visible elements in given view port and page size.
capture_region_padding Specify a padding region in pixels (px) to add a margin around the element specified by the `capture_region` parameter.
Defaults to 5 (px).
preset_device Emulate a phone or tablet's render environment with our pre-set classes to avoid the need to research and specify all the settings yourself. Settings changed by these profiles included, touch emulation, scale factor, view port height and width, and device orientation. A list of acceptable device names that you may pass to the in this parameter can be found below.
  • "Blackberry PlayBook"
  • "Blackberry PlayBook landscape"
  • "BlackBerry Z30"
  • "BlackBerry Z30 landscape"
  • "Galaxy Note 3"
  • "Galaxy Note 3 landscape"
  • "Galaxy Note II"
  • "Galaxy Note II landscape"
  • "Galaxy S III"
  • "Galaxy S III landscape"
  • "Galaxy S5"
  • "Galaxy S5 landscape"
  • "iPad"
  • "iPad landscape"
  • "iPad Mini"
  • "iPad Mini landscape"
  • "iPad Pro"
  • "iPad Pro landscape"
  • "iPhone 4"
  • "iPhone 4 landscape"
  • "iPhone 5"
  • "iPhone 5 landscape"
  • "iPhone 6"
  • "iPhone 6 landscape"
  • "iPhone 6 Plus"
  • "iPhone 6 Plus landscape"
  • "iPhone 7"
  • "iPhone 7 landscape"
  • "iPhone 7 Plus"
  • "iPhone 7 Plus landscape"
  • "iPhone 8"
  • "iPhone 8 landscape"
  • "iPhone 8 Plus"
  • "iPhone 8 Plus landscape"
  • "iPhone SE"
  • "iPhone SE landscape"
  • "iPhone X"
  • "iPhone X landscape"
  • "Kindle Fire HDX"
  • "Kindle Fire HDX landscape"
  • "LG Optimus L70"
  • "LG Optimus L70 landscape"
  • "Microsoft Lumia 550"
  • "Microsoft Lumia 950"
  • "Microsoft Lumia 950 landscape"
  • "Nexus 10"
  • "Nexus 10 landscape"
  • "Nexus 4"
  • "Nexus 4 landscape"
  • "Nexus 5"
  • "Nexus 5 landscape"
  • "Nexus 5X"
  • "Nexus 5X landscape"
  • "Nexus 6"
  • "Nexus 6 landscape"
  • "Nexus 6P"
  • "Nexus 6P landscape"
  • "Nexus 7"
  • "Nexus 7 landscape"
  • "Nokia Lumia 520"
  • "Nokia Lumia 520 landscape"
  • "Nokia N9"
  • "Nokia N9 landscape"
  • "Pixel 2"
  • "Pixel 2 landscape"
  • "Pixel 2 XL"
  • "Pixel 2 XL landscape"
No Default (environment emulates a standard desktop computer).
capture_transparent If enabled a default white background will not be inserted by the rendering engine. Any content on the page without a background colour will be rendered transparent using the alpha channel. This setting is only available on PNG exports.
  • 1 = Transparent render enabled
  • 2 = Transparent render disabled
Defaults to 2 (non-transparent).
capture_full_page When this action is disabled only the above-the-fold content will be captured. Above-the-fold is defined by the box specified by the width & height parameters starting at the top of the page.
  • 1 = Full page render
  • 2 = Above-the-fold render
Defaults to 2 (false).
capture_force_lazy_load Some webpages only load images when the portion of the page scrolls into view. This can cause issues when taking full page screenshots. Force the loading of such lazy loaded images before capturing the full-page screenshot.
  • 1 = Capture naturally
  • 2 = Force-load lazy loaded images
Defaults to 1 (capture natural page).
capture_timeout The amount of time expressed in seconds to wait before the screenshot is taken after the page and all elements have been loaded, specified in milliseconds - 1 second = 1000 milliseconds.
Defaults to 500 milliseconds (0.5 seconds).
capture_close_cookie_notice Attempt to automatically close the visual blight caused by the EU mandated cookie notices, prior to exporting the rendered page. Cookie notice closing is offered on a best effort basis with no guarantee of functionality.
  • 1 = Do not Attempt to close/accept cookie notices
  • 2 = Attempt to close/accept cookie notices
Defaults to 1 (not closing cookie notices).
custom_http_header Pass the custom header you would like the rendering client to send to the target server. This value should be supplied as a string in the format "Header: value".
No Default.
custom_location_lat Specify a custom location defined by latitude and longitude to be reported by the rendering environments HTML5 geolocation API.
No Default.
custom_location_long Specify a custom location defined by latitude and longitude to be reported by the rendering environments HTML5 geolocation API.
No Default.
thumbnail_width If you wish to export a thumbnail shot rather than a fully-fledged screen capture you must pass a positive integer via this parameter specifying the width of the exported thumbnail. Thumbnails are generated by rendering the source in the original viewport specified (and other settings such as inject JS, custom cookies, and so forth) and then resizing the resulting image to the desired dimensions.
If no values are passed for `client_width` and `client_width` they will be set to a multiple of `thumbnail_width` and `thumbnail_height`, rather than their current default values.
Thumbnails are not generated by default.
We recommend that the values passed for thumbnail width and height are in the same ratio as viewport width and height to avoid visual distortion of the thumbnail export.
thumbnail_height If you wish to export a thumbnail shot rather than a fully fledged screen captures you must pass a positive integer via this parameter specifying the height of the exported thumbnail. Thumbnails are generated by rendering the source in the original viewport specified (and other settings such as inject JS, custom cookies, and so forth) and then resizing the resulting image to the desired dimensions.
If no values are passed for `client_width` and `client_width` they will be set to a multiple of `thumbnail_width` and `thumbnail_height`, rather than their current default values.
Thumbnails are not generated by default.
We recommend that the values passed for thumbnail width and height are in the same ratio as viewport width and height to avoid visual distortion of the thumbnail export.

URL to Image API

This end-point performs a render and screen capture of your supplied URL and supplies the result in your requested format, PNG or JPEG.

Request

https://api.cloudbrowser.co/v1/image?source=http://example.com&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=http://example.com&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=http://example.com&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=http://example.com&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=http://example.com&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=http://example.com&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=http://example.com&key=YOUR_KEY_HERE
Succesful Response Body (return_type=1)
{
   "base64": "iVBORw0KGgoAAAANSUhEUgAABLAAAAMgCAYAAAAz4JsCAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAAIABJREFUeJzs3Xl4FFXa9/FfJ4QkhCxCgIAigUDYZVM2BUUIguOoIKKyM0IEZGdYnBEYotFHBYQBUUFAGYwCj4OIgAqKKEscmQFGEBBCAAEF2RKUkJDlcMnabp6qS60yFF+vu5Li7N6VOn7rNUpftOVbXt4sX0PAEAAAAAAAAW5VfaAQAAAAAAAACFIYEFAA ... ACANAELAAAAgDQBCwAAAIA0AQsAAACANAELAAAAgDQBCwAAAIC0/wBqRycyXwTWgAAAAABJRU5ErkJggg==",
   "prefix": "data:image/png;base64,"
}
Succesful Response Body (return_type=2)
{
   "location": "https://cdn.cloudbrowser.co/img/fb2d8374e071e2e877cad.png"
}

HTML to Image API

This end-point performs a render and screen capture of your supplied HTML, pulling all necessary JavaScript and CSS. The API then supplies the result in your requested format, PNG or JPEG.

Request

https://api.cloudbrowser.co/v1/image?source=gICAgICAgICAgcWMuYXN5bmICAgICAMgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICBxYy5zcmMgICAgICAgICA...ICA8L2JvZHk+DQogICAgPC9odG1sPcWMuYXN5bmICAgIg0K&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=gICAgICAgICAgcWMuYXN5bmICAgICAMgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICBxYy5zcmMgICAgICAgICA...ICA8L2JvZHk+DQogICAgPC9odG1sPcWMuYXN5bmICAgIg0K&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=gICAgICAgICAgcWMuYXN5bmICAgICAMgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICBxYy5zcmMgICAgICAgICA...ICA8L2JvZHk+DQogICAgPC9odG1sPcWMuYXN5bmICAgIg0K&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=gICAgICAgICAgcWMuYXN5bmICAgICAMgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICBxYy5zcmMgICAgICAgICA...ICA8L2JvZHk+DQogICAgPC9odG1sPcWMuYXN5bmICAgIg0K&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=gICAgICAgICAgcWMuYXN5bmICAgICAMgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICBxYy5zcmMgICAgICAgICA...ICA8L2JvZHk+DQogICAgPC9odG1sPcWMuYXN5bmICAgIg0K&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=gICAgICAgICAgcWMuYXN5bmICAgICAMgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICBxYy5zcmMgICAgICAgICA...ICA8L2JvZHk+DQogICAgPC9odG1sPcWMuYXN5bmICAgIg0K&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=gICAgICAgICAgcWMuYXN5bmICAgICAMgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICBxYy5zcmMgICAgICAgICA...ICA8L2JvZHk+DQogICAgPC9odG1sPcWMuYXN5bmICAgIg0K&key=YOUR_KEY_HERE
Successful Response Body (return_type=1)
{
   "base64": "iVBORw0KGgoAAAANSUhEUgAABLAAAAMgCAYAAAAz4JsCAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAAIABJREFUeJzs3Xl4FFXa9/FfJ4QkhCxCgIAigUDYZVM2BUUIguOoIKKyM0IEZGdYnBEYotFHBYQBUUFAGYwCj4OIgAqKKEscmQFGEBBCAAEF2RKUkJDlcMnabp6qS60yFF+vu5Li7N6VOn7rNUpftOVbXt4sX0PAEAAAAAAAAW5VfaAQAAAAAAAACFIYEFAA ... ACANAELAAAAgDQBCwAAAIA0AQsAAACANAELAAAAgDQBCwAAAIC0/wBqRycyXwTWgAAAAABJRU5ErkJggg==",
   "prefix": "data:image/png;base64,"
}
Successful Response Body (return_type=2)
{
   "location": "https://cdn.cloudbrowser.co/img/fb2d8374e071e2e877cad.png"
}

URL to Thumbnail API

This end-point performs a render and screen capture of your supplied URL and returns the result as a thumbnail image to the dimensions specified.

Request

https://api.cloudbrowser.co/v1/image?source=http://example.com&thumbnail_width=128&thumbnail_height=128&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=http://example.com&thumbnail_width=128&thumbnail_height=128&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=http://example.com&thumbnail_width=128&thumbnail_height=128&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=http://example.com&thumbnail_width=128&thumbnail_height=128&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=http://example.com&thumbnail_width=128&thumbnail_height=128&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=http://example.com&thumbnail_width=128&thumbnail_height=128&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=http://example.com&thumbnail_width=128&thumbnail_height=128&key=YOUR_KEY_HERE
Successful Response Body (return_type=1)
{
   "base64": "iVBORw0KGgoAAAANSUhEUgAABLAAAAMgCAYAAAAz4JsCAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAAIABJREFUeJzs3Xl4FFXa9/FfJ4QkhCxCgIAigUDYZVM2BUUIguOoIKKyM0IEZGdYnBEYotFHBYQBUUFAGYwCj4OIgAqKKEscmQFGEBBCAAEF2RKUkJDlcMnabp6qS60yFF+vu5Li7N6VOn7rNUpftOVbXt4sX0PAEAAAAAAAAW5VfaAQAAAAAAAACFIYEFAA ... ACANAELAAAAgDQBCwAAAIA0AQsAAACANAELAAAAgDQBCwAAAIC0/wBqRycyXwTWgAAAAABJRU5ErkJggg==",
   "prefix": "data:image/png;base64,"
}
Successful Response Body (return_type=2)
{
   "location": "https://cdn.cloudbrowser.co/img/fb2d8374e071e2e877cad.png"
}

HTML to Thumbnail API

This end-point performs a render and screen capture of your supplied HTML and returns the result as a thumbnail image to the dimensions specified.

Request

https://api.cloudbrowser.co/v1/image?source=gICAgICAgICAgcWMuYXN5bmICAgICAMgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICBxYy5zcmMgICAgICAgICA...ICA8L2JvZHk+DQogICAgPC9odG1sPcWMuYXN5bmICAgIg0&thumbnail_width=128&thumbnail_height=128&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=gICAgICAgICAgcWMuYXN5bmICAgICAMgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICBxYy5zcmMgICAgICAgICA...ICA8L2JvZHk+DQogICAgPC9odG1sPcWMuYXN5bmICAgIg0&thumbnail_width=128&thumbnail_height=128&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=gICAgICAgICAgcWMuYXN5bmICAgICAMgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICBxYy5zcmMgICAgICAgICA...ICA8L2JvZHk+DQogICAgPC9odG1sPcWMuYXN5bmICAgIg0&thumbnail_width=128&thumbnail_height=128&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=gICAgICAgICAgcWMuYXN5bmICAgICAMgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICBxYy5zcmMgICAgICAgICA...ICA8L2JvZHk+DQogICAgPC9odG1sPcWMuYXN5bmICAgIg0&thumbnail_width=128&thumbnail_height=128&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=gICAgICAgICAgcWMuYXN5bmICAgICAMgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICBxYy5zcmMgICAgICAgICA...ICA8L2JvZHk+DQogICAgPC9odG1sPcWMuYXN5bmICAgIg0&thumbnail_width=128&thumbnail_height=128&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=gICAgICAgICAgcWMuYXN5bmICAgICAMgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICBxYy5zcmMgICAgICAgICA...ICA8L2JvZHk+DQogICAgPC9odG1sPcWMuYXN5bmICAgIg0&thumbnail_width=128&thumbnail_height=128&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/image?source=gICAgICAgICAgcWMuYXN5bmICAgICAMgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICBxYy5zcmMgICAgICAgICA...ICA8L2JvZHk+DQogICAgPC9odG1sPcWMuYXN5bmICAgIg0&thumbnail_width=128&thumbnail_height=128&key=YOUR_KEY_HERE
Succesful Response Body (return_type=1)
{
   "base64": "iVBORw0KGgoAAAANSUhEUgAABLAAAAMgCAYAAAAz4JsCAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAAIABJREFUeJzs3Xl4FFXa9/FfJ4QkhCxCgIAigUDYZVM2BUUIguOoIKKyM0IEZGdYnBEYotFHBYQBUUFAGYwCj4OIgAqKKEscmQFGEBBCAAEF2RKUkJDlcMnabp6qS60yFF+vu5Li7N6VOn7rNUpftOVbXt4sX0PAEAAAAAAAAW5VfaAQAAAAAAAACFIYEFAA ... ACANAELAAAAgDQBCwAAAIA0AQsAAACANAELAAAAgDQBCwAAAIC0/wBqRycyXwTWgAAAAABJRU5ErkJggg==",
   "prefix": "data:image/png;base64,"
}
Succesful Response Body (return_type=2)
{
   "location": "https://cdn.cloudbrowser.co/img/fb2d8374e071e2e877cad.png"
}

PDF Export API

This end-point performs a render of your supplied URL and supplies the result as a PDF document.

Both HTTP GET and POST are supported for all parameters on this end-point for convince and flexibility. If you are sending large amounts of raw HTML, or injecting copious amounts of JS or CSS please perform a POST request to avoid the size limitations of GET requests that can sometimes cause odd behaviour.

The contents of the various header and footer fields on this end-point can accept inline CSS styles and Base64 encoded images.

https://api.cloudbrowser.co/v1/pdf
Request GET Parameters
source The URL to the webpage to capture OR pass raw HTML by this parameter to capture and render. When passing raw HTML you must encode it using base64.
output_return_method Specifies the method used to serve the screenshot, currently the following types (i.e. acceptable values to pass) are supported:
  • 1 = return a base64 encoded version of the PDF
  • 2 = return a HTTP link to the PDF hosted on our CDN, available for 5 minutes
Defaults to 1 (a base64 string).
client_scale_factor This setting expects a whole or real number and sets the scale factor of the client.
Defaults to 1.
client_images This setting allows you to block or allow the download and display of external images, does not affect Base64, SVG, or other inline images from rendering.
  • 1 = Images enabled
  • 2 = Images disabled
Defaults to 1 (images enabled).
client_js Choose to enable or disable execution of client side JavaScript (ES6, evaluated by V8).
  • 1 = JavaScript enabled
  • 2 = JavaScript disabled
Defaults to 1 (JS enabled).
client_plugin Select 1 or more plugins to load into the rendering environment before rendering your source. It is possible to enable multiple plugins by passing a comma-separated list to this parameter.
  • 1 = No plugin
  • 2 = Adblock plus
Defaults to no enabled plugins.
client_ua Pass a custom browser user agent string to imperseonate any browser or device.
Defaults to one of the most common desktop user agents: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3264.0 Safari/537.36.
client_print_css Force the use of print CSS styles if supplied by the site when rendering the page for export in our remote environment.
  • 1 = Render with the standard CSS (`media`)
  • 2 = Emulate the print environment (screenshot what you would see on a printed paper, `print`)
Defaults to 2 (using printer friendly CSS styles).
client_landscape Specify the orientation of the page.
  • 1 = Render in portrait mode
  • 2 = Render in landscape mode
Defaults to 1 (delivering the export in portrait mode).
inject_css Supply Base64 encoded custom CSS styles to be evaluated inline on the document. We recommend that you set a `capture_timeout` (e.g. 1000ms) to allow the new CSS to be rendered.
No Default.
inject_js Supply Base64 encoded custom JavaScript styles to be evaluated inline on the document.
No Default.
capture_force_lazy_load Some webpages only load images when the portion of the page scrolls into view. This can cause issues when taking full page screenshots. Force the loading of such lazy loaded images before capturing the full-page screenshot.
  • 1 = Capture naturally
  • 2 = Force-load lazy loaded images
Defaults to 1 (capture natural page).
capture_timeout The amount of time expressed in seconds to wait before the screenshot is taken after the page and all elements have been loaded, specified in milliseconds - 1 second = 1000 milliseconds.
Defaults to 500 milliseconds (0.5 seconds).
capture_close_cookie_notice Attempt to automatically close the visual blight caused by the EU mandated cookie notices, prior to exporting the rendered page. Cookie notice closing is offered on a best effort basis with no guarantee of functionality.
  • 1 = Do not Attempt to close/accept cookie notices
  • 2 = Attempt to close/accept cookie notices
Defaults to 1 (not closing cookie notices).
capture_export_format Specify the output PDF file diemnions using pre-set sizes conforming to common size standards - such as A4. When set, this option will override the other width and hight paramters or client device emulation.
Only supply string values from the list below.
  • 'Letter' - 8.5in x 11in
  • 'Legal' - 8.5in x 14in
  • 'Tabloid' - 11in x 17in
  • 'Ledger' - 17in x 11in
  • 'A0' - 33.1in x 46.8in
  • 'A1' - 23.4in x 33.1in
  • 'A2' - 16.5in x 23.4in
  • 'A3' - 11.7in x 16.5in
  • 'A4' - 8.27in x 11.7in
  • 'A5' - 5.83in x 8.27in
  • 'A6' - 4.13in x 5.83in
Defaults to 1 (not closing cookie notices).
capture_template_header A template created using HTML to be rendered and displayed as a header on each page. This string can contain only valid HTML mark-up and CSS styles specified using the standard <style> tag. Images can be inserted into the template through the use of bas64 encoding. The entire template (markup, CSS, and any base64 images) must then be encoded using base64. When passing a header template, the `capture_margin_top` paramter must be set to a positive integer equal to the desired height of your header. If no top margin a default of 75px will be supplied to ensure the header template is visible. Make use of the following classes on span/div tags to inject/substitute dynamic values into them:
  • date - formatted print date
  • title - document title
  • url - document location
  • pageNumber - current page number
  • totalPages - total pages in the document

Example markup string:

                                                         
<style>
.header { font-family: "Segoe UI", Arial, sans-serif; width: 100%; text-align: center; font-size:16px; padding-bottom:10px}

.border-bottom { border-bottom: 1pt solid #eeeeee; }
</style>
<div class="border-bottom header">
	Page <span class="pageNumber"></span> / <span class="totalPages"></span>
</div>
                                                         

Defaults to no header template
capture_template_footer A template created using HTML to be rendered and displayed as a footer on each page. This string can contain only valid HTML mark-up and CSS styles specified using the standard <style> tag. Images can be inserted into the template through the use of bas64 encoding. The entire template (markup, CSS, and any base64 images) must then be encoded using base64. When passing a footer template, the `capture_margin_bottom` paramter must be set to a positive integer equal to the desired height of your footer. If no top margin a default of 75px will be supplied to ensure the footer template is visible. Make use of the following classes on span/div tags to inject/substitute dynamic values into them:
  • date - formatted print date
  • title - document title
  • url - document location
  • pageNumber - current page number
  • totalPages - total pages in the document

Example markup string:

                                                         
<style>
.header { font-family: "Segoe UI", Arial, sans-serif; width: 100%; text-align: center; font-size:16px; padding-bottom:10px}

.border-bottom { border-bottom: 1pt solid #eeeeee; }
</style>
<div class="border-bottom header">
	Page <span class="pageNumber"></span> / <span class="totalPages"></span>
</div>
                                                         

Defaults to no header template
capture_margin_top Specifies the amount of margin/padding on the top of the document. Pass the value in the format {<integer><unit>}, examples for all possible units:
  • 50px - (pixels)
  • 3in - (inches)
  • 5cm - (centimeter)
  • 50mm - (millimeter)
Defaults to 0px
capture_margin_right Specifies the amount of margin/padding to the right of the document. Pass the value in the format {<integer><unit>}, examples for all possible units:
  • 50px - (pixels)
  • 3in - (inches)
  • 5cm - (centimeter)
  • 50mm - (millimeter)
Defaults to 0px
capture_margin_bottom Specifies the amount of margin/padding at the bottom of the document. Pass the value in the format {<integer><unit>}, examples for all possible units:
  • 50px - (pixels)
  • 3in - (inches)
  • 5cm - (centimeter)
  • 50mm - (millimeter)
Defaults to 0px
capture_margin_left Specifies the amount of margin/padding to the left of the document. Pass the value in the format {<integer><unit>}, examples for all possible units:
  • 50px - (pixels)
  • 3in - (inches)
  • 5cm - (centimeter)
  • 50mm - (millimeter)
Defaults to 0px
custom_http_header Pass the custom header you would like the rendering client to send to the target server. This value should be supplied as a string in the format "Header: value".
No Default.
custom_location_lat Specify a custom location defined by latitude and longitude to be reported by the rendering environments HTML5 geolocation API.
No Default.
custom_location_long Specify a custom location defined by latitude and longitude to be reported by the rendering environments HTML5 geolocation API.
No Default.

URL to PDF API

This end-point performs a render and screencapture of your supplied URL and supplies the result in your requested format, PNG or JPEG.

Request

https://api.cloudbrowser.co/v1/pdf?source=http://example.com&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/pdf?source=http://example.com&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/pdf?source=http://example.com&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/pdf?source=http://example.com&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/pdf?source=http://example.com&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/pdf?source=http://example.com&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/pdf?source=http://example.com&key=YOUR_KEY_HERE
Succesful Response Body (return_type=1)
{
   "base64": "iVBORw0KGgoAAAANSUhEUgAABLAAAAMgCAYAAAAz4JsCAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAAIABJREFUeJzs3Xl4FFXa9/FfJ4QkhCxCgIAigUDYZVM2BUUIguOoIKKyM0IEZGdYnBEYotFHBYQBUUFAGYwCj4OIgAqKKEscmQFGEBBCAAEF2RKUkJDlcMnabp6qS60yFF+vu5Li7N6VOn7rNUpftOVbXt4sX0PAEAAAAAAAAW5VfaAQAAAAAAAACFIYEFAA ... ACANAELAAAAgDQBCwAAAIA0AQsAAACANAELAAAAgDQBCwAAAIC0/wBqRycyXwTWgAAAAABJRU5ErkJggg==",
   "prefix": "data:application/pdf;base64,"
}
Succesful Response Body (return_type=2)
{
   "location": "https://cdn.cloudbrowser.co/doc/fb2d8374e071e2e877cad.pdf"
}

HTML to PDF API

This end-point performs a render and screencapture of your supplied HTML, pulling all neccesary Javascript and CSS. The API then supplies the result in your requested format, PNG or JPEG.

Request

https://api.cloudbrowser.co/v1/pdf?source=gICAgICAgICAgcWMuYXN5bmICAgICAMgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICBxYy5zcmMgICAgICAgICA...ICA8L2JvZHk+DQogICAgPC9odG1sPcWMuYXN5bmICAgIg0K&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/pdf?source=gICAgICAgICAgcWMuYXN5bmICAgICAMgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICBxYy5zcmMgICAgICAgICA...ICA8L2JvZHk+DQogICAgPC9odG1sPcWMuYXN5bmICAgIg0K&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/pdf?source=gICAgICAgICAgcWMuYXN5bmICAgICAMgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICBxYy5zcmMgICAgICAgICA...ICA8L2JvZHk+DQogICAgPC9odG1sPcWMuYXN5bmICAgIg0K&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/pdf?source=gICAgICAgICAgcWMuYXN5bmICAgICAMgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICBxYy5zcmMgICAgICAgICA...ICA8L2JvZHk+DQogICAgPC9odG1sPcWMuYXN5bmICAgIg0K&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/pdf?source=gICAgICAgICAgcWMuYXN5bmICAgICAMgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICBxYy5zcmMgICAgICAgICA...ICA8L2JvZHk+DQogICAgPC9odG1sPcWMuYXN5bmICAgIg0K&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/pdf?source=gICAgICAgICAgcWMuYXN5bmICAgICAMgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICBxYy5zcmMgICAgICAgICA...ICA8L2JvZHk+DQogICAgPC9odG1sPcWMuYXN5bmICAgIg0K&key=YOUR_KEY_HERE
https://api.cloudbrowser.co/v1/pdf?source=gICAgICAgICAgcWMuYXN5bmICAgICAMgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICBxYy5zcmMgICAgICAgICA...ICA8L2JvZHk+DQogICAgPC9odG1sPcWMuYXN5bmICAgIg0K&key=YOUR_KEY_HERE
Succesful Response Body (return_type=1)
{
   "base64": "iVBORw0KGgoAAAANSUhEUgAABLAAAAMgCAYAAAAz4JsCAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAAIABJREFUeJzs3Xl4FFXa9/FfJ4QkhCxCgIAigUDYZVM2BUUIguOoIKKyM0IEZGdYnBEYotFHBYQBUUFAGYwCj4OIgAqKKEscmQFGEBBCAAEF2RKUkJDlcMnabp6qS60yFF+vu5Li7N6VOn7rNUpftOVbXt4sX0PAEAAAAAAAAW5VfaAQAAAAAAAACFIYEFAA ... ACANAELAAAAgDQBCwAAAIA0AQsAAACANAELAAAAgDQBCwAAAIC0/wBqRycyXwTWgAAAAABJRU5ErkJggg==",
   "prefix": "data:application/pdf;base64,"
}
Succesful Response Body (return_type=2)
{
   "location": "https://cdn.cloudbrowser.co/doc/fb2d8374e071e2e877cad.pdf"
}