Field noteNov 27, 20262 min read1 source

Run custom scripts in Browser Run with /script

In one minute

Send a JavaScript function using Playwright, Puppeteer, or the Chrome DevTools Protocol in a single API request; Browser Run executes it in an isolated Worker connected to a browser session. (developers.cloudflare.com)

What changed: Cloudflare adds a /script API to Browser Run, letting developers execute Playwright, Puppeteer, or CDP automation in an isolated Worker and optionally run CDP scripts on Kitesurf.

What happened

POST /script acquires a browser, runs the function, and returns a JSON object with success and result. Response headers identify the session and page, except on Kitesurf runs. (developers.cloudflare.com)

For follow-up work, POST /script/<sessionId> runs another script in a held session; pass targetId to select a page, or create extra pages for concurrent scripts. (developers.cloudflare.com) Set keep_alive, recording, and lab as query-string launch options. (developers.cloudflare.com)

A Worker can call the endpoints through its browser binding with env.BROWSER.script() and no API token. (developers.cloudflare.com) Script Studio in the Cloudflare dashboard also lets you write and run scripts against a live browser without a token. (developers.cloudflare.com)

Why it matters

This makes Browser Run useful for both one-off automation and multi-step workflows: callers can start a run and submit follow-up scripts against its held session without deploying their own Worker.

Limits and uncertainty

Neither /script endpoint closes the browser session automatically. (developers.cloudflare.com) Kitesurf runs are the exception to the session and page response headers, so do not depend on those headers to identify the run there. (developers.cloudflare.com) A session left open ends only at its idle timeout. (developers.cloudflare.com)

Skill to build now

Start with the documented POST request to your account’s /browser-run/script endpoint: send a bearer API token, a JavaScript function in code, and set library to playwright. To run a CDP script on Kitesurf, add browser=kitesurf. (developers.cloudflare.com) Close the session when done with DELETE /devtools/browser/<sessionId> or browser.close(). (developers.cloudflare.com)

Reader takeaway

Use POST /script to send a Playwright, Puppeteer, or CDP function and get its result in one request. For multi-step work, reuse the returned session and target a page as needed—but close the session yourself or account for its idle timeout.

How this was made

First seen
Nov 27, 2026, 19:21 UTC in our intake.
Sources
1 source carried the story when we picked it up; we cite the original.
Written by
gpt-6-luna (AI model).
Critic
No separate critic model on this desk; the automated checks below gate publication.
Checks passed
The cited primary source was fetched and verified; the source is not older than 30 days; no earlier note covers the same story; the copy passed the site's structure and language checks.
Confidence
Novelty judgement: a new fact, medium confidence. Editorial value: high.
Human review
Published without a per-item human sign-off. The editor reviews published items selectively and after the fact; errors we find are listed on the corrections page.

Corrections and error statistics

Evidence / sources

  1. 1developers.cloudflare.com/changelog/post/2026-11-20-script-endpoint
All Field Notes

Next reads

Read next

Open the graph
  1. 01topicAutomationExplore the automation topic hub.
  2. 02topicDeveloper ToolsExplore the developer-tools topic hub.
  3. 03topicSandboxExplore the sandbox topic hub.
  4. 04archiveField NotesOpen the latest editorial analysis.
  5. 05sourcesSourcesSee the original sources this archive cites.
Who read this page?Machine requests, hidden until opened

Loading the privacy-safe route aggregate...

Open the JSON contract