A headless browser is a normal browser, such as Chrome or Firefox, controlled by code and run without a visible window. It runs a page’s JavaScript the way a person’s browser would, which a plain HTTP request cannot do.
01What a headless browser is
“Headless” means without the head: the window, tabs and buttons you click. Underneath is the same engine a desktop browser uses. It downloads the page, runs its scripts, applies its styles and builds the final page in memory.
Your code drives it through a library such as Playwright, Puppeteer or Selenium. It can open pages, click, scroll, type, wait for content and read the result, or save a screenshot or a PDF.
Headless browsers are widely used for automated testing, to check that a web app works without anyone clicking through it. They are also how many tools collect data from pages that need JavaScript.
02Why some pages need one
A plain HTTP request gets the HTML the server sends, and nothing more. On a classic site, that HTML already holds the text and prices you want.
Many modern sites send a nearly empty page plus JavaScript, and the script fetches the data and builds the page inside the browser. A plain request only sees the empty shell. Content that loads as you scroll, or after a click, has the same problem.
Some anti-bot checks also send a JavaScript challenge. Only a client that runs JavaScript can pass it, so a real browser is sometimes needed just to get in.
03What it costs
A browser does far more work than a plain request. It downloads scripts, styles, fonts and often images, runs all the code and lays out the page. That takes more memory, more CPU and more time, often seconds per page where a plain request takes a fraction of a second.
Running many at once means managing browser processes, crashes, timeouts and updates. And a headless browser is not invisible: automation leaves traces that anti-bot checks look for, so it is not a free pass.
Here is the smallest useful example, with Playwright for Python:
from playwright.sync_api import sync_playwright with sync_playwright() as p: browser = p.chromium.launch() # headless by default page = browser.new_page() page.goto("https://example.com") print(page.title()) browser.close()
04When you need one
Try plain HTTP first. Open the browser’s developer tools and watch the Network tab while the page loads. Often the data arrives from a JSON endpoint you can call directly, or sits in a script tag inside the first HTML. Either way, no browser needed.
Reach for a headless browser when the content only appears after JavaScript runs and there is no endpoint you can call, when you have to click, scroll or fill in a form to reach it, or when the site’s check needs a real browser.
Use the lightest tool that gets the data. A browser for every request is slow and costly; save it for the pages that truly need one.
05How Zapi uses them
Some Zapi sources need a full browser to reach their data, and we run those browsers for you. Your request looks the same either way: a GET with your x-api-key header, answered with project, data and timestamp.
The difference is the price. A standard call costs 1 Zap and a call that runs in a full browser costs 10 Zap. A result served from cache costs 1 Zap.