How to save Browshot screenshots as PNG or JPEG
Save Browshot screenshots locally as PNG, or use its documented thumbnail, batch, and crawl options when you need JPEG output.
Browshot’s simple API documents its screenshot response as PNG. To save it locally, follow redirects and write the response to a file:
curl -L "https://api.browshot.com/api/v1/simple?url=https://example.com/&key=YOUR_API_KEY" -o screenshot.png
For JPEG, first identify the endpoint you are using. Browshot documents format=jpeg for screenshot thumbnails, and also documents PNG or JPEG format choices for batch and crawl outputs. The thumbnail endpoint defaults to PNG. Do not assume the same format parameter works on every way of retrieving a screenshot. See Browshot’s API documentation and its curl guide.
1. Save a simple API screenshot as PNG
The simple API is the direct route for a single screenshot. Its documented response is PNG. Use -L so curl follows redirects and -o to choose the local filename.
curl -L "https://api.browshot.com/api/v1/simple?url=https://example.com/&key=YOUR_API_KEY" -o screenshot.png
Replace YOUR_API_KEY and the target URL with your own values. Keep the API key private; avoid committing it to source control or sharing a command containing the real key.
The curl guide also shows parameters such as size=page and width for full-page or thumbnail requests. Use the parameters supported by the specific endpoint you call, and consult the API documentation for their exact behavior.
2. Get JPEG using the thumbnail endpoint
For the complete screenshot API workflow, create a screenshot, then request a thumbnail by screenshot ID. The thumbnail documentation accepts format=jpeg or format=png; PNG is the default. JPEG thumbnails can also use quality from 1 to 100. That quality setting is documented for JPEG thumbnails only, not PNG.
The exact request URL and required parameters depend on the API operation and screenshot ID. Follow the endpoint path and authentication format in Browshot’s documentation, adding the supported format parameter to the thumbnail request. Save the returned JPEG data with a .jpg or .jpeg extension, and PNG data with .png.
Do not append format=jpeg to the simple API URL and assume it changes that endpoint’s response. The documented JPEG choice described here belongs to thumbnail retrieval; batch and crawl operations document their own format option.
3. Choose the route that matches the job
| Use case | Documented route | Format notes |
|---|---|---|
| One screenshot, saved locally | Simple API with curl -L and -o |
Documented response is PNG |
| Screenshot thumbnail | Create screenshot, then request thumbnail by ID | PNG or JPEG; defaults to PNG. JPEG supports documented quality 1–100. |
| Batch or crawl output | Batch or crawl API workflow | Documentation exposes PNG or JPEG format choice. |
| Service-side storage | Supported S3 or Browshot hosting | S3 requires a bucket; a filename is optional. |
If your application needs a local file, write the response bytes to disk. If you want service-side hosting, use a supported hosting option described in the API documentation. For S3, configure a bucket; the documentation says a filename may also be supplied.
4. Save the response with Python
This example requests the documented simple endpoint and writes the response body to a PNG file. It follows redirects and checks for an HTTP error before writing.
import os
import requests
api_key = os.environ["BROWSHOT_API_KEY"]
params = {
"url": "https://example.com/",
"key": api_key,
}
response = requests.get(
"https://api.browshot.com/api/v1/simple",
params=params,
allow_redirects=True,
timeout=90,
)
response.raise_for_status()
with open("screenshot.png", "wb") as image_file:
image_file.write(response.content)
Set the key in the environment before running, for example with export BROWSHOT_API_KEY='YOUR_API_KEY' in a shell. For thumbnail JPEG output, use the documented thumbnail operation and its format=jpeg parameter, then write those response bytes to a filename ending in .jpg. Keep the thumbnail’s documented quality parameter limited to JPEG.
5. Save the response with Node.js
This Node.js example uses built-in fetch, follows redirects by default, and writes the simple API response as PNG.
const fs = require('node:fs/promises');
async function main() {
const apiKey = process.env.BROWSHOT_API_KEY;
if (!apiKey) throw new Error('Set BROWSHOT_API_KEY first');
const url = new URL('https://api.browshot.com/api/v1/simple');
url.searchParams.set('url', 'https://example.com/');
url.searchParams.set('key', apiKey);
const response = await fetch(url);
if (!response.ok) {
throw new Error(`Browshot returned HTTP ${response.status}`);
}
const image = Buffer.from(await response.arrayBuffer());
await fs.writeFile('screenshot.png', image);
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
For JPEG, make the documented thumbnail request by screenshot ID with format=jpeg, then write its response bytes to a .jpg file. Do not use a PNG extension for JPEG data or assume the simple endpoint accepts the thumbnail format parameter.
6. Common problems and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| The saved file is an error response or redirect page | The request did not follow a redirect, or the API returned an error body. | With curl, include -L. In code, check the HTTP status before saving response bytes. |
| JPEG was expected but the file is PNG | The simple API response is documented as PNG, or the request used a route without the documented JPEG option. | Use the thumbnail workflow with format=jpeg, or the format option documented for batch/crawl output. |
| The image viewer cannot open the saved file | The extension may not match the returned format, or an API error body was written as an image. | Check the request’s endpoint and response status; use an extension matching the requested output. |
| A quality value has no effect | quality is documented for JPEG thumbnails only. |
Use it on a JPEG thumbnail request. It is not a PNG quality control. |
| The key appears in logs or shell history | The key was embedded in a command or URL. | Use an environment variable in scripts and restrict access to logs and shell history. Rotate a key if it has been exposed. |
7. Performance, reliability, and cost considerations
- Choose output by endpoint. The available format controls differ between simple screenshots, thumbnails, and batch/crawl outputs. Confirm the endpoint’s documented parameters before building a download flow.
- Handle failures before writing. Check HTTP status in scripts so an error response is not silently stored with an image extension. For curl workflows, inspect the result when a request fails rather than treating every downloaded body as an image.
- Use batch or crawl workflows for multiple pages. Browshot documents format choices for these workflows; use their API documentation for the relevant request structure.
- Decide where files should live. Local saving gives your program the response bytes. Browshot also documents S3 or Browshot hosting; S3 requires a bucket, with an optional filename.
- Avoid unsupported size assumptions. The reviewed documentation does not provide measured PNG-versus-JPEG file sizes or visual-quality comparisons. Choose based on your downstream format requirement and use the documented JPEG quality control when applicable.
8. Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server. One GET request returns an image or PDF, and its format and capture options are documented in the ScreenshotNeo docs.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture. Bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000.
Sign up free for 1,000 screenshots a month, with no card required.
FAQ
Can I save the simple API result directly as JPEG?
The reviewed documentation describes the simple API screenshot response as PNG. The documented JPEG option applies to thumbnails and to batch/crawl outputs.
What is the default thumbnail format?
PNG. Specify format=jpeg when requesting a JPEG thumbnail.
Does JPEG quality apply to PNG?
No. Browshot documents a 1–100 quality parameter for JPEG thumbnails only.
Can Browshot host the output instead of returning it for local saving?
The API documentation describes S3 and Browshot hosting options. For S3, a bucket is required and a filename is optional.


