Skip to content

Commit 0c38c52

Browse files
authored
Update snapshot.mdx
fix /snapshot endpoint typescript example
1 parent c9e213c commit 0c38c52

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,15 @@ curl -X POST 'https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-
4646
import Cloudflare from "cloudflare";
4747

4848
const client = new Cloudflare({
49-
apiEmail: process.env["CLOUDFLARE_EMAIL"], // This is the default and can be omitted
50-
apiKey: process.env["CLOUDFLARE_API_KEY"], // This is the default and can be omitted
49+
apiToken: process.env["CLOUDFLARE_API_TOKEN"],
5150
});
5251

5352
const snapshot = await client.browserRendering.snapshot.create({
54-
account_id: "account_id",
53+
account_id: process.env["CLOUDFLARE_ACCOUNT_ID"],
54+
url: "https://example.com/",
55+
addScriptTag: [
56+
{ content: "document.body.innerHTML = \"Snapshot Page\";" }
57+
]
5558
});
5659

5760
console.log(snapshot.content);

0 commit comments

Comments
 (0)