Skip to main content

Prerequisites

Setup

Create main.ts:
import Evocrawl from "npm:@mendable/evocrawl-js";

const evocrawl = new Evocrawl({
  apiKey: Deno.env.get("EVOCRAWL_API_KEY"),
});

Search the web

Add a /search route that searches the web and returns results with full page content.
Deno.serve(async (req) => {
  const url = new URL(req.url);

  if (req.method === "POST" && url.pathname === "/search") {
    const { query } = await req.json();
    const results = await evocrawl.search(query, { limit: 5 });
    return Response.json(results);
  }

  return new Response("Not found", { status: 404 });
});

Scrape a page

Add a /scrape route to extract clean markdown from any URL.
if (req.method === "POST" && url.pathname === "/scrape") {
  const { url: targetUrl } = await req.json();
  const result = await evocrawl.scrape(targetUrl);
  return Response.json(result);
}

Interact with a page

Add an /interact route to control a live browser session — click buttons, fill forms, and extract dynamic content.
if (req.method === "POST" && url.pathname === "/interact") {
  const result = await evocrawl.scrape("https://www.amazon.com", {
    formats: ["markdown"],
  });
  const scrapeId = result.metadata?.scrapeId;

  await evocrawl.interact(scrapeId, {
    prompt: "Search for iPhone 16 Pro Max",
  });
  const response = await evocrawl.interact(scrapeId, {
    prompt: "Click on the first result and tell me the price",
  });
  console.log(response.output);

  await evocrawl.stopInteraction(scrapeId);
  return Response.json({ output: response.output });
}

Run locally

EVOCRAWL_API_KEY=fc-YOUR-API-KEY deno run --allow-net --allow-env main.ts

Deploy

Install the Deno Deploy CLI (deployctl) and deploy:
deployctl deploy --project=my-scraper main.ts
Set the environment variable in the Deno Deploy dashboard or via CLI:
deployctl env set EVOCRAWL_API_KEY=fc-YOUR-API-KEY --project=my-scraper

Test it

curl -X POST https://my-scraper.deno.dev/search \
  -H "Content-Type: application/json" \
  -d '{"query": "evocrawl web scraping"}'

Next steps

Search docs

Search the web and get full page content

Scrape docs

All scrape options including formats, actions, and proxies

Interact docs

Click, fill forms, and extract dynamic content

Node SDK reference

Full SDK reference with crawl, map, batch scrape, and more