/chromium/export
POST/chromium/export
Exports a webpage to a PDF or image format. This API is useful for generating reports, screenshots, or PDFs of web pages.
Note: Also available at /export as a convenience alias.
Request
Query Parameters
Possible values: [datacenter, residential]
Possible values: [0, 1, false, true]
Possible values: [0, 1, false, true]
Body
- Schema
- JSON
- PuppeteerLifeCycleEvent[]
- string
- Array [
- ]
- object
- null
When bestAttempt is set to true, browserless will attempt to proceed when "awaited" events fail or timeout. This includes things like goto, waitForSelector, and more.
The URL of the site you want to archive.
gotoOptions object
An optional goto parameter object for considering when the page is done loading.
If provided, it will take preference over the referer header value set by {@link Page.setExtraHTTPHeaderspage.setExtraHTTPHeaders()}.
If provided, it will take preference over the referer-policy header value set by {@link Page.setExtraHTTPHeaderspage.setExtraHTTPHeaders()}.
Maximum wait time in milliseconds. Pass 0 to disable the timeout.
The default value can be changed by using the {@link Page.setDefaultTimeout} or {@link Page.setDefaultNavigationTimeout} methods.
waitUntil object
When to consider waiting succeeds. Given an array of event strings, waiting is considered to be successful after all events have been fired.
Possible values: [domcontentloaded, load, networkidle0, networkidle2]
signal object
A signal object that allows you to cancel the call.
onabort objectrequired
waitForEvent object
Options for waiting for a specific event to be fired on the page.
waitForFunction object
Options for waiting for a JavaScript function to execute.
The function, or statement, to be evaluated in browser context
An interval at which the pageFunction is executed, defaults to raf. If polling is a number, then it is treated as an interval in milliseconds at which the function would be executed. If polling is a string, then it can be one of the following values: "raf" or "mutation"
Maximum time to wait for in milliseconds. Defaults to 30000 (30 seconds). Pass 0 to disable timeout.
waitForSelector object
Options for waiting for a specific CSS selector to appear on the page.
The amount of time in milliseconds to wait before proceeding.
headers object
An object containing additional HTTP headers to send with every request.
Whether to include all linked resources (images, CSS, JS) in a zip file. When true, the response will be a zip file containing the HTML and all resources. When false or not provided, the response will be the raw content (default behavior).
{
"bestAttempt": true,
"url": "string",
"gotoOptions": {
"referer": "string",
"referrerPolicy": "string",
"timeout": 0,
"waitUntil": [
"domcontentloaded"
],
"signal": {
"aborted": true,
"onabort": {},
"reason": {}
}
},
"waitForEvent": {
"event": "string",
"timeout": 0
},
"waitForFunction": {
"fn": "string",
"polling": "string",
"timeout": 0
},
"waitForSelector": {
"hidden": true,
"selector": "string",
"timeout": 0,
"visible": true
},
"waitForTimeout": 0,
"headers": {},
"includeResources": true
}
Responses
- 200
- 400
- 401
- 403
- 404
- 408
- 429
- 500
- 503
Schema
- Fields
- Example (auto)
The HTML content of the page.
{
"html": "string"
}
The request contains errors or didn't properly encode content.
The request is missing, or contains bad, authorization credentials.
The request targets a destination that is not allowed.
Resource couldn't be found.
The request took has taken too long to process.
Too many requests are currently being processed.
An internal error occurred when handling the request.
Service is unavailable.