[{"data":1,"prerenderedAt":89},["ShallowReactive",2],{"content-\u002Fbuild-with-code\u002Fheadless-browser-api":3,"content-doc-\u002Fbuild-with-code\u002Fheadless-browser-api-inline":3},{"id":4,"title":5,"body":6,"date":80,"description":81,"extension":82,"meta":83,"navigation":84,"order":80,"path":85,"seo":86,"stem":87,"__hash__":88},"content\u002Fbuild-with-code\u002Fheadless-browser-api.md","Headless browser API for Puppeteer and Playwright",{"type":7,"value":8,"toc":74},"minimark",[9,23,38,43,53,63,69],[10,11,18],"infrastructure-hero",{"ctaText":12,"ctaTo":13,"description":14,"min-vh":15,"title":16,"trust":17},"Get API key","https:\u002F\u002Fcode.axiom.ai","Our headless browser API gives your code a real Chromium in the cloud. Point Puppeteer or Playwright at one WebSocket and your scripts run as they are. No Chrome to install, no servers to patch, no browsers to restart.","70","A headless browser API\nfor your stack.\n","Every new account gets 2 hours of free runtime and free AI tokens. No card required.",[19,20],"global-hero-animation",{":aura":21,":grid":22,":shapes":22,":spotlight":22},"false","true",[24,25,26,31,34],"one-col",{},[27,28,30],"h2",{"id":29},"what-i-mean-by-a-headless-browser-api","What I mean by a headless browser API",[32,33],"hr",{},[35,36,37],"p",{},"Running headless Chrome yourself means a server, a Chromium build to keep current, memory leaks, zombie processes and a restart script at 2am. A headless browser API moves the browser off your machine. Your script opens a session over a WebSocket, drives the page with the protocol it already speaks, and closes it. Each session starts on fresh Chrome, so one bad run never poisons the next. You keep your code. We keep the browsers.",[39,40],"api-code-example",{"caption":41,"example":42},"Change launch() to connectOverCDP(). The rest of the script stays the same.","chrome",[44,45],"feature-grid-staggered",{":items":46,":reverse-stagger":22,"description":47,"eyebrow":48,"link":49,"linkText":50,"title":51,"variant":52},"[{\"title\":\"Chrome API\",\"description\":\"A CDP WebSocket to fresh headless Chrome. Puppeteer, Playwright or any CDP client, with full protocol access.\",\"bullets\":[\"Existing scripts run as-is\",\"Execute JavaScript in the page\",\"Per-session proxy, viewport and user agent\"],\"link\":\"\u002Fbuild-with-code\u002Fapi\u002Fchrome\",\"linkText\":\"Read about the Chrome API\"},{\"title\":\"Step API\",\"description\":\"High-level browser actions as Node functions. Scrape a paginated list, fill a form or solve a captcha in one call.\",\"bullets\":[\"Waits and retries built in\",\"Mix with raw CDP in the same session\",\"Exposed to agents over MCP\"],\"link\":\"\u002Fbuild-with-code\u002Fapi\u002Fstep\",\"linkText\":\"Read about the Step API\"},{\"title\":\"Orchestrate API\",\"description\":\"Trigger saved bots over REST and read back their runs. For cron, queues, serverless and CI.\",\"bullets\":[\"Trigger from anywhere that sends HTTP\",\"Poll run status and data\",\"Schedules and retries\"],\"link\":\"\u002Fbuild-with-code\u002Fapi\u002Forchestrate\",\"linkText\":\"Read about the Orchestrate API\"}]","Start with raw CDP for the scripts you already have. Use step functions when you'd rather not write the waits and loops. Trigger whole saved bots over REST.","One runtime","\u002Fbuild-with-code\u002Fapi","See the API","Three layers on one headless browser API.","solid",[24,54,55],{},[56,57],"build-with-code",{"code":58,"description":59,"filename":60,"primaryText":12,"primaryTo":13,"sectionId":61,"title":62},"import { AxiomApi } from '@axiom_ai\u002Fapi';\n\nconst axiom = new AxiomApi(process.env.AXIOM_API_KEY);\n\nawait axiom.browserOpen();\ntry {\n  const rows = await axiom.scrape(\n    'https:\u002F\u002Fexample.com\u002Fproducts',\n    '.product-card',\n    'button[data-load-more]',\n    200,\n    {}\n  );\n  console.log(rows.length);\n} finally {\n  await axiom.browserClose();\n}\n","Open a cloud session, scrape a paginated list with one step call, and close it. Swap the selectors for your own page.","scrape.mjs","code","Scrape 200 rows with the headless browser API",[64,65],"faq-list",{":faqs":66,"eyebrow":67,"title":68},"[{\"question\":\"Do I have to rewrite my Puppeteer or Playwright scripts?\",\"answer\":\"No. Replace launch() with connect() or connectOverCDP() pointed at our WebSocket. The rest of the script stays the same.\"},{\"question\":\"How is runtime charged?\",\"answer\":\"By the time a session is open. Close sessions as soon as the work is done. Every new account starts with 2 hours of free runtime and free AI tokens.\"},{\"question\":\"Is each session a fresh browser?\",\"answer\":\"Yes. Every session starts on fresh Chrome, so cookies and state don't carry between runs unless you set them.\"},{\"question\":\"Can I use a proxy?\",\"answer\":\"Yes. Set a proxy per session, along with viewport and user agent.\"},{\"question\":\"Can an AI agent use the headless browser API?\",\"answer\":\"Yes. The step functions are exposed over MCP, so Claude, Cursor or your own agent can drive the browser on your API key.\"}]","FAQ","Headless browser API questions",[70,71],"call-to-action",{"headline":72,"linkText":12,"linkTo":13,"text":73},"Run your first script on our headless browser API.","Start with 2 hours of free runtime and free AI tokens for AI steps. No card required.",{"title":75,"searchDepth":76,"depth":76,"links":77},"",3,[78],{"id":29,"depth":79,"text":30},2,null,"A headless browser API on cloud Chrome. Connect Puppeteer, Playwright or any CDP client with one line, or call step functions from Node. No Chrome to run.","md",{},true,"\u002Fbuild-with-code\u002Fheadless-browser-api",{"title":5,"description":81},"build-with-code\u002Fheadless-browser-api","8WnExfCjY2z-fz6Nm1for7YWKZfD5-kUPm6Qu_VSXCs",1795197502322]