Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ console.log(content);

## Advanced usage

:::note[Looking for more parameters?]
Visit the [Browser Rendering PDF API reference](/api/resources/browser_rendering/subresources/content/methods/create/) for all available parameters, such as setting HTTP credentials using `authenticate`, setting `cookies`, and customizing load behavior using `gotoOptions`.
:::

Navigate to `https://cloudflare.com/` but block images and stylesheets from loading. Undesired requests can be blocked by resource type (`rejectResourceTypes`) or by using a regex pattern (`rejectRequestPattern`). The opposite can also be done, only allow requests that match `allowRequestPattern` or `allowResourceTypes`.

```bash
Expand All @@ -63,3 +67,8 @@ Many more options exist, like setting HTTP headers using `setExtraHTTPHeaders`,
file="setting-custom-user-agent"
product="browser-rendering"
/>

<Render
file="faq"
product="browser-rendering"
/>
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ console.log(json);

## Advanced Usage

:::note[Looking for more parameters?]
Visit the [Browser Rendering PDF API reference](/api/resources/browser_rendering/subresources/json/methods/create/) for all available parameters, such as setting HTTP credentials using `authenticate`, setting `cookies`, and customizing load behavior using `gotoOptions`.
:::

### Using a custom model (BYO API Key)

Browser Rendering can use a custom model for which you supply credentials. List the model(s) in the `custom_ai` array:
Expand Down Expand Up @@ -354,3 +358,8 @@ In this example, Browser Rendering first calls Anthropic's Claude Sonnet 4 model
file="setting-custom-user-agent"
product="browser-rendering"
/>

<Render
file="faq"
product="browser-rendering"
/>
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ console.log(links);
</TabItem> </Tabs>
## Advanced usage

:::note[Looking for more parameters?]
Visit the [Browser Rendering PDF API reference](/api/resources/browser_rendering/subresources/links/methods/create/) for all available parameters, such as setting HTTP credentials using `authenticate`, setting `cookies`, and customizing load behavior using `gotoOptions`.
:::

### Retrieve only visible links

Set the `visibleLinksOnly` parameter to `true` to only return links that are visible on the page. By default, this is set to `false`.
Expand Down Expand Up @@ -233,3 +237,8 @@ curl -X POST 'https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-
file="setting-custom-user-agent"
product="browser-rendering"
/>

<Render
file="faq"
product="browser-rendering"
/>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import { Tabs, TabItem, Render } from "~/components";

The `/markdown` endpoint retrieves a webpage's content and converts it into Markdown format. You can specify a URL and optional parameters to refine the extraction process.

## Common use cases

1. **Content extraction:** Convert a blog post or article into Markdown format for storage or further processing.
2. **Static site generation:** Retrieve structured Markdown content for use in static site generators like Jekyll or Hugo.
3. **Automated summarization:** Extract key content from web pages while ignoring CSS, scripts, or unnecessary elements.

## Basic usage

### Using a URL
Expand Down Expand Up @@ -74,6 +80,10 @@ curl -X 'POST' 'https://api.cloudflare.com/client/v4/accounts/<accountId>/browse

## Advanced usage

:::note[Looking for more parameters?]
Visit the [Browser Rendering PDF API reference](/api/resources/browser_rendering/subresources/markdown/methods/create/) for all available parameters, such as setting HTTP credentials using `authenticate`, setting `cookies`, and customizing load behavior using `gotoOptions`.
:::

You can refine the Markdown extraction by using the `rejectRequestPattern` parameter. In this example, requests matching the given regex pattern (such as CSS files) are excluded.

```bash
Expand All @@ -98,8 +108,7 @@ curl -X 'POST' 'https://api.cloudflare.com/client/v4/accounts/<accountId>/browse
product="browser-rendering"
/>

## Potential use-cases

1. **Content extraction:** Convert a blog post or article into Markdown format for storage or further processing.
2. **Static site generation:** Retrieve structured Markdown content for use in static site generators like Jekyll or Hugo.
3. **Automated summarization:** Extract key content from web pages while ignoring CSS, scripts, or unnecessary elements.
<Render
file="faq"
product="browser-rendering"
/>
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,8 @@ curl -X POST https://api.cloudflare.com/client/v4/accounts/<acccountID>/browser-
file="setting-custom-user-agent"
product="browser-rendering"
/>

<Render
file="faq"
product="browser-rendering"
/>
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,16 @@ Many more options exist, like setting HTTP credentials using `authenticate`, set

## Advanced Usage

:::note[Looking for more parameters?]
Visit the [Browser Rendering PDF API reference](/api/resources/browser_rendering/subresources/scrape/methods/create/) for all available parameters, such as setting HTTP credentials using `authenticate`, setting `cookies`, and customizing load behavior using `gotoOptions`.
:::

<Render
file="setting-custom-user-agent"
product="browser-rendering"
/>

<Render
file="faq"
product="browser-rendering"
/>
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ For more options to control the final screenshot, like `clip`, `captureBeyondVie

## Advanced usage

:::note[Looking for more parameters?]
Visit the [Browser Rendering PDF API reference](/api/resources/browser_rendering/subresources/screenshot/methods/create/) for all available parameters, such as setting HTTP credentials using `authenticate`, setting `cookies`, and customizing load behavior using `gotoOptions`.
:::

### Capture a screenshot of an authenticated page

Some webpages require authentication before you can view their content. To capture a screenshot of these pages, you must provide valid session cookies. The following example navigates to a page that requires login. By providing a valid cookie in the `cookies` array, Browser Rendering will be able to access the secure content in order to capture the screenshot.
Expand Down Expand Up @@ -164,3 +168,8 @@ Many more options exist, like setting HTTP credentials using `authenticate`, set
file="setting-custom-user-agent"
product="browser-rendering"
/>

<Render
file="faq"
product="browser-rendering"
/>
9 changes: 8 additions & 1 deletion src/content/docs/browser-rendering/rest-api/snapshot.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ console.log(snapshot.content);

## Advanced usage

:::note[Looking for more parameters?]
Visit the [Browser Rendering PDF API reference](/api/resources/browser_rendering/subresources/snapshot/methods/create/) for all available parameters, such as setting HTTP credentials using `authenticate`, setting `cookies`, and customizing load behavior using `gotoOptions`.
:::

The `html` property in the JSON payload, it sets the html to `<html><body>Advanced Snapshot</body></html>` then does the following steps:

1. Disable JavaScript.
Expand Down Expand Up @@ -107,4 +111,7 @@ curl -X POST 'https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-
product="browser-rendering"
/>

Many more options exist, like setting HTTP credentials using `authenticate`, setting `cookies`, and using `gotoOptions` to control page load behaviour - check the endpoint [reference](/api/resources/browser_rendering/subresources/snapshot/) for all available parameters.
<Render
file="faq"
product="browser-rendering"
/>
3 changes: 3 additions & 0 deletions src/content/partials/browser-rendering/faq.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Troubleshooting

If you have questions or encounter an error, see the [Browser Rendering FAQ and troubleshooting guide](/browser-rendering/faq/).
Loading