---
title: "Browser Run - Run custom scripts in Browser Run with /script — Cloud Changelog"
description: "Browser Run now runs custom browser automation written with Playwright, Puppeteer, or the raw Chrome DevTools Protocol (CDP) in a single API request, with…"
url: "https://cloudchangelog.com/cloudflare/2026-11-20-script-endpoint"
updated: "2026-11-20"
---

[Back to feed](https://cloudchangelog.com/feed/2026-W47)

November 20, 2026 · Cloudflare

# Browser Run - Run custom scripts in Browser Run with /script

- [Browser Run](https://cloudchangelog.com/products/cloudflare/browser-run)
- [AI and machine learning](https://cloudchangelog.com/search?q=ai-ml)

[Browser Run](https://developers.cloudflare.com/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](https://developers.cloudflare.com/browser-run/script/). 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](https://developers.cloudflare.com/browser-run/kitesurf/).
- From a Worker, call the same endpoints through the [browser binding](https://developers.cloudflare.com/browser-run/script/#use-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](https://developers.cloudflare.com/browser-run/script/#try-scripts-in-the-dashboard), 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](https://developers.cloudflare.com/browser-run/script/).

Free. Unsubscribe any time.

[Read on developers.cloudflare.com](https://developers.cloudflare.com/changelog/post/2026-11-20-script-endpoint/)

## Related updates

- Apr 4, 2025

  [Browser Run - Playwright for Browser Rendering now available](https://cloudchangelog.com/cloudflare/2025-04-04-playwright-beta)
- Apr 10, 2026

  [Browser Run - Browser Rendering adds Chrome DevTools Protocol (CDP) and MCP client support](https://cloudchangelog.com/cloudflare/2026-04-10-browser-rendering-cdp-endpoint)
- Aug 20, 2026

  [Browser Run - Run more headless browsers concurrently with Browser Run](https://cloudchangelog.com/cloudflare/2026-08-20-limits-increase)
- May 28, 2026

  [Browser Run - Use Browser Run Quick Actions directly from Workers](https://cloudchangelog.com/cloudflare/2026-05-28-use-browser-run-quick-actions-directly-from-workers)
- May 28, 2025

  [Browser Run - Playwright MCP server is now compatible with Browser Rendering](https://cloudchangelog.com/cloudflare/2025-05-28-playwright-mcp)

[All Browser Run changes](https://cloudchangelog.com/products/cloudflare/browser-run)

## Contact

- [YouTube](https://www.youtube.com/@cloudchangelog)
