Meta description: Stop maintaining your own browser farm. Learn how Browser Automation APIs handle headless Chrome sessions, JavaScript rendering, stealth fingerprinting, and natural-language browser control — with code examples in Python and Node.js.
Primary keyword: Browser Automation API
Secondary keywords: headless browser API, browser automation endpoint, Playwright API alternative, browser session API, Stagehand API, stealth browser API
Pillar page: Ollagraph Web Scraping & Extraction
Related cluster articles:
- Extract Structured Data from JavaScript Apps
- Web Scraping at Scale: Architecture, Proxy Rotation, and Anti-Bot Strategies
- How AI Agents Access the Web: APIs, Browsers, and MCP Servers
- JavaScript Rendering Effects on ChatGPT, Claude, and Perplexity
- Web Scraping API: Scrape Any Website
Last updated: 2026-07-29
Versions tested: Playwright 1.48, Puppeteer 22, Selenium 4.25, Stagehand 1.0
Executive Summary
A Browser Automation API is a managed HTTP endpoint that spins up a headless Chromium browser instance, navigates to a URL, executes JavaScript, handles interactions, and returns the rendered result — without you installing a single browser binary. Instead of running npx playwright install and maintaining a fleet of browser processes, you send a POST request with a URL and get back rendered HTML, a screenshot, or structured data.
The short version: If you need to render one JavaScript page a day, run Playwright locally. If you need a thousand pages an hour with stealth, proxies, and CAPTCHA handling, use an API.
Key Takeaways
- A Browser Automation API replaces self-hosted Playwright/Puppeteer infrastructure with a single HTTP endpoint.
- Persistent browser sessions let you reuse a browser context across multiple steps — login, navigate, extract, repeat.
- Stealth mode is not optional. Without it, headless Chrome is trivially detectable by Cloudflare, DataDome, and PerimeterX.
- Stagehand-style natural-language control lets you describe what to do instead of writing CSS selectors.
- Session-based APIs cost less per action than one-shot renders because the browser stays warm.
- The break-even point between self-hosted and API is roughly 50,000 pages per month.
- CAPTCHA solving integrated into the browser flow doubles success rates on protected sites.
1. Problem Statement
You need data from a website that requires JavaScript. Maybe it is a React SPA that ships an empty <div id="root"> and loads content via API calls after hydration. Maybe it is a SaaS dashboard that renders charts client-side. A plain HTTP GET returns nothing useful. You need a real browser.
So you install Playwright. You write a script that launches a browser, navigates to the URL, waits for the right selector, and extracts the content. It works on your laptop. You deploy it to a server.
Then the problems start. The server runs out of memory because each browser instance consumes 200-400 MB of RAM. Cloudflare blocks your requests because headless Chrome has a detectable fingerprint. A site updates its DOM and your selector breaks. A CAPTCHA appears and your script hangs. You need to rotate proxies but your browser library does not support it natively. You scale to ten concurrent pages and your server falls over.
This is the reality of browser automation at any scale beyond a hobby project. The browser itself is not the hard part. The infrastructure around it — stealth patches, proxy management, CAPTCHA solving, session persistence, concurrency control, monitoring — is the hard part. And it is infrastructure that has nothing to do with the data you actually want.
A Browser Automation API exists to abstract that entire layer away. You send a request. You get data back. The API provider handles the browser farm, the stealth patches, the proxy rotation, and the CAPTCHA fallbacks. Your job is to describe what you need, not to keep a Chromium process alive.
2. History & Context
Browser automation started with Selenium in 2004. Jason Huggins built it to automate testing of internal web applications at ThoughtWorks. Selenium WebDriver became the W3C standard. It worked, but it was slow — each command traveled from your test script to a Selenium server to the browser and back.
In 2017, Google released Puppeteer. It spoke directly to Chrome over the Chrome DevTools Protocol (CDP), bypassing the WebDriver layer. Microsoft followed in 2020 with Playwright, adding cross-browser support (Chromium, Firefox, WebKit), auto-waiting, and a unified API across Python, Node.js, Java, and .NET.
Both libraries solved the browser control problem. Neither solved the infrastructure problem. Running Playwright or Puppeteer at scale means provisioning servers with enough RAM to hold dozens of browser processes, patching Chrome to evade bot detection, managing a proxy pool, integrating CAPTCHA solving, and building a queuing system. Managed services such as Ollagraph emerged to offer this as a service.
The 2025-2026 shift has been toward LLM-driven browser control. Stagehand, an open-source project, introduced natural-language browser actions that you run on top of your own Playwright browser. Ollagraph does not offer natural-language control; its browser endpoints take explicit selectors and JavaScript.
The second major shift is stealth. Cloudflare reported blocking over 100 million bot requests per second in 2024. Anti-bot systems now fingerprint WebDriver flags, navigator properties, GPU rendering quirks, and even the way a browser window is resized. Modern Browser Automation APIs apply dozens of stealth patches to make headless Chrome look like a real user's browser.
The third shift is session persistence. Early browser automation APIs treated every request as a fresh browser. Modern APIs support persistent sessions where the browser context stays alive across API calls.
3. What Is a Browser Automation API?
A Browser Automation API is an HTTP service that manages headless browser instances on your behalf. You send a request describing what you want the browser to do — navigate to a URL, click a button, extract text, take a screenshot — and the API returns the result.
Definition box:
Browser Automation API: A REST or WebSocket endpoint that provisions a headless Chromium (or Firefox/WebKit) instance, executes navigation and interaction commands, and returns rendered output. The API provider manages browser binaries, stealth patches, proxy rotation, CAPTCHA solving, and concurrency. The consumer sends HTTP requests and receives structured responses.
The key distinction from a traditional web scraping API is interactivity. A scraping API fetches a page and returns its content. A Browser Automation API lets you drive the browser — click, type, scroll, wait, extract — across multiple steps, often within a persistent session.
There are three tiers:
- Tier 1 — Render APIs. Send a URL, get back rendered HTML or a screenshot. No session. Example: Ollagraph /v1/render and /v1/screenshot, plus /v1/scrape, which can also run a few page actions (click/type/scroll) and a JavaScript expression on the loaded page before capture.
- Tier 2 — Session APIs. Open a persistent browser session, then issue multiple commands against it. Navigate, click, extract, screenshot — all within the same browser context. Example: hosted session providers, or a Playwright context you run yourself. Ollagraph does not offer this tier.
- Tier 3 — LLM-Driven APIs. Describe what you want in natural language. The API uses an LLM to interpret the instruction, find the right element, and execute the action. Example: the open-source Stagehand library on top of Playwright. Ollagraph does not offer this tier.
Each tier adds capability at the cost of latency and complexity. Tier 1 is a single HTTP request-response. Tier 2 requires session management. Tier 3 requires an LLM call per action, adding 1-3 seconds per step.
4. Architecture: How a Browser Automation API Works
Understanding what happens when you call a Browser Automation API helps you debug failures and optimize performance. Here is the full request path.
Request Flow
Your Code → API Gateway → Orchestrator → Browser Pool → Proxy Layer → Target Website
↓
Your Code ← API Gateway ← Response Parser ← CDP Commands ← Rendered Page - Step 1 — Authentication. Your request carries an API key. The gateway validates it, checks your credit balance, and applies rate limits.
- Step 2 — Orchestration. The orchestrator selects an available browser instance from the pool. If you requested a new session, it provisions a fresh Chromium process. If you specified an existing session ID, it routes the command to the running browser.
- Step 3 — Browser Execution. The orchestrator sends CDP commands to the browser. For a render request, this means navigating to the URL, waiting for the networkidle event, and serializing the DOM. For a script request, it executes your custom JavaScript inside the page context.
- Step 4 — Stealth Injection. Before navigation, the orchestrator injects stealth scripts that override detectable headless properties. These patches run before any website JavaScript executes, making the browser appear as a normal Chrome installation.
- Step 5 — Proxy Routing. The request goes through a proxy. The provider selects an IP based on your proxy configuration — datacenter, residential, or sticky. The proxy layer handles rotation, retries, and geotargeting.
- Step 6 — Response Assembly. The rendered DOM, screenshot bytes, or extracted data is serialized and returned as JSON. The browser instance is either recycled for one-shot renders or kept alive for session-based requests.
Session Lifecycle
Session-based APIs (and your own Playwright contexts) maintain a browser context across multiple calls:
- Create Session — a create call returns a session ID (in Playwright, browser.new_context()).
- Navigate — load a URL inside that context.
- Interact — run custom JS in the page context.
- Extract — Read rendered HTML or take a screenshot.
- Keep Alive — Send periodic keepalive requests to prevent idle timeout.
- Close — a close call (or context.close()) releases the browser and frees resources.
The session stays alive as long as you send commands within the idle timeout window, typically 30-300 seconds. If the timeout expires, the provider recycles the browser automatically. Ollagraph has no session tier: every call is a fresh browser and nothing persists between calls.
Stagehand Architecture
Stagehand adds an LLM layer on top of the browser. The flow: create a Stagehand session with your LLM provider, navigate to a URL, send natural-language instructions such as “click the search bar and type ‘laptops’”, and extract data with a JSON schema. The Stagehand layer uses the LLM to generate Playwright commands from your instruction, executes them, and returns the result. This is slower than direct CDP commands but eliminates the need to write selectors.
5. Components & Workflow
A production Browser Automation API consists of several components working together. Understanding each helps you make better decisions about configuration, error handling, and cost optimization.
Core Components
- Browser Pool. A pre-warmed pool of Chromium processes. The pool maintains a minimum number of idle browsers to serve requests immediately. When demand spikes, the pool scales up by provisioning new containers. Each browser runs in an isolated sandbox with resource limits.
- Stealth Engine. A collection of JavaScript patches applied before any page content loads. These patches override navigator.webdriver, populate navigator.plugins with realistic arrays, spoof chrome.runtime, match WebGL renderer strings to real GPU hardware, and set screen dimensions to realistic values instead of headless defaults.
- Proxy Manager. Routes browser traffic through IP addresses matching your target. Datacenter proxies are cheap and fast but easily blocked. Residential proxies are expensive but bypass most geo-restrictions. Sticky sessions keep the same IP across multiple requests to avoid triggering session-based anti-bot rules.
- CAPTCHA Solver. Integrated into the browser flow. When the browser encounters a CAPTCHA, the solver intercepts the challenge, sends it to a solving service, and injects the solution — all within the same browser session, preserving cookies and session state.
- Session Manager. Tracks active browser sessions, their idle time, and resource usage. When a session times out, the manager takes a final screenshot, closes the browser, and frees the container.
Typical Workflow
A typical multi-step extraction using a session-based API follows this pattern: create a session with stealth mode and a US residential proxy, navigate to the login page, run a script to fill in credentials, wait for navigation, navigate to the target page, wait for a specific selector, extract the rendered HTML or run a custom script, take a screenshot for verification, and close the session. Each step is a separate API call. The browser stays alive between calls, maintaining cookies, localStorage, and session state.
6. Configuration & Setup
Prerequisites
- An API key from Ollagraph.
- HTTP client library: curl, requests for Python, axios or fetch for Node.js.
- Basic understanding of browser concepts: DOM, selectors, network requests.
Getting Started with Ollagraph Browser Automation API
Step 1 — Get an API key. Sign up at ollagraph.com and generate an API key from the dashboard. Keys start with osk_.
Every Ollagraph call is stateless: a fresh browser per request, nothing kept between calls.
Step 2 — Make your first render request.
curl -X POST https://api.ollagraph.com/v1/render \
-H "Authorization: Bearer $OLLAGRAPH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com"}' The response includes html (post-hydration), url, final_url, status_code, and tier_used.
Step 3 — Interact and run custom JavaScript in one call.
curl -X POST https://api.ollagraph.com/v1/scrape \
-H "Authorization: Bearer $OLLAGRAPH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://target-site.com/products",
"wait_until": "networkidle0",
"actions": [
{"action": "click", "selector": "button.load-more"},
{"action": "scroll_to_bottom"}
],
"js_eval": "JSON.stringify(Array.from(document.querySelectorAll(\".product-price\")).map(el => el.textContent))"
}' Actions run once on the loaded page before capture. The value of js_eval comes back in eval_result. Actions do not wait for a navigation, so they cannot log in — run login flows in your own Playwright code.
Step 4 — Take a screenshot.
curl -X POST https://api.ollagraph.com/v1/screenshot \
-H "Authorization: Bearer $OLLAGRAPH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://target-site.com/products", "full_page": true}' \
--output products.png Configuration Options (/v1/scrape)
- stealth — Values: true, false (default true). Description: Apply anti-detection patches.
- proxy — Values: proxy URL (optional). Description: Route the request through your own proxy.
- wait_until — Values: load (default), domcontentloaded, networkidle0. Description: Condition for considering page loaded.
- timeout — Values: seconds, 1-60 (default 30). Description: Maximum time to wait for page load.
- actions — Values: list of up to 50 (click, type, scroll_to_bottom). Description: Page actions run once before capture.
- js_eval — Values: JavaScript expression. Description: Evaluated in the page; value returned in eval_result.
7. Code Examples
Python — One-Shot Render
import os
import requests
API_KEY = os.environ["OLLAGRAPH_API_KEY"]
BASE_URL = "https://api.ollagraph.com"
response = requests.post(
f"{BASE_URL}/v1/render",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
},
json={"url": "https://example.com"}
)
data = response.json()
print(f"Rendered {len(data['html'])} bytes of HTML")
print(f"Final URL: {data['final_url']}") Python — Login Flow in Your Own Playwright Code
Ollagraph's endpoints are stateless and cannot log in or keep cookies between calls, so an authenticated dashboard is your own Playwright code (sync API shown):
# Your own Playwright code — not an Ollagraph API
import json
from playwright.sync_api import sync_playwright
with sync_playwright() as pw:
browser = pw.chromium.launch()
context = browser.new_context()
page = context.new_page()
# Steps 1-2: log in
page.goto("https://target-site.com/login", wait_until="networkidle")
page.fill("#username", "myuser")
page.fill("#password", "mypassword")
page.click('button[type="submit"]')
page.wait_for_url("**/dashboard")
# Step 3: extract data from the authenticated page
data = page.evaluate("""() => ({
total_revenue: document.querySelector('.revenue-value')?.textContent?.trim(),
active_users: document.querySelector('.user-count')?.textContent?.trim(),
recent_orders: Array.from(document.querySelectorAll('.order-row')).map(row => ({
id: row.querySelector('.order-id')?.textContent?.trim(),
amount: row.querySelector('.order-amount')?.textContent?.trim(),
status: row.querySelector('.order-status')?.textContent?.trim()
}))
})""")
print(json.dumps(data, indent=2))
# Step 4: close
context.close()
browser.close() Node.js — Page Actions and JS Extraction with /v1/scrape
For public pages, one /v1/scrape call can click, scroll, and evaluate JavaScript before the page is captured. (For natural-language actions, the open-source Stagehand library runs on top of your own Playwright browser; Ollagraph does not offer it.)
const API_KEY = process.env.OLLAGRAPH_API_KEY;
const BASE_URL = "https://api.ollagraph.com";
async function scrapeProducts() {
const resp = await fetch(`${BASE_URL}/v1/scrape`, {
method: "POST",
headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
url: "https://example.com/products",
wait_until: "networkidle0",
actions: [
{ action: "click", selector: "button.load-more" },
{ action: "scroll_to_bottom" }
],
js_eval: "JSON.stringify(Array.from(document.querySelectorAll('.product')).map(p => ({name: p.querySelector('.name')?.textContent?.trim(), price: p.querySelector('.price')?.textContent?.trim()})))"
})
});
const data = await resp.json();
const products = JSON.parse(data.eval_result);
console.log(JSON.stringify({ products }, null, 2));
}
scrapeProducts(); 8. Performance & Benchmarks
We have not published a controlled benchmark of /v1/render, and numbers measured on someone else's targets rarely transfer to yours. Run the comparison yourself before you commit: pick 30-50 of the JavaScript-heavy pages you actually need, send each one through your self-hosted setup and through /v1/render, and record median and P95 latency, the share of calls that return usable content (not a challenge page or an empty shell), and the cost per successful page. Each /v1/render response includes status_code and tier_used, which help explain the failures you see.
Cost Comparison
- 1,000 renders — Self-Hosted (monthly): $150 (server + proxy). Ollagraph API (monthly): 1,000 credits.
- 10,000 renders — Self-Hosted (monthly): $350 (server + proxy). Ollagraph API (monthly): 10,000 credits.
- 100,000 renders — Self-Hosted (monthly): $1,200 (2 servers + proxy pool). Ollagraph API (monthly): 100,000 credits.
- 1,000,000 renders — Self-Hosted (monthly): $8,000 (cluster + proxy infra). Ollagraph API (monthly): 1,000,000 credits.
Self-hosted costs assume a dedicated server at $150/month, residential proxy pool at $200/month per 50 IPs, and engineering time for maintenance estimated at 10 hours/month at $100/hour. Ollagraph bills /v1/render at 1 credit per call, refunds failed calls, and gives 1,000 free credits on signup; see the pricing page for current credit-pack prices. The break-even point is around 50,000 renders per month.
9. Security Considerations
API Key Management. Treat your API key like a database password. Store it in environment variables or a secrets manager, never in code. Use different keys for development and production. Set daily credit caps on production keys to prevent runaway spending.
Data in Transit. All API calls should use HTTPS. If you are extracting sensitive data (PII, financial information), verify that your provider encrypts data at rest and offers data retention policies.
Session Hijacking. Persistent browser sessions maintain cookies, authentication tokens, and localStorage. If a session ID leaks, an attacker can reuse it. Treat session IDs as sensitive tokens. Rotate them after each login flow. Close sessions explicitly when you are done.
Bot Detection Risks. Using a Browser Automation API to access websites that prohibit automated access may violate terms of service. Some jurisdictions have laws regulating web scraping (GDPR, hiQ Labs vs. LinkedIn). Consult your legal team before extracting data at scale.
Provider Security. Evaluate your provider's security posture. Do they isolate browser sessions in sandboxed containers? Do they log the URLs you visit? Ollagraph runs a fresh browser for every call, keeps nothing between calls, and does not store page content — only request metadata.
10. Troubleshooting
Empty or Partial Rendered HTML
Problem: The API returns HTML that is mostly empty or missing the content you expect.
Causes and fixes:
- Slow SPA. Increase timeout to 60 seconds. Change wait_until to networkidle.
- Lazy-loaded content. Use the actions parameter to scroll before extraction.
- Login required. Use a session-based approach (for example your own Playwright context). Authenticate first, then navigate to the target page. A stateless API such as Ollagraph cannot carry a login between calls.
- Anti-bot detection. Enable stealth: true. If it still fails, try a residential proxy.
Session Timeout
Problem: A session becomes unresponsive after inactivity. Fix: Send a keepalive request before the idle timeout expires. Set your keepalive interval to half the idle_ttl_seconds value.
CAPTCHA Interception
Problem: The browser hits a CAPTCHA page. Fix: Enable automatic CAPTCHA solving. For aggressive CAPTCHA triggers, reduce request frequency and use residential proxies.
Stealth Detection
Problem: The target site returns a block page. Causes and fixes: Switch to a residential proxy. Ensure stealth: true is set. Add delays between requests.
High Latency
Problem: Render requests take 10+ seconds. Causes and fixes: Use a session-based API to keep the browser warm. Set a lower timeout and retry. Switch to a datacenter proxy for faster requests. Block images and fonts where your tool supports it (for example page.route() in Playwright).
11. Best Practices
- Use sessions for multi-step workflows. If you need to navigate, log in, and extract data, use a persistent session. Each step in a session reuses the same browser, cookies, and proxy. One-shot renders create a new browser for every request, losing all state.
- Set realistic timeouts. Start with 30 seconds. If your target is a heavy SPA, increase to 60 seconds. Timeouts that are too short cause false failures. Timeouts that are too long waste credits on pages that will never load.
- Implement retry logic with exponential backoff. Browser automation is inherently unreliable. Networks fail. Servers crash. Anti-bot systems block. Retry failed requests with 1s, 3s, 9s backoff. Cap at five retries.
- Monitor credit consumption. Most browser automation APIs return credit cost in response headers. Log these. Set up alerts when daily consumption exceeds a threshold. A runaway loop in your extraction pipeline can burn through credits in minutes.
- Use the minimum viable browser. If you only need rendered HTML, use a render API, not a session. If you only need structured data, use an extraction API, not a browser. Browser automation is the most expensive and slowest option. Use it only when simpler approaches fail.
- Close sessions explicitly. Every open session consumes server resources. If your code crashes without closing a session, the provider eventually times it out, but you waste resources in the meantime. Use try/finally or context managers to ensure cleanup.
12. Common Mistakes
- Treating a browser automation API like a web scraping API. A render API returns the full DOM. If you only need a specific data point — a product price, a stock ticker — use a structured extraction endpoint instead. You pay for the full page render and then parse it yourself.
- Not handling CAPTCHAs. Developers assume their target site does not use CAPTCHAs because a manual browser visit works fine. CAPTCHAs are often triggered by automated access patterns — headless browser fingerprints, high request rates, missing cookies. Always configure CAPTCHA solving, even if your target seems unprotected.
- Ignoring the idle timeout. A session that sits idle for too long gets recycled. If your workflow has a long pause between steps, send a keepalive request. Losing a session mid-workflow means losing authentication state and starting over.
- Using datacenter proxies for protected sites. Datacenter IPs are cheap and fast, but Cloudflare, Akamai, and PerimeterX block them aggressively. If your target uses any anti-bot protection, residential proxies are not optional. The success rate difference is often 40 percentage points.
- Scaling too fast. A sudden burst of requests from a single IP triggers rate limiting on most sites. Ramp up request volume gradually. Use session-based APIs to maintain consistent fingerprints. Distribute requests across multiple proxy regions.
- Forgetting to close sessions. Each open session holds a browser process in memory. If you create sessions and never close them, you eventually hit your concurrency limit. Always close sessions in a finally block.
13. Alternatives & Comparison
Self-Hosted Playwright
Playwright is the gold standard when you control the infrastructure. It is free, open-source, and gives you full control over browser configuration.
Pros: No per-request cost, offline capable, no data leaves your network.
Cons: You manage browser binaries, stealth patches, proxy pools, CAPTCHA solving, and scaling. Each browser instance consumes 200-400 MB of RAM. Anti-bot evasion requires constant updates.
Best for: Teams with dedicated infrastructure engineering or low-volume automation.
Self-Hosted Puppeteer
Puppeteer is Google's browser automation library. It is lighter than Playwright but only supports Chromium.
Pros: Lightweight, Google-maintained, excellent CDP support.
Cons: Chromium only, no auto-waiting, same infrastructure burden as Playwright.
Best for: Projects already invested in the Puppeteer ecosystem.
Browserless
Browserless is a managed browser API focused on simplicity. It offers render, screenshot, and PDF endpoints.
Pros: Simple API, good documentation, open-source self-hosted option.
Cons: Limited session support, no LLM-driven control, smaller proxy network.
Best for: Simple rendering and screenshot needs.
BrowserStack
BrowserStack offers cloud-based browser testing with real devices.
Pros: Real mobile devices, extensive browser version matrix.
Cons: Expensive for data extraction, not optimized for stealth, designed for testing not scraping.
Best for: Cross-browser testing, not production data extraction.
Ollagraph Browser Automation API
Ollagraph covers the stateless tier: one-shot render (/v1/render), JS rendering + page actions (click/type/scroll) + JS eval (/v1/scrape), screenshots (/v1/screenshot), and batch/async scraping. Includes stealth mode, residential proxy opt-in, and CAPTCHA solving on /v1/scrape. Every call is a fresh browser.
Pros: Stealth + proxies + CAPTCHA in one API, JavaScript rendering at no extra credit cost, failed calls refunded, credit-based pricing with no monthly minimum.
Cons: Per-request cost, internet dependency, provider lock-in, no persistent sessions, logins, or natural-language control.
Best for: Production extraction of public, JavaScript-heavy pages and teams that want to avoid browser infrastructure for those steps. Logins and multi-step sessions stay in your own Playwright code.
Comparison Table
Feature Self-Hosted Playwright Browserless BrowserStack Ollagraph API
Setup time Days to weeks Minutes Minutes Minutes
Stealth mode Manual patches Basic None Built-in
Residential proxies Self-managed Limited No Yes
CAPTCHA solving External integration No No Built-in
Persistent sessions Yes (self-managed) Limited Yes (testing) No (stateless; fresh browser per call)
LLM-driven control No No No No (page actions (click/type/scroll) + JS eval)
Cost at 10K/month ~$350 ~$100 ~$400 10,000 credits (1 per render)
Success rate (JS sites) ~72% ~80% ~75% Not published 14. Enterprise / Cloud Deployment
Scaling Considerations
Browser automation APIs scale horizontally by design. The provider manages the browser pool, so your scaling concern shifts from infrastructure to request throughput and rate limiting.
- Concurrency limits. Most providers cap concurrent sessions; Ollagraph has no sessions and rate-limits requests instead. Your code should implement a semaphore or queue to stay within the limit, or use /v1/scrape/batch with its concurrency setting.
- Geographic distribution. If your targets are spread across regions, use proxy regions that match. A US residential proxy for US sites, EU proxies for EU sites. Mismatched geolocation triggers suspicion and blocks.
- Webhook-based async processing. For high-volume extraction, use async endpoints (/v1/scrape/async, /v1/scrape/batch/async with a webhook_url). Send the request, get a job ID, and receive the result via webhook. This avoids HTTP timeout issues and lets you process results as they arrive.
Observability
Every Browser Automation API call should be logged with request URL, response status, latency, credit cost, session ID, and error type. Set up dashboards for success rate per target domain, average and P95 latency, credit consumption per workflow, and session creation rates. Log this to a metrics system and set alerts for anomalous spikes.
Multi-Tenant Usage
If multiple teams use the same API, use separate API keys per team. This lets you attribute costs, set independent rate limits, and revoke access without affecting other teams. Ollagraph supports project tags on API keys for cost attribution.
15. FAQs
Q1. What is a Browser Automation API and how is it different from a web scraping API?
A Browser Automation API controls a real browser — navigating pages, clicking buttons, typing text, and extracting data after JavaScript executes. A web scraping API typically fetches raw HTML and returns it. The scraping API is faster and cheaper but cannot handle JavaScript-rendered content or interactive workflows.
Q2. Can I use a Browser Automation API to log into websites?
Yes. Session-based APIs are designed for exactly this. You create a session, navigate to the login page, fill in credentials using a custom script, wait for the post-login redirect, and then navigate to authenticated pages. The session maintains cookies and authentication state across all subsequent requests. Ollagraph's endpoints are stateless and cannot log in; run logins in your own Playwright code.
Q3. How do Browser Automation APIs avoid bot detection?
They apply stealth patches before any website JavaScript runs. These patches override navigator.webdriver, populate navigator.plugins with realistic values, match WebGL renderer strings to real GPU hardware, and set screen dimensions to realistic values. Combined with residential proxies, modern stealth engines make headless Chrome nearly indistinguishable from a real browser.
Q4. What is the difference between a render API and a session API?
A render API is a single request-response. You send a URL, you get back rendered HTML. No state is preserved between requests. A session API creates a persistent browser context. You get a session ID, then issue multiple commands — navigate, click, extract, screenshot — all within the same browser. Sessions preserve cookies, localStorage, and authentication.
Q5. How much does a Browser Automation API cost?
Pricing varies by provider and volume. Ollagraph bills in credits: most calls, including /v1/render and /v1/scrape, cost 1 credit; /v1/screenshot costs 3. Failed calls are refunded, and new accounts get 1,000 free credits. Most providers offer a free tier with limited credits for evaluation.
Q6. What happens when a session times out?
The provider closes the browser and frees the resources. Any subsequent request using that session ID returns an error. The session's cookies, localStorage, and authentication state are lost. Send keepalive requests at regular intervals — typically at half the idle timeout value — to prevent this.
Q7. Can I run custom JavaScript in the browser?
Yes. Session-based APIs expose a script endpoint that lets you execute arbitrary JavaScript in the page context. You can read DOM properties, call functions, intercept network responses, or modify the page. The script runs in the browser's JavaScript engine and can return serializable values. With Ollagraph, pass a JavaScript expression in js_eval on /v1/scrape; its value comes back in eval_result.
Q8. Is a Browser Automation API suitable for real-time applications?
Cold renders take 3-5 seconds. Warm session renders take 1-3 seconds. If your application needs sub-second responses, a Browser Automation API is not the right tool. Consider using a structured data API or caching layer instead.
Q9. How do I handle CAPTCHAs with a Browser Automation API?
Use a provider that integrates CAPTCHA solving into the browser flow. When the browser encounters a CAPTCHA, the solver intercepts the challenge, sends it to a solving service, and injects the solution — all within the same session. This preserves cookies and session state.
Q10. What is Stagehand and how does it relate to browser automation?
Stagehand is an open-source framework that adds an LLM layer on top of Playwright. Instead of writing CSS selectors, you describe what you want in natural language: "click the search bar and type 'laptops'". Stagehand uses an LLM to interpret the instruction, find the right element, and execute the action. Ollagraph does not offer Stagehand; you run it yourself on top of Playwright.
16. Conclusion
Browser Automation APIs have matured from a niche convenience into a core piece of web infrastructure. If you are extracting data from JavaScript-heavy websites, automating login workflows, or building AI agents that browse the web, a managed browser API saves you from maintaining the most painful part of the stack: stealth patches, proxy management, CAPTCHA solving, and browser scaling.
The decision between self-hosted and API comes down to volume and engineering bandwidth. Below 50,000 renders per month, the API is almost always cheaper and faster to implement. Above that threshold, self-hosted can be more cost-effective if you have the team to maintain it. But the hidden cost of self-hosted is not the server — it is the constant cat-and-mouse game with anti-bot systems that change their detection methods weekly.
Start with a render API for simple JavaScript rendering. Graduate to session-based APIs when you need multi-step workflows. Add Stagehand when you want AI agents to control the browser in natural language. Each tier adds capability at a predictable cost.
Ollagraph covers the first tier — rendering, page actions (click/type/scroll), JS eval, screenshots, and batch/async scraping — behind a single API key; run session and Stagehand-style steps in your own Playwright code. Sign up at ollagraph.com and use the 1,000 free credits. No browser binaries to install, no stealth patches to maintain, no CAPTCHA services to integrate. Just an HTTP call and the data you need.
17. References
- Ollagraph API Documentation. https://ollagraph.com/docs/
- Stagehand — LLM-Driven Browser Automation. https://github.com/browserbase/stagehand
- Playwright Documentation. https://playwright.dev/docs/intro
- Puppeteer Documentation. https://pptr.dev/
- Chrome DevTools Protocol (CDP). https://chromedevtools.github.io/devtools-protocol/
- W3C WebDriver Specification. https://www.w3.org/TR/webdriver/
- Selenium Documentation. https://www.selenium.dev/documentation/
- Browserless API Documentation. https://www.browserless.io/docs/
- BrowserStack Automate Documentation. https://www.browserstack.com/docs/automate
- Cloudflare Bot Management. https://www.cloudflare.com/products/bot-management/
- hiQ Labs, Inc. v. LinkedIn Corp. — Ninth Circuit ruling on web scraping legality. https://cdn.ca9.uscourts.gov/datastore/opinions/2022/04/18/17-16783.pdf