Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
You can call a hosted screenshot API directly from Deno with its built-in fetch; you do not need a browser automation package for this HTTP workflow. The example below sends a URL and capture options to Screenshot API, checks the HTTP status, then reads the documented JSON response, which normally contains a CDN URL. If you need the image or PDF itself rather than a URL, use the documented redirect option and handle the redirect response deliberately.
Make your first screenshot request from Deno
Screenshot API is a hosted REST endpoint for capturing a website as an image or PDF. Its documented endpoint is https://api.screenshot-api.org/api/v1/screenshot. The service’s quick start uses a POST request with a JSON body; Deno can send that request using its built-in fetch API.
Set your API key in an environment variable rather than placing it in source code. Save the following as screenshot.ts:
const apiKey = Deno.env.get("SCREENSHOT_API_KEY");
if (!apiKey) throw new Error("SCREENSHOT_API_KEY is required");
const response = await fetch("https://api.screenshot-api.org/api/v1/screenshot", {
method: "POST",
headers: {
"Authorization": `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
url: "https://example.com",
format: "png",
fullPage: false,
}),
});
if (!response.ok) {
const detail = await response.text();
throw new Error(`Screenshot request failed (${response.status}): ${detail}`);
}
const result = await response.json();
console.log(result);
Run it with the environment variable set and the permissions needed to read it:
#1 Best Overall
SCREENSHOT_API_KEY="YOUR_API_KEY" deno run --allow-env screenshot.ts
The example uses the documented url, format and fullPage fields. A successful normal request returns JSON with a CDN URL, rather than necessarily returning image bytes in the response body. Inspect the actual result object before wiring a particular property into downstream code; the available material does not establish a complete response schema.
Choose the right response format
A Deno Response has a status, headers and a body. Read the body according to what the endpoint returned: use json() for the normal JSON result, text() for plain text or an error body, arrayBuffer() for binary data, or blob() when a Blob is useful to your application. Do not call json() on an image response or assume the default response is a byte stream.
For the JSON flow, inspect status before consuming the body as JSON, as in the quick start. The failure branch reads the body as text to preserve any human-readable error details. In a production handler, avoid returning that detail to untrusted clients without review; log only information appropriate for your application and do not log API keys.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →The service documents redirect=1 on GET as a way to receive a 302 redirect to the resulting image or PDF. If you need to retrieve the asset, follow the redirect and read the final response as binary. Check both the initial and final statuses, and use the response headers to understand what came back instead of relying on a fixed assumption about the body.
Rank #2
GET, POST and batch requests
Use POST for capture settings
POST /api/v1/screenshot accepts parameters in a JSON body and is documented as useful for complex configurations. It is a practical default when your request has several options, because the settings remain together in a structured payload and do not need to be encoded into a URL query string.
Use GET when query parameters suit the request
GET /api/v1/screenshot accepts query parameters and returns JSON by default. The documented redirect=1 option requests a 302 redirect to the captured image or PDF. Construct query strings with URLSearchParams instead of concatenating unescaped values, particularly when the target URL itself contains query parameters.
const apiKey = Deno.env.get("SCREENSHOT_API_KEY");
if (!apiKey) throw new Error("SCREENSHOT_API_KEY is required");
const query = new URLSearchParams({
key: apiKey,
url: "https://example.com",
redirect: "1",
});
const response = await fetch(
`https://api.screenshot-api.org/api/v1/screenshot?${query}`,
);
if (!response.ok && response.status !== 302) {
throw new Error(`Screenshot request failed: ${response.status}`);
}
console.log("Status:", response.status);
console.log("Location:", response.headers.get("location"));
This illustrates the documented query-key form and redirect option. Query-string credentials may be recorded in URLs or request logs, so the documented Bearer header is the preferable form for server-side requests where you control headers.
Use the batch endpoint for multiple URLs
The documented batch route is POST /api/v1/screenshot/batch; it returns a batch ID for tracking progress. The available documentation does not establish its full request schema or polling procedure here, so check the current service documentation before implementing those details. Do not treat receipt of a batch ID as proof that every capture has finished.
Rank #3
Authenticate without exposing your key
Screenshot API documents three authentication forms: a key query parameter, Authorization: Bearer YOUR_API_KEY, and X-API-Key: YOUR_API_KEY. The Bearer header is recommended in the service documentation. The quick start uses that header; the GET example shows the query-parameter form because it makes the URL-based flow clear.
- Store the key in an environment variable or your deployment platform’s secret store.
- Send it from server-side Deno code. Do not embed it in browser-delivered JavaScript or commit it to a repository.
- Do not print the request URL when it contains a query-string key.
- If a request is rejected, verify the variable is present and that the header name and Bearer prefix are spelled as shown.
For local development, Deno requires permission to access environment variables, which is why the run command includes --allow-env. Grant only the permissions your script needs; add network permission when required by your Deno setup, for example --allow-net=api.screenshot-api.org.
Run the same request with cURL, Python or Node.js
These examples use the same documented POST endpoint, JSON settings and Bearer authentication as the Deno quick start. They are useful for checking whether an issue is specific to your Deno code or affects the API request itself.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minutecURL
curl -X POST "https://api.screenshot-api.org/api/v1/screenshot"
-H "authorization: Bearer YOUR_API_KEY"
-H "content-type: application/json"
-d '{"url":"https://example.com","format":"png","fullPage":false}'
Python
import os
import requests
api_key = os.environ["SCREENSHOT_API_KEY"]
response = requests.post(
"https://api.screenshot-api.org/api/v1/screenshot",
headers={"Authorization": f"Bearer {api_key}"},
json={"url": "https://example.com", "format": "png", "fullPage": False},
timeout=90,
)
response.raise_for_status()
print(response.json())
Node.js
const apiKey = process.env.SCREENSHOT_API_KEY;
if (!apiKey) throw new Error("SCREENSHOT_API_KEY is required");
const response = await fetch("https://api.screenshot-api.org/api/v1/screenshot", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
url: "https://example.com",
format: "png",
fullPage: false,
}),
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
console.log(await response.json());
Or skip the browser setup
If your goal is simply a website screenshot from Deno, ScreenshotNeo offers a separate screenshot API with a one-request HTTP flow; it is not the Screenshot API endpoint used in the examples above. Its API accepts a URL and returns a screenshot as PNG, JPEG or WebP, or a PDF. Here is the Deno version of its GET call:
Rank #4
const accessKey = Deno.env.get("SCREENSHOTNEO_API_KEY");
if (!accessKey) throw new Error("SCREENSHOTNEO_API_KEY is required");
const query = new URLSearchParams({
access_key: accessKey,
url: "https://example.com",
});
const response = await fetch(`https://api.screenshotneo.com/v1/shot?${query}`);
if (!response.ok) throw new Error(`Screenshot request failed: ${response.status}`);
const image = new Uint8Array(await response.arrayBuffer());
await Deno.writeFile("shot.webp", image);
See the ScreenshotNeo API documentation for request options. Cookie banners, newsletter popups and chat widgets are removed before capture; bot checks, blank pages and failed loads are not billed. An MCP server lets AI agents take screenshots, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for 1,000 free screenshots a month, with no card.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshoot common failures
The script says the API key is required
The environment variable is unset or inaccessible to the process. Set SCREENSHOT_API_KEY in the shell or deployment secret configuration and run Deno with --allow-env. Keep the key out of the source file.
Deno reports a permission error
The runtime has not been granted a permission needed by the script. The quick start reads an environment variable and makes a network request; grant --allow-env and the narrowly scoped network permission for api.screenshot-api.org. If you add file output, grant the required write permission as well.
Recommended Free Tools
The service returns a non-success status
Check the status code and response body before parsing JSON. Confirm the endpoint, authentication scheme and JSON content type, then verify that the requested URL and option values are valid for the service. The official material available here does not establish a complete error-code table, quota policy or retry policy; consult the current API documentation for service-specific interpretation rather than assigning guessed meanings to status codes.
The response is not JSON
A GET request with redirect=1 is intended to redirect to the image or PDF. Inspect the status and Location header, and read the final asset response as bytes instead of calling json(). For a normal request, the documented default is JSON containing a CDN URL.
Best Value
The request works in a script but not in a browser
Keep the API key on a server. A browser-based application can call your own backend, which then makes the authenticated API request; the available material does not establish browser CORS behavior, so do not assume direct cross-origin calls are supported.
Reliability, performance and cost considerations
A screenshot request depends on both your network call and the remote capture completing. Set an appropriate timeout in clients that support one, handle non-2xx responses, and avoid assuming that an HTTP connection closing early means the capture succeeded. The Python example uses a 90-second request timeout; that is an example client setting, not a documented service guarantee. The retrieved official pages do not establish service latency, an error-rate commitment, retry guidance or quota terms.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →For a workflow with many URLs, the documented batch endpoint may fit better than launching one request per URL, but its exact limits and progress lifecycle should be checked in current service documentation. If you implement retries, distinguish transient transport failures from a response that clearly indicates invalid input or authentication; do not retry blindly, since the available material does not specify idempotency or billing behavior for repeated requests.
No authoritative pricing figures or quota policy are established in the documentation material referenced here. Check the current service terms and account dashboard before estimating recurring capture costs or building usage limits into an application.
FAQ
Does Deno need a screenshot package to use this API?
No. For the documented REST flow, Deno’s built-in fetch can send the HTTP request. A separate package is unnecessary for making the API call.
Can the endpoint return a PDF?
Screenshot API describes its service as capturing screenshots as images or PDFs. The exact PDF request fields are not established in the examples here; use its current documentation for the supported parameters.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Where can I find the API’s integration documentation?
The service describes its API as language-independent for languages that can make HTTP requests. Start with the endpoint and quick-start request above, then consult the live service documentation for any fields or response details not covered here.
Quick Recap
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.

