pageflock, meet TypeScript.
Add pageflock to a TypeScript service or script. The response starts as unknown so you can validate the fields your application actually uses.
Your first connection.
- 01
Create an API key in Dashboard → API keys. Store it as WAGGLE_API_KEY in your server environment.
- 02
Save the TypeScript example as waggle.ts. In an existing TypeScript project, run it with your normal runner; for a standalone script, install tsx as a development dependency and run npx tsx waggle.ts.
- 03
Check the HTTP status and validate the response before using it. Never put your key in a browser bundle or a NEXT_PUBLIC_ variable.
Tool reference: TypeScript documentation ↗
Build the request.
Set the environment variables in your terminal for these code examples. In automation tools, enter the URL and credentials in the tool’s own fields.
// Server-side TypeScript (Node.js 22+). Never ship the key to a browser.
const apiKey = process.env.WAGGLE_API_KEY;
if (!apiKey) throw new Error("Set WAGGLE_API_KEY");
const response = await fetch("https://pageflock.hyvelabs.tech/api/pageflock/v1/scrape", {
method: "POST",
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
body: JSON.stringify({
"url": "https://example.com"
}),
signal: AbortSignal.timeout(45000),
});
const result: unknown = await response.json();
if (!response.ok) throw new Error(`pageflock HTTP ${response.status}: ${JSON.stringify(result)}`);
console.log(result);
export {};This edits a code example. It does not send a request or use credits.
Run a request in your workspace