How to Use the Screenshotlayer API to Capture a Webpage
Build a Screenshotlayer capture request, configure its viewport and output, handle errors and quotas, and compare it with a simpler screenshot API workflow.
To capture a webpage with Screenshotlayer, send a request to /api/capture with your account access_key and a target url that includes its protocol, such as https://. Add optional parameters such as viewport, fullpage, or format to control the capture. Screenshotlayer documents http://api.screenshotlayer.com/api/capture as its base endpoint; use its HTTPS endpoint only if your plan supports it. Check the current documentation for response behavior before building code that assumes a particular body format.
1. Get an access key and choose the endpoint
Find your access_key in your Screenshotlayer account dashboard. Treat it as a secret: store it in an environment variable or secret manager, and do not commit it to source control or expose it in browser-side code.
The documented base endpoint is http://api.screenshotlayer.com/api/capture. The vendor says paid customers may use HTTPS; confirm that your plan allows it and check the current documentation before relying on HTTPS. The target page URL must also include its protocol.
2. Make a basic capture request
Here is the documented request shape with a placeholder key and URL-encoded target. The parameters are access_key and url:
https://api.screenshotlayer.com/api/capture?access_key=YOUR_ACCESS_KEY&url=https%3A%2F%2Fexample.com
Use the cURL, Python, or Node.js example that fits your application. The examples request the documented PNG default; the response handling is intentionally conservative because the reviewed materials do not establish one universal response-body format. Consult Screenshotlayer’s current interactive documentation for the response behavior and content type associated with your account and request.
cURL
curl --get 'http://api.screenshotlayer.com/api/capture' \
--data-urlencode 'access_key=YOUR_ACCESS_KEY' \
--data-urlencode 'url=https://example.com' \
--data-urlencode 'viewport=1440x900' \
--output screenshot.png
Use --data-urlencode so query values containing characters such as &, ?, or spaces are encoded correctly. The output filename should match the format you request or the format returned by the API.
Python
import os
import requests
endpoint = "http://api.screenshotlayer.com/api/capture"
params = {
"access_key": os.environ["SCREENSHOTLAYER_ACCESS_KEY"],
"url": "https://example.com",
"viewport": "1440x900",
}
response = requests.get(endpoint, params=params, timeout=90)
response.raise_for_status()
content_type = response.headers.get("Content-Type", "")
if not content_type.startswith("image/"):
raise RuntimeError(
f"Expected image response; got Content-Type {content_type!r}. "
"Check Screenshotlayer's current response documentation."
)
with open("screenshot.png", "wb") as image_file:
image_file.write(response.content)
Install the dependency with python -m pip install requests. Set SCREENSHOTLAYER_ACCESS_KEY in the environment before running the script. Confirm the expected response content type in the current API docs; if the API returns a different format or response shape for your request, adapt the check and file handling.
Node.js
const endpoint = new URL('http://api.screenshotlayer.com/api/capture');
endpoint.searchParams.set('access_key', process.env.SCREENSHOTLAYER_ACCESS_KEY);
endpoint.searchParams.set('url', 'https://example.com');
endpoint.searchParams.set('viewport', '1440x900');
if (!process.env.SCREENSHOTLAYER_ACCESS_KEY) {
throw new Error('Set SCREENSHOTLAYER_ACCESS_KEY before running this script.');
}
const response = await fetch(endpoint);
if (!response.ok) {
throw new Error(`Screenshotlayer returned HTTP ${response.status}`);
}
const contentType = response.headers.get('content-type') || '';
if (!contentType.startsWith('image/')) {
throw new Error(
`Expected an image response; got Content-Type ${contentType}. ` +
`Check Screenshotlayer's current response documentation.`
);
}
const image = Buffer.from(await response.arrayBuffer());
await import('node:fs/promises').then(({ writeFile }) =>
writeFile('screenshot.png', image)
);
This uses the built-in fetch available in modern Node.js. As with Python, verify the response format against the current docs and adjust the content-type handling and filename when necessary.
3. Set the capture options
Pass optional settings as query parameters. These are the documented options relevant to viewport, page length, output, timing, caching, request identity, and export.
| Parameter | What it does | When to use it |
|---|---|---|
viewport |
Sets the browser viewport dimensions in pixels. The documented default is 1440x900. |
Choose a consistent desktop or mobile-sized viewport for repeatable captures. The homepage illustrates desktop and mobile examples. |
fullpage=1 |
Requests a full-height capture. | Use when the screenshot must include content below the initial viewport. Full-page captures may take longer or produce larger images than viewport captures. |
width |
Sets thumbnail width in pixels. | Use when you need a thumbnail-sized result rather than a full-size capture. |
format |
Selects output image format. PNG is the documented default. The pricing page lists PNG, JPEG, and GIF, and advertises WebP on paid plans. | Pick a format supported by your plan and downstream use. Check current plan terms before depending on WebP. |
delay |
Waits before the capture. | Try a delay if the page populates content after initial navigation. The reviewed docs do not specify a guaranteed delay range. |
ttl |
Sets cache lifetime in seconds. The listed default is 2,592,000 seconds (30 days). | Choose a shorter lifetime when pages change often, or a longer one when cached results are acceptable. Confirm current cache semantics in the docs. |
force |
Requests a fresh capture rather than reusing a cached snapshot. | Use when you need a current image even if a cached result may exist. Verify the accepted values in current documentation. |
css_url |
Supplies a custom stylesheet URL. | Use to adjust page styling for a capture, provided the stylesheet can be fetched by the service. |
user_agent |
Sets the request user agent. | Use when you need a mobile-style or otherwise specific page variant. The official homepage shows a mobile user-agent example. |
accept_lang |
Sets the accepted language for the request. | Use when the site localizes content based on language headers. |
export |
Configures export destinations such as FTP or S3. | Use only after confirming destination configuration and plan availability in the current docs and account. |
Example: full-page image with a mobile viewport
Combine options by adding them to the same request. This example asks for a full-height capture at a narrower viewport; the dimensions are illustrative, so choose values that suit your target layout.
curl --get 'http://api.screenshotlayer.com/api/capture' \
--data-urlencode 'access_key=YOUR_ACCESS_KEY' \
--data-urlencode 'url=https://example.com' \
--data-urlencode 'viewport=390x844' \
--data-urlencode 'fullpage=1' \
--output mobile-fullpage.png
4. Understand image responses and save them safely
Screenshotlayer describes captures as images and documents PNG as the default, with other formats listed in its pricing materials. The reviewed source material does not establish a single response-body contract for every request. Do not assume the response is JSON, a URL, or always a PNG without checking the current interactive documentation.
For a reliable integration, inspect the HTTP status, response headers, and body on a successful request. Save the body as binary data only when the response content type matches the image format you expect. If your account or selected export mode returns a different response shape, follow the current API specification for that mode.
5. Troubleshoot common errors
| Symptom or error | Likely cause | What to check |
|---|---|---|
| Missing or invalid access key | The key is absent, mistyped, revoked, or not being sent under the documented parameter name. | Confirm the dashboard key and ensure the request includes access_key. Keep it out of logs and public code. |
| Invalid URL | The target is malformed or lacks its protocol. | Use a complete URL such as https://example.com, then URL-encode it through your HTTP client. |
| Invalid API function | The request path or function name does not match the documented capture endpoint. | Check that the path is /api/capture and compare the full endpoint with current docs. |
| Monthly request allowance reached | The account has used its current plan allocation. | Review usage in the account dashboard and confirm the active plan’s quota and overage terms. |
| Unexpected or unreadable output file | The response may be an error body or a different response type rather than image bytes. | Check HTTP status and Content-Type before writing the response to an image file. |
| Capture shows an incomplete page | Content may load after the capture begins, or the requested viewport may not expose the full page. | Try delay for late-rendering content or fullpage=1 for page height. The source material does not define a guaranteed wait range. |
The FAQ says Screenshotlayer notifies account holders at 75%, 90%, and 100% of quota and that overage fees apply after the limit. Check your account’s current billing terms; plan limits and overage rules can change.
6. Plan for performance, reliability, and cost
Performance and concurrency
Screenshotlayer’s pricing page describes dedicated workers as capacity for concurrent captures: a plan’s worker count permits that many simultaneous screenshot tasks. This is the vendor’s description, not an independent performance benchmark. If you capture many pages, queue work to match the capacity in your plan and avoid launching a large burst without checking its limits.
Full-page captures and pages that need extra delay can take more time than a basic viewport capture. Keep your client timeout appropriate for the pages you process, and record status and response headers so you can distinguish failed requests from valid image results.
Cache behavior
The documented default ttl is 30 days. A long TTL can reduce repeated capture work when a page is unchanged, while a short TTL or force is more suitable when freshness matters. Confirm how the service keys and refreshes its cache before using it for strict freshness requirements.
Plan and quota checks
At the time of the research review (October 3, 2026), Screenshotlayer’s official pricing page advertised Free at 100 monthly snapshots, Basic at $19.99 per month for 10,000, Professional at $59.99 per month for 30,000, and Enterprise at $149.99 per month for 75,000. The page also said overages may apply and that pricing depends on request volume, supported features, and dedicated workers. These are time-sensitive vendor listings; verify the current pricing page and account dashboard before choosing a plan or budgeting usage.
7. Alternatives for a simpler capture workflow
If you are evaluating screenshot services, ScreenshotNeo is the first alternative to try: it removes consent banners, newsletter popups, and chat widgets before capture, bills only clean shots, and its paid plans start at $5 for 3,000 screenshots.
ScreenshotNeo is a website screenshot API and MCP server for developers. Its API accepts a URL in one GET request and can return PNG, JPEG, WebP, or PDF. See the ScreenshotNeo API documentation for request options and setup.
Or skip the browser setup
Send one GET request with the target URL. This cURL example captures the same sample page used above:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
ScreenshotNeo removes cookie banners, popups, and chat widgets before the shot. Bot checks, blank pages, and failed loads are never billed. An MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for free and capture your first 1,000 screenshots a month without a card.
Frequently asked questions
Can I use Screenshotlayer with a URL that has no protocol?
No. Its specification says the target URL must include its HTTP protocol. Use a complete address such as https://example.com.
Does Screenshotlayer return an image URL or image bytes?
The reviewed materials do not define one universal response-body description. Check the current interactive API documentation and inspect the response headers for your request.
How do I get a fresh screenshot instead of a cached one?
The specification lists force for requesting a fresh capture and ttl for cache lifetime. Check current docs for accepted values and cache behavior.
Does the API support exporting captures?
The specification and product page describe export options such as FTP or S3, with availability depending on plan. Confirm setup requirements and eligibility in the current documentation.
Sources
- Screenshotlayer API documentation — endpoint and request parameters.
- Screenshotlayer product page — capture examples and product features.
- Screenshotlayer pricing — plan allowances, prices, and feature availability; check for current terms.
- Screenshotlayer FAQ — dashboard keys, quota notifications, and billing notes.


