Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesTo authenticate with the LambdaTest Automated Screenshot API, retrieve your account username and access key from the automation dashboard, then send them using HTTP Basic authentication in a JSON POST request to https://api.lambdatest.com/screenshots/v1/. The API uses the access key as the Basic-auth password. A successful start request returns a test_id for identifying the screenshot test.
Get your LambdaTest username and access key
- Sign in to the LambdaTest automation dashboard.
- Find the key control near the help button and retrieve your username and access key. The setup guide also identifies the HubURL among the authentication credentials; the screenshot-start request described here is sent to the endpoint shown below.
- Keep the access key private. Do not place real credentials in code examples, public repositories, or shared logs.
LambdaTest documents the environment variable names LT_USERNAME and LT_ACCESS_KEY for command-line configuration. The setup guide includes shell commands for Linux/macOS and Windows: Automated Screenshot API setup guide.
Set credentials on Linux or macOS
export LT_USERNAME="your_username"
export LT_ACCESS_KEY="your_access_key"
Set credentials on Windows Command Prompt
set LT_USERNAME=your_username
set LT_ACCESS_KEY=your_access_key
For production applications, load secrets from the environment or a suitable secret store rather than committing them to source control.
Send an authenticated screenshot request
The start-test operation accepts a JSON POST at https://api.lambdatest.com/screenshots/v1/. Its Authorization header uses the scheme Basic followed by the base64 encoding of username:password; for this account-credential workflow, use the LambdaTest username and access key as the username and password values. The request body is JSON and can carry the URL, browser and operating-system configurations, resolutions, and other test options. See the Start Screenshot Test API reference.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11#1 Best Overall
cURL example
This example reads credentials from environment variables and constructs the Basic header without embedding a real key in the command. It requires a shell with base64.
AUTH="$(printf '%s' "$LT_USERNAME:$LT_ACCESS_KEY" | base64 | tr -d 'n')"
curl --request POST
--url 'https://api.lambdatest.com/screenshots/v1/'
--header "Authorization: Basic $AUTH"
--header 'Content-Type: application/json'
--data '{"url":"https://example.com","defer_time":0,"email":true,"configs":{}}'
On Windows PowerShell, set the variables in that session and form the header value with .NET:
Rank #2
- Used Book in Good Condition
$pair = "$env:LT_USERNAME`:$env:LT_ACCESS_KEY"
$encoded = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($pair))
$headers = @{ Authorization = "Basic $encoded" }
$body = '{"url":"https://example.com","defer_time":0,"email":true,"configs":{}}'
Invoke-RestMethod -Method Post `
-Uri 'https://api.lambdatest.com/screenshots/v1/' `
-Headers $headers `
-ContentType 'application/json' `
-Body $body
Python example
Install the HTTP client with python -m pip install requests, then run:
import os
import requests
username = os.environ["LT_USERNAME"]
access_key = os.environ["LT_ACCESS_KEY"]
response = requests.post(
"https://api.lambdatest.com/screenshots/v1/",
auth=(username, access_key),
headers={"Content-Type": "application/json"},
json={
"url": "https://example.com",
"defer_time": 0,
"email": True,
"configs": {},
},
timeout=90,
)
response.raise_for_status()
print(response.json())
With Requests, the auth=(username, access_key) argument generates HTTP Basic authentication. A successful start operation returns a test_id; retain it for subsequent retrieval or handling of that test.
Rank #3
Node.js example
This example uses the built-in fetch available in current Node.js releases. It creates the Basic header from environment variables and submits JSON.
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 first');
}
const authorization = Buffer.from(`${username}:${accessKey}`).toString('base64');
const response = await fetch('https://api.lambdatest.com/screenshots/v1/', {
method: 'POST',
headers: {
Authorization: `Basic ${authorization}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: 'https://example.com',
defer_time: 0,
email: true,
configs: {},
}),
});
const result = await response.json();
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${JSON.stringify(result)}`);
}
console.log(result);
Understand the response and errors
The start operation’s successful response includes a test_id. The API reference displays response examples for HTTP 200, 400, 401, and 403. It does not establish a definitive cause for each authorization error, so treat the status as a signal to inspect the request rather than proof of one specific credential problem.
Rank #4
- 200: The start operation succeeded; capture the returned
test_id. - 400: Check that the request body is valid JSON and includes the expected fields and supported values.
- 401 or 403: Recheck that the username and access key belong to the intended account, that the header uses Basic authentication, and that the request is sent to the documented endpoint.
Troubleshoot authentication and setup
401 or 403 response
- Confirm that
LT_USERNAMEandLT_ACCESS_KEYare set in the same shell or process that runs the request. - Check for accidental spaces, line breaks, or a copied placeholder in either value.
- Ensure the header is exactly the Basic scheme plus a base64-encoded
username:access_keypair—not the raw pair and not a bearer token. - Verify the endpoint and the
Content-Type: application/jsonheader.
Malformed or rejected request
- Send a JSON object in the request body, not form-encoded fields.
- Check quoting and escaping in shell commands; malformed JSON can produce a 400 response.
- Use the start-test API reference to confirm the request fields and accepted configuration structure for the test you intend to run.
Environment variable appears empty
Environment variables are scoped to the shell or process where they are set. Set them again in the terminal that launches the script, or configure them in the runtime’s environment settings. Avoid printing the access key while debugging; check whether the variable exists without exposing its value.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
If your goal is simply to request a website screenshot, ScreenshotNeo offers a one-request alternative. Its API uses a GET request and accepts an access key and target URL. See the ScreenshotNeo API documentation.
Quick Recap
Best Value
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, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are never billed. It also provides an MCP server for AI agents, and its free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo’s free plan.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




