Live
GPU‑Accelerated Inference on AWS Lambda via Managed InstancesClaude Code’s “Don’t Ask Again” local file leaks credentials to public reposPost‑training RL with PivotRL lifts Nemotron 3 Ultra coding benchmarkIntegrating AI Coding Agents into Development Workflows: Protocols, Practices, and Security ImplicationsAWS Quick’s new Meta ads AI connector: what engineers need to knowAI router data leakage forces engineers to rethink prompt pipelinesRust’s Agent Client Protocol simplifies AI‑agent integration for production workloadsUsing Gaussian Sharpening with Cloudflare Images: Practical Guidance for EngineersGPU‑Accelerated Inference on AWS Lambda via Managed InstancesClaude Code’s “Don’t Ask Again” local file leaks credentials to public reposPost‑training RL with PivotRL lifts Nemotron 3 Ultra coding benchmarkIntegrating AI Coding Agents into Development Workflows: Protocols, Practices, and Security ImplicationsAWS Quick’s new Meta ads AI connector: what engineers need to knowAI router data leakage forces engineers to rethink prompt pipelinesRust’s Agent Client Protocol simplifies AI‑agent integration for production workloadsUsing Gaussian Sharpening with Cloudflare Images: Practical Guidance for Engineers
Cloudflare

Snapshot API Extensions Add PDF, Links, Scrape, and JSON Outputs

AI SummaryPowered by AI

The /snapshot endpoint now supports four additional output formats—pdf, links, scrape, and json—alongside its existing HTML, screenshot, markdown, and accessibility tree. This lets engineers retrieve structured data, PDFs, and link lists in a single request, cutting latency and simplifying pipelines.

The Browser Run /snapshot endpoint has been expanded to return PDF files, link collections, scraped element data, and AI‑generated JSON in addition to its original HTML, screenshot, markdown, and accessibility tree outputs. By specifying the desired formats in a single call, teams can avoid a second request for each representation, which directly impacts latency, cost, and operational complexity.

What Changed in the Snapshot Endpoint

Four new format identifiers are now accepted in the formats array:

  • pdf – Generates a printable PDF using the same pdfOptions that the dedicated /pdf endpoint accepts.
  • links – Returns a list of page links, respecting the visibleLinksOnly and excludeExternalLinks flags that the /links endpoint provides.
  • scrape – Emits the elements matched by an elements selector array, mirroring the payload of the /scrape endpoint. The elements field is required when this format is requested.
  • json – Uses Workers AI to extract structured data from the page HTML. The request must include a prompt or response_format (or both) and follows the same schema as the /json endpoint, incurring Workers AI usage.

All formats are requested together, for example:

const response = await env.BROWSER.quickAction("snapshot", {
  url: "https://example.com/",
  formats: ["pdf", "links", "scrape"],
  elements: [{ selector: "p" }]
});
const { result } = await response.json();
console.log(result.pdf);
console.log(result.links);

Why It Matters to Different Practitioner Roles

  • AI engineers can now trigger Workers AI extraction directly from the snapshot call, eliminating a separate AI request and keeping the data flow within a single edge function.
  • Cloud and platform engineers gain a more predictable request pattern; a single API call can satisfy multiple downstream services, reducing network chatter and simplifying routing logic.
  • DevOps and SREs see fewer concurrent requests to the Browser Run service, which can lower observed latency spikes and simplify alerting thresholds for request‑rate metrics.
  • Security engineers have a single point of data ingress to audit, making it easier to enforce content‑type validation and to monitor Workers AI usage for unexpected data extraction.

Architectural and Operational Implications

Consolidating four outputs into one request changes the payload size and processing time. Engineers should anticipate larger response bodies, especially when PDFs are included, and adjust downstream storage or streaming logic accordingly. The optional elements array becomes mandatory for scrape, so validation logic must enforce its presence.

Because the json format invokes Workers AI, any deployment that enables this format must account for AI usage quotas and potential cost impact. Monitoring should include both the Browser Run request count and the associated Workers AI consumption.

From an implementation perspective, existing code that previously called /pdf, /links, or /scrape separately can be refactored to a single /snapshot call, reducing the number of edge function invocations and simplifying error handling – a single HTTP status now represents the success or failure of all requested formats.

Security Considerations

The expanded endpoint does not introduce new authentication mechanisms, but the broader data surface means that any compromised client could retrieve PDFs or extracted JSON that may contain sensitive information. Practitioners should ensure that access controls around the Browser Run service are scoped appropriately and that any downstream storage of PDFs or JSON respects data‑at‑rest encryption policies.

When using the json format, the prompt text is sent to Workers AI. Teams should review prompt content for inadvertent exposure of secrets, as the AI service processes the text in a separate execution environment.

Related CloudNinjas coverage: hands-on guides.

What This Means For Practitioners

Adopt the unified /snapshot call wherever multiple representations of a page are needed. Update request validation to include elements for scraping and to enforce a prompt or response_format when JSON extraction is required. Adjust monitoring to capture combined response size and Workers AI usage, and review access policies to ensure that the broader output set does not leak sensitive data.

Originally published atCloudflare Developer Platform