Skip to content

Commit 656eaee

Browse files
authored
Update snapshot.mdx
- add subheadings - update to same style as pdf endpoint
1 parent 2530892 commit 656eaee

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/content/docs/browser-rendering/rest-api/snapshot.mdx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,27 @@ import { Tabs, TabItem, Render } from "~/components";
99

1010
The `/snapshot` endpoint captures both the HTML content and a screenshot of the webpage in one request. It returns the HTML as a text string and the screenshot as a Base64-encoded image.
1111

12+
## Endpoint
13+
14+
```txt
15+
https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-rendering/snapshot
16+
```
17+
18+
## Required fields
19+
You must provide either `url` or `html`:
20+
- `url` (string)
21+
- `html` (string)
22+
23+
## Common use cases
24+
25+
- Capture both the rendered HTML and a visual screenshot in a single API call
26+
- Archive pages with visual and structural data together
27+
- Build monitoring tools that compare visual and DOM differences over time
28+
1229
## Basic usage
1330

31+
### Capture a snapshot from a URL
32+
1433
<Tabs syncKey="workersExamples"> <TabItem label="curl">
1534

1635
1. Go to `https://example.com/`.
@@ -64,6 +83,8 @@ console.log(snapshot.content);
6483

6584
## Advanced usage
6685

86+
### Create a snapshot from custom HTML
87+
6788
The `html` property in the JSON payload, it sets the html to `<html><body>Advanced Snapshot</body></html>` then does the following steps:
6889

6990
1. Disable JavaScript.

0 commit comments

Comments
 (0)