Optimize the images on a website
optimize_websiteStart at one public web page, follow its links to the other pages on the same host, find every image they reference (img, srcset, picture, lazy-load attributes, inline CSS backgrounds, social images, icons), convert them to WebP and return a report: the pages scanned, each image's size before and after and the pages that use it, a download URL per image, zip_url for everything, and replacements mapping each original URL to its new file. To apply it to a codebase: download and unpack the ZIP, put the files from images/ next to the originals, then change each reference per replacements (or wrap it in a element with the WebP as and the original as the fallback). The free plan scans up to 5 pages and 100 images per call, Pro up to 50 pages and 500 images. A large site can take minutes: if the result is not ready the call returns a job_id to pass to get_website_report.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | Address to start from, e.g. https://example.com | |
| quality | No | WebP quality, default 80. | |
| max_pages | No | Scan at most this many pages. Default: the plan's limit. Use 1 for a single page. |