How to Capture Screenshots in Bulk with LambdaTest
Use LambdaTest’s screenshot API to capture a URL across browser configurations, track results by test ID, and download the screenshot archive.
To capture screenshots in bulk with LambdaTest, send an authenticated POST request to its screenshot API with the target URL and a configs object describing the browser and device combinations. Save the returned test_id, use it to retrieve screenshot status and metadata, then request the ZIP archive when it is ready.
The current documentation is branded TestMu AI (formerly LambdaTest), while the API examples retain LambdaTest hostnames. Check the live documentation and your account for available browser configurations and limits: the API schema alone does not establish what your account can run.
1. Choose the right bulk screenshot workflow
There are two related workflows. Use URL capture when the service should load the page and take screenshots across a browser or device matrix. Use SmartUI upload when you already have local image files and want to bring them into a visual regression build.
| Workflow | Input | Use it for | Next step |
|---|---|---|---|
| Screenshot API capture | URL and browser/device configuration | Capturing a live page across configurations | Save the test ID, inspect details, and retrieve the ZIP |
| SmartUI screenshot upload | Local PNG, JPEG, or JPG files and a project token | Adding screenshots already captured elsewhere to a visual regression build | Review the resulting build in SmartUI |
These are not interchangeable: the screenshot API loads a URL, while the upload route starts with image files. The documented SmartUI guide says the build name and baseline flag are optional.
2. Prepare your URL and configuration matrix
Before making the request, decide which browser/device configurations you need and confirm they are currently available to your account. Keep the matrix focused: every additional configuration increases the number of captures and the amount of output to review.
The documented start request includes a URL and a configs object. Optional request fields include deferred capture time, email notification, resolutions, tunnel settings, username/password, and a callback URL. Consult the current API reference for the exact structure and accepted values; examples in API documentation may show legacy browser versions and should not be treated as a current support list.
- Public pages: provide the public URL and required browser configurations.
- Authenticated pages: review the current authentication instructions. The schema includes username and password fields, but filling them in does not guarantee access for every login flow.
- Local or private pages: consult current tunnel instructions and confirm network access from the capture environment. A tunnel field alone does not guarantee that a particular site configuration is reachable.
- Timing-sensitive pages: use documented capture timing options where appropriate, then inspect the returned status and images for completeness.
- Callbacks and notifications: use a callback URL or email option only after confirming the current behavior and requirements in the API reference.
Store API credentials in environment variables or a secrets manager. Do not commit them to source control, print them in logs, or include them in error reports.
3. Start a screenshot test with cURL
Send the request to the screenshot start endpoint documented by LambdaTest. The example below shows the request shape; replace the placeholder with the current documented configuration object for the browsers and devices you need.
curl --request POST \
--url https://api.lambdatest.com/screenshots/v1 \
--user "$LT_USERNAME:$LT_ACCESS_KEY" \
--header 'Content-Type: application/json' \
--data '{
"url": "https://example.com",
"configs": []
}'
Check the current API reference for the precise endpoint, authentication method, and configs schema before running this request. The research source documents an authenticated POST with a URL and configuration object; it does not establish current account entitlements or the full configuration matrix.
On a successful start, retain the returned test_id. A test ID means there is a follow-up handle; it does not by itself prove every screenshot succeeded.
4. Start a test with Python
This example sends the same kind of request and leaves the configuration list empty as a placeholder. Fill it with entries in the format accepted by the current API documentation.
import os
import requests
username = os.environ["LT_USERNAME"]
access_key = os.environ["LT_ACCESS_KEY"]
payload = {
"url": "https://example.com",
"configs": [],
}
response = requests.post(
"https://api.lambdatest.com/screenshots/v1",
auth=(username, access_key),
json=payload,
timeout=60,
)
response.raise_for_status()
result = response.json()
print(result)
# Save the test_id from the response for the details and ZIP requests.
test_id = result["test_id"]
Use a bounded timeout and handle HTTP errors explicitly. In a production job, persist the test ID to your job record or durable storage so a worker restart does not lose the ability to fetch results.
5. Start a test with Node.js
This Node.js example uses built-in fetch. Set credentials in the environment and adjust the endpoint and request shape to match the current API documentation for your account.
const username = process.env.LT_USERNAME;
const accessKey = process.env.LT_ACCESS_KEY;
if (!username || !accessKey) {
throw new Error('Set LT_USERNAME and LT_ACCESS_KEY');
}
const auth = Buffer.from(`${username}:${accessKey}`).toString('base64');
const response = await fetch('https://api.lambdatest.com/screenshots/v1', {
method: 'POST',
headers: {
Authorization: `Basic ${auth}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: 'https://example.com',
configs: [],
}),
});
if (!response.ok) {
throw new Error(`Screenshot request failed: ${response.status} ${await response.text()}`);
}
const result = await response.json();
console.log(result);
const testId = result.test_id;
6. Retrieve details and download the screenshot collection
Use the returned test ID with the documented screenshot details endpoint. The details response can include status and screenshot metadata such as operating system, browser/version, resolution, and screenshot URLs. Inspect status and metadata before treating the run as complete.
# Replace TEST_ID and credentials. Confirm the current route and auth format in the API reference.
curl --user "$LT_USERNAME:$LT_ACCESS_KEY" \
"https://api.lambdatest.com/screenshots/v1/TEST_ID"
When the collection is ready, use the documented ZIP endpoint for that test ID to obtain the archive URL. The API documentation provides a ZIP retrieval route; follow the returned URL to download the archive according to the current response format.
# Request the archive link for the test. Confirm the exact documented path for your API version.
curl --user "$LT_USERNAME:$LT_ACCESS_KEY" \
"https://api.lambdatest.com/screenshots/v1/TEST_ID/zip"
Do not assume the details or archive routes are complete solely from these illustrative paths. Confirm the exact route and response fields in the current API reference, then handle pending, failed, and completed states in your job.
7. Upload existing screenshots to SmartUI
If the images were captured locally, use the SmartUI upload workflow instead of starting a URL screenshot test. Its documented upload API builds from image files and a project token; the supported formats listed in the guide are PNG, JPEG, and JPG. A build name and baseline flag are optional. Use the SmartUI guide for the current endpoint, multipart form fields, and token handling.
This path is useful when a separate browser automation system already produced the images. Upload creates a visual regression build; it does not ask LambdaTest to visit the original URL and capture it across configurations.
8. Handle private pages and sensitive data
For pages behind login or reachable only on a private network, first confirm that your access pattern is supported by the current instructions. The start schema includes tunnel and username/password fields, but site-specific authentication, redirects, multifactor challenges, and network rules may still prevent a successful capture.
- Use a dedicated test account with the minimum access required.
- Keep passwords, access keys, cookies, and authorization values out of source control and logs.
- Avoid capturing pages containing real customer or personal data when a sanitized test page will work.
- Check callback destinations and result storage access controls before sending capture metadata outside your environment.
- Inspect screenshots for accidental exposure of secrets, account details, or internal content before sharing them.
9. Reliability, performance, and cost considerations
Make bulk jobs recoverable
- Persist each test ID as soon as the start request succeeds.
- Track the submitted URL and configuration matrix alongside the ID so results remain attributable.
- Fetch details and verify each expected configuration before marking the job complete.
- Make result retrieval safe to retry, and distinguish a transient API/network error from a completed capture failure.
- Use callbacks or notifications only when their documented behavior fits your job; otherwise poll details with a sensible interval and a maximum wait.
Keep runs manageable
Start with the smallest browser/device matrix that answers the compatibility question. A broad matrix creates more captures, larger archives, and more review work. Page load complexity, authentication, and deferred capture timing can also affect how long a run takes; the reviewed material does not establish a current runtime guarantee.
Check current account limits and pricing
The available research does not establish current pricing, plan limits, request quotas, or complete browser/device coverage. Verify these in the live product and account before designing a recurring or high-volume capture schedule. Do not use historical counts or timing claims from older LambdaTest blog material as current guarantees.
10. Troubleshooting
| Symptom | Likely cause | What to do |
|---|---|---|
| Authentication failure | Missing, incorrect, or expired credentials; wrong authentication format | Check the current API authentication instructions and environment variables. Rotate exposed credentials and keep them out of logs. |
| The request is rejected | Malformed JSON, missing URL, or a configs structure that does not match the current schema |
Validate the payload against the live API reference and begin with one known available configuration. |
| A test ID was returned but images are missing | The test is still running or one or more configurations failed | Fetch test details, inspect status and per-screenshot metadata, and wait or investigate the failed configuration. |
| The page shows a login screen or access denied | Authentication flow or site access is not supported by the supplied credentials or capture setup | Review current login and tunnel guidance, use an appropriate test account, and verify the page is reachable from the configured environment. |
| A local page cannot be reached | Tunnel configuration or network access is incomplete | Follow the current tunnel setup instructions and confirm the target host and port are exposed as required. |
| The screenshot is incomplete or captured too early | Page rendering or asynchronous content had not settled at capture time | Use a documented timing option where available, and inspect the resulting screenshot rather than assuming a successful HTTP response means a complete page. |
| Details or ZIP retrieval fails | Wrong test ID, incorrect route, pending run, or changed API response format | Confirm the ID and current endpoint paths in the API reference, inspect the test status, and retry retrieval when appropriate. |
| SmartUI rejects image uploads | Unsupported format, invalid project token, or incorrect upload request shape | Use PNG, JPEG, or JPG and check the current upload guide for token and request requirements. |
11. Or skip the browser setup
ScreenshotNeo captures a URL with one GET request and returns an image or PDF. Its API also works with parameter names used by other screenshot APIs. See the ScreenshotNeo API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
- Cookie banners, newsletter popups, and chat widgets are removed before the screenshot, and each cleanup step can be turned off.
- Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed; response headers report the page verdict and billing status.
- An MCP server gives AI agents tools to take screenshots, get page information, and capture PDFs.
- The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.
Create a free ScreenshotNeo account to get 1,000 screenshots a month with no card.
Frequently asked questions
Does a returned test ID mean every screenshot succeeded?
No. Use the details endpoint to inspect status and per-screenshot metadata, then confirm the expected configurations are present.
Can I use SmartUI upload to capture a page from its URL?
The documented upload path starts with existing image files. Use the screenshot API when the service needs to load and capture a URL.
Are old browser versions in examples supported today?
Not necessarily. Treat API examples as schema illustrations and check the current configuration list in the documentation or your account.


