diff --git a/public/_redirects b/public/_redirects index 619e0c05a31b11b..92b29a15814b8c1 100644 --- a/public/_redirects +++ b/public/_redirects @@ -180,9 +180,9 @@ /bots/reference/verified-bot-policy/ /bots/concepts/bot/verified-bots/policy/ 301 #browser-rendering -/browser-rendering/get-started/browser-rendering-with-do/ /browser-rendering/workers-binding-api/browser-rendering-with-do/ 301 -/browser-rendering/get-started/reuse-sessions/ /browser-rendering/workers-binding-api/reuse-sessions/ 301 -/browser-rendering/get-started/screenshots/ /browser-rendering/workers-binding-api/screenshots/ 301 +/browser-rendering/get-started/browser-rendering-with-do/ /browser-rendering/workers-binding-api/browser-rendering-with-do/ 301 +/browser-rendering/get-started/reuse-sessions/ /browser-rendering/workers-binding-api/reuse-sessions/ 301 +/browser-rendering/get-started/screenshots/ /browser-rendering/workers-binding-api/screenshots/ 301 # byoip /byoip/about/dynamic-advertisement/ /byoip/concepts/dynamic-advertisement/ 301 @@ -436,7 +436,7 @@ /cloudflare-one/insights/email-monitoring/ /cloudflare-one/email-security/email-monitoring/ 301 /cloudflare-one/insights/email-monitoring/search-email/ /cloudflare-one/email-security/email-monitoring/search-email/ 301 /cloudflare-one/insights/email-monitoring/phish-submissions/ /cloudflare-one/email-security/phish-submissions/ 301 -/cloudflare-one/insights/email-monitoring/enable-logs/ /cloudflare-one/insights/logs/enable-logs/ 301 +/cloudflare-one/insights/email-monitoring/enable-logs/ /cloudflare-one/insights/logs/enable-logs/ 301 # firewall @@ -1874,6 +1874,7 @@ ### DYNAMIC REDIRECTS ### /changelog-next/* /changelog/:splat 301 +/browser-rendering/quick-actions-rest-api/* /browser-rendering/rest-api/:splat 301 /*/sitemap.xml /sitemap-index.xml 301 /access/configuring-identity-providers/* /cloudflare-one/identity/idp-integration/:splat 301 /api-security/* /api-shield/:splat 301 diff --git a/src/content/changelog/browser-rendering/2025-02-27-br-rest-api-beta.mdx b/src/content/changelog/browser-rendering/2025-02-27-br-rest-api-beta.mdx new file mode 100644 index 000000000000000..76f6070ec63564f --- /dev/null +++ b/src/content/changelog/browser-rendering/2025-02-27-br-rest-api-beta.mdx @@ -0,0 +1,35 @@ +--- +title: New REST API is in open beta! +description: We've released a new REST API in open beta. +products: + - browser-rendering +date: 2025-02-27T12:00:00Z +--- + +We've released a new REST API for [Browser Rendering](/browser-rendering/) in open beta, making interacting with browsers easier than ever. This new API provides endpoints for common browser actions, with more to be added in the future. + +With the **REST API** you can: + +- **Capture screenshots** – Use `/screenshot` to take a screenshot of a webpage from provided URL or HTML. +- **Generate PDFs** – Use `/pdf` to convert web pages into PDFs. +- **Extract HTML content** – Use `/content` to retrieve the full HTML from a page. + **Snapshot (HTML + Screenshot)** – Use `/snapshot` to capture both the page's HTML and a screenshot in one request +- **Scrape Web Elements** – Use `/scrape` to extract specific elements from a page. + +For example, to capture a screenshot: + +```bash title="Screenshot example" +curl -X POST 'https://api.cloudflare.com/client/v4/accounts//browser-rendering/screenshot' \ + -H 'Authorization: Bearer ' \ + -H 'Content-Type: application/json' \ + -d '{ + "html": "Hello World!", + "screenshotOptions": { + "type": "webp", + "omitBackground": true + } + }' \ + --output "screenshot.webp" +``` + +Learn more in our [documentation](/browser-rendering/rest-api/). diff --git a/src/content/docs/browser-rendering/get-started.mdx b/src/content/docs/browser-rendering/get-started.mdx index 5abf934d66a51b3..d75c19a3ac10af5 100644 --- a/src/content/docs/browser-rendering/get-started.mdx +++ b/src/content/docs/browser-rendering/get-started.mdx @@ -8,4 +8,4 @@ sidebar: Browser rendering can be used in two ways: - [Workers Binding API](/browser-rendering/workers-binding-api) for complex scripts. -- [Quick Actions REST API](/browser-rendering/quick-actions-rest-api/) for simple actions. +- [REST API](/browser-rendering/rest-api/) for simple actions. diff --git a/src/content/docs/browser-rendering/quick-actions-rest-api/index.mdx b/src/content/docs/browser-rendering/quick-actions-rest-api/index.mdx deleted file mode 100644 index fb9435a6bfb51b0..000000000000000 --- a/src/content/docs/browser-rendering/quick-actions-rest-api/index.mdx +++ /dev/null @@ -1,23 +0,0 @@ ---- -pcx_content_type: navigation -title: Quick Actions REST API -sidebar: - order: 2 - group: - badge: Beta ---- - -The Quick Actions API is a RESTful interface that provides endpoints for common browser actions such as capturing screenshots, extracting HTML content, generating PDFs, and more. -The following are the available options: - -import { DirectoryListing } from "~/components"; - - - -Use the Quick Actions API when you need a fast, simple way to perform common browser tasks such as capturing screenshots, extracting HTML, or generating PDFs without writing complex scripts. If you require more advanced automation, custom workflows, or persistent browser sessions, the [Workers Binding API](/browser-rendering/workers-binding-api/) is the better choice. - -## Before you begin - -Before you begin, make sure you [create a custom API Token](/fundamentals/api/get-started/create-token/) with the following permissions: - -- `Browser Rendering - Edit` diff --git a/src/content/docs/browser-rendering/quick-actions-rest-api/content-endpoint.mdx b/src/content/docs/browser-rendering/rest-api/content-endpoint.mdx similarity index 100% rename from src/content/docs/browser-rendering/quick-actions-rest-api/content-endpoint.mdx rename to src/content/docs/browser-rendering/rest-api/content-endpoint.mdx diff --git a/src/content/docs/browser-rendering/rest-api/index.mdx b/src/content/docs/browser-rendering/rest-api/index.mdx new file mode 100644 index 000000000000000..656be53ba352c44 --- /dev/null +++ b/src/content/docs/browser-rendering/rest-api/index.mdx @@ -0,0 +1,23 @@ +--- +pcx_content_type: navigation +title: REST API +sidebar: + order: 2 + group: + badge: Beta +--- + +The REST API is a RESTful interface that provides endpoints for common browser actions such as capturing screenshots, extracting HTML content, generating PDFs, and more. +The following are the available options: + +import { DirectoryListing } from "~/components"; + + + +Use the REST API when you need a fast, simple way to perform common browser tasks such as capturing screenshots, extracting HTML, or generating PDFs without writing complex scripts. If you require more advanced automation, custom workflows, or persistent browser sessions, the [Workers Binding API](/browser-rendering/workers-binding-api/) is the better choice. + +## Before you begin + +Before you begin, make sure you [create a custom API Token](/fundamentals/api/get-started/create-token/) with the following permissions: + +- `Browser Rendering - Edit` diff --git a/src/content/docs/browser-rendering/quick-actions-rest-api/pdf-endpoint.mdx b/src/content/docs/browser-rendering/rest-api/pdf-endpoint.mdx similarity index 100% rename from src/content/docs/browser-rendering/quick-actions-rest-api/pdf-endpoint.mdx rename to src/content/docs/browser-rendering/rest-api/pdf-endpoint.mdx diff --git a/src/content/docs/browser-rendering/quick-actions-rest-api/scrape-endpoint.mdx b/src/content/docs/browser-rendering/rest-api/scrape-endpoint.mdx similarity index 100% rename from src/content/docs/browser-rendering/quick-actions-rest-api/scrape-endpoint.mdx rename to src/content/docs/browser-rendering/rest-api/scrape-endpoint.mdx diff --git a/src/content/docs/browser-rendering/quick-actions-rest-api/screenshot-endpoint.mdx b/src/content/docs/browser-rendering/rest-api/screenshot-endpoint.mdx similarity index 100% rename from src/content/docs/browser-rendering/quick-actions-rest-api/screenshot-endpoint.mdx rename to src/content/docs/browser-rendering/rest-api/screenshot-endpoint.mdx diff --git a/src/content/docs/browser-rendering/quick-actions-rest-api/snapshot.mdx b/src/content/docs/browser-rendering/rest-api/snapshot.mdx similarity index 100% rename from src/content/docs/browser-rendering/quick-actions-rest-api/snapshot.mdx rename to src/content/docs/browser-rendering/rest-api/snapshot.mdx diff --git a/src/content/docs/browser-rendering/workers-binding-api/index.mdx b/src/content/docs/browser-rendering/workers-binding-api/index.mdx index dbfac2ebb499ad5..e90b1edc3feb371 100644 --- a/src/content/docs/browser-rendering/workers-binding-api/index.mdx +++ b/src/content/docs/browser-rendering/workers-binding-api/index.mdx @@ -11,4 +11,4 @@ The Workers Binding API allows you to execute advanced browser rendering scripts -Use the Workers Binding API when you need advanced browser automation, custom workflows, or complex interactions beyond basic rendering. For quick, one-off tasks like capturing screenshots or extracting HTML, the [Quick Actions REST API](/browser-rendering/quick-actions-rest-api/) is the simpler choice. +Use the Workers Binding API when you need advanced browser automation, custom workflows, or complex interactions beyond basic rendering. For quick, one-off tasks like capturing screenshots or extracting HTML, the [REST API](/browser-rendering/rest-api/) is the simpler choice.