// AI Platform Drift
Cloudflare Browser Run adds /script endpoint for single-request automation
Cloudflare developer changelog · published 2026-11-21 07:10 UTC
WHAT CHANGEDCloudflare Browser Run introduced POST /script and POST /script/<sessionId> endpoints that execute Playwright, Puppeteer, or Chrome DevTools Protocol functions in a single API request without deploying a Worker. The endpoints return session and page identifiers in cf-browser-session-id and cf-browser-target-id response headers. Sessions remain open after script execution until explicitly closed with DELETE /devtools/browser/<sessionId> or until idle timeout. Workers can call the same endpoints through env.BROWSER.script() without an API token. A Script Studio interface in the Cloudflare dashboard allows writing and running scripts against live browsers without an API token.
WHY IT MATTERSExisting Browser Run workflows that deploy Workers for automation can now run the same code in a single API call, eliminating the deployment step. Sessions that are not explicitly closed will consume resources until idle timeout, changing the cleanup model from previous Browser Run usage patterns.
WHAT TO DOReview current Browser Run Worker deployments to identify automation that can move to /script endpoints. Add explicit session cleanup with DELETE /devtools/browser/<sessionId> or browser.close() calls to any new /script usage to avoid sessions running to idle timeout.
Model-reported confidence 85% (not measured accuracy)
Primary source ↗
written by anthropic/claude-sonnet-4.5
Show the reasoning — raw diff, triage verdict, confidence
RAW DIFF
+## Browser Run - Run custom scripts in Browser Run with /script +https://developers.cloudflare.com/changelog/post/2026-11-20-script-endpoint/ +Fri, 20 Nov 2026 00:00:00 GMT + +Browser Run now runs custom browser automation written with Playwright, Puppeteer, or the raw Chrome DevTools Protocol (CDP) in a single API request, with the new /script endpoints. Submit a JavaScript function, and Browser Run executes it in an isolated Worker connected to a browser session, so you do not need to deploy a Worker. +curl -i -X POST "https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-run/script" \ +-H "Authorization: Bearer <apiToken>" \ +-H "Content-Type: application/json" \ +-d '{ +"code": "async ({ page }) => { await page.goto(\"https://example.com\"); return { title: await page.title() }; }", +"library": "playwright" +}' +HTTP/2 200 +content-type: application/json +cf-browser-session-id: 8f7c2e3a-1b4d-4c6e-9a0f-2d5b7e9c1a3f +cf-browser-target-id: A1B2C3D4E5F60718293A4B5C6D7E8F90 + +{ +"success": true, +"result": { +"title": "Example Domain" +} +} + +POST /script acquires a browser, runs your function, and returns its result as { "success": true, "result": ... }. The session and page are returned in the cf-browser-session-id and cf-browser-target-id response headers (except Kitesurf runs). +POST /script/<sessionId> runs follow-up scripts in a session you already hold, from /script or from POST /devtools/browser. Pass targetId to attach to a specific page, or create extra pages to run scripts concurrently in one session. +Session launch options (keep_alive, recording, lab) go in the /script query string. Use browser=kitesurf to run a CDP script on Kitesurf. +From a Worker, call the same endpoints through the browser binding with env.BROWSER.script(), without an API token. +From the Cloudflare dashboard, write and run scripts against a live browser in Script Studio, without an API token. +Neither endpoint closes the session after your script runs. Close it with DELETE /devtools/browser/<sessionId> or browser.close(). Otherwise, it ends at its idle timeout. + +For more information, refer to Custom scripts.
HOW IT WAS JUDGED
Triage signals below are model-reported assertions, preserved verbatim; they are not independent arithmetic verification.
| triage verdict | MATERIAL at 0.95, needed 0.5 |
|---|---|
| triage reasoning | New API endpoints and execution model for Browser Run service materially expand platform capabilities. |
| signals | new API endpoint introduced: POST /script · new endpoint variant: POST /script/<sessionId> · new response headers: cf-browser-session-id, cf-browser-target-id · new execution model: submit JavaScript function without deploying Worker · new query parameters: keep_alive, recording, lab, browser=kitesurf · new Worker binding method: env.BROWSER.script() · new dashboard feature: Script Studio · new session management: DELETE /devtools/browser/<sessionId> |
| suppression | — |
| triage model | anthropic/claude-haiku-4.5 ($0.00000) |
| writer model | anthropic/claude-sonnet-4.5 ($0.00000) |