Skip to content

Node.js HTML API

Get the fully rendered HTML of any URL with one HTTP request in Node.js — real Chromium under the hood, none to maintain.

Get HTML in Node.js

No package and no browser — the Microlink REST API renders any URL and returns the HTML with a single HTTP GET. Here it is with the global fetch that ships with Node.js 18+.
Step 01 · Extract any URL
A few lines with global fetch — no npm package, no Chromium download. Point it at a page and read the rendered HTML from the JSON response.
fetch.mjs
const params = new URLSearchParams({
  url: 'https://microlink.io',
  'data.html.attr': 'html'
})

const { data } = await fetch(`https://api.microlink.io?${params}`)
  .then(res => res.json())

console.log(data.html.length)     // full rendered document
console.log(data.html.slice(0, 15)) // '<!DOCTYPE html>'
Step 02 · Scope to a selector
Return the whole document or only the subtree you need — smaller responses, less parsing and lower token cost downstream.
selector.mjs
const params = new URLSearchParams({
  url: 'https://microlink.io/blog',
  'data.html.attr': 'html',
  'data.html.selector': 'main' // only the <main> subtree
})

const { data } = await fetch(`https://api.microlink.io?${params}`)
  .then(res => res.json())

// No nav, no footer — just the content you asked for
console.log(data.html)
Step 03 · Render JavaScript pages
Client-rendered apps only produce their markup after JavaScript runs — prerender in a real browser and wait for it, still one request.
spa.mjs
const params = new URLSearchParams({
  url: 'https://app.example.com',
  'data.html.attr': 'html',
  prerender: 'true',          // render JS in a real browser first
  waitForSelector: 'h1'       // capture only when the content exists
})

const { data } = await fetch(`https://api.microlink.io?${params}`)
  .then(res => res.json())

console.log(data.html)
Step 04 · Serve the raw HTML
Ask for embed=html and the API answers with text/html directly — proxy it straight to a browser or write it to a file.
raw.mjs
const params = new URLSearchParams({
  url: 'https://microlink.io',
  'data.html.attr': 'html',
  embed: 'html' // respond with text/html, no JSON
})

const res = await fetch(`https://api.microlink.io?${params}`)
const html = await res.text() // ready to serve or store

Drop it into your framework

A route handler, an Express endpoint, or a page archiver — the same request becomes your own rendering endpoint.
  • Next.js
  • Express
  • Archiver
  • Plain Node.js
import express from 'express'

const app = express()

// GET /render?url=https://microlink.io
app.get('/render', async (req, res) => {
  const { data } = await fetch(
    `https://api.microlink.io?url=${encodeURIComponent(req.query.url)}&data.html.attr=html`
  ).then(res => res.json())

  res.type('html').send(data.html)
})

Skip the browser-farm ops

Rolling your own means running Puppeteer or Playwright, shipping a 300 MB Chromium binary, writing per-site wait logic, and fighting antibot walls. The API returns the rendered HTML of any page without any of the moving parts.

DIY rendering stack

  • Run and patch your own headless Chromium fleet
  • Write per-site wait logic for JavaScript-rendered pages
  • Fight antibot walls and CAPTCHAs with your own proxy pool
  • Each browser eats hundreds of MB of RAM per worker
  • You build the caching, retries and autoscaling
  • Every Chromium upgrade breaks a selector somewhere

Microlink for Node.js

  • One HTTP request — no rendering infrastructure to run
  • Fully rendered HTML from managed Chromium, JS included
  • Selector scoping to return only the subtree you need
  • Antibot and CAPTCHA resolution handled for you
  • Cached responses from a global edge network
  • Autoscaled fleet with a 99.95% uptime SLA

Built for the way you write Node.js.

A REST API that feels native in Node.js — one call, JSON back, and at home in anything from a script to a serverless function. Read the API overview to go deeper.

  • Real Browser Rendering

    Every request runs in managed Chromium, so client-rendered apps return complete markup instead of an empty shell.
  • Zero Dependencies

    Node.js 18+ ships global fetch — the examples work with no npm install and no Chromium binary in your deploy.
  • Selector Scoping

    Return the full document or a single subtree with a selector — smaller payloads and less parsing downstream.
  • JSON or Raw HTML

    Read data.html from the JSON response, or ask for embed=html and get the document back as text/html — no JSON involved.
  • Readiness You Control

    waitUntil and waitForSelector let you block on network idle or on a specific element before the HTML is captured.
  • One Call, Many Formats

    Request HTML together with markdown, text, metadata, screenshots or PDFs and pay for a single render instead of several.
  • Framework Friendly

    Drop it into Next.js, Express, or an archive worker as a route or a few-line function.
  • Zero Infrastructure

    Managed Headless Chrome, autoscaled and load-balanced. No browser pool, no servers, no patching to maintain.
  • Generous Free Tier

    Start with 25 requests per day — no account, no credit card. Add an API key when you are ready to scale.
  • Real Browser Rendering

    Every request runs in managed Chromium, so client-rendered apps return complete markup instead of an empty shell.
  • Zero Dependencies

    Node.js 18+ ships global fetch — the examples work with no npm install and no Chromium binary in your deploy.
  • Selector Scoping

    Return the full document or a single subtree with a selector — smaller payloads and less parsing downstream.
  • JSON or Raw HTML

    Read data.html from the JSON response, or ask for embed=html and get the document back as text/html — no JSON involved.
  • Readiness You Control

    waitUntil and waitForSelector let you block on network idle or on a specific element before the HTML is captured.
  • One Call, Many Formats

    Request HTML together with markdown, text, metadata, screenshots or PDFs and pay for a single render instead of several.
  • Framework Friendly

    Drop it into Next.js, Express, or an archive worker as a route or a few-line function.
  • Zero Infrastructure

    Managed Headless Chrome, autoscaled and load-balanced. No browser pool, no servers, no patching to maintain.
  • Generous Free Tier

    Start with 25 requests per day — no account, no credit card. Add an API key when you are ready to scale.

Try it live in the playground

Paste a URL and see the rendered output before you write a line of Node.js.

Node.js HTML API FAQ

Everything Node.js developers ask before integrating the Microlink HTML API.

Do I get the source HTML or the rendered DOM?

Every request runs in a real Chromium instance, so data.html is the fully rendered DOM — JavaScript executed, lazy content loaded. Control the capture point with waitUntil and waitForSelector.

Do I need to install a package or a browser?

No. The examples use the global fetch that ships with Node.js 18+, and rendering runs on Microlink — no Puppeteer, no Playwright, no Chromium in your deploy.

How do I control when the HTML is captured?

Use waitUntil to block on network idle or a fixed delay, and waitForSelector to hold the capture until a specific element exists — the HTML comes back exactly when your page is ready, still in one request.

Can I get only part of the page?

Yes. Add a selector to the extraction rule and only that subtree comes back — ideal for articles, product cards or pricing tables, with smaller payloads and less parsing downstream.

Is there a free tier or do I need an API key?

The free tier gives you 25 requests per day with no account, no credit card, and no API key. Just call the endpoint and start extracting.
When you need more throughput or caching control, add an apiKey header and requests route to the Pro tier. See pricing for the limits.

How fresh is the HTML?

Responses are cached at the edge with a sane default TTL, and you control freshness per request — see the API overview for cache parameters.

Start extracting in Node.js

Get 25 requests/day with zero commitment — no account and no credit card. Send your first request and get HTML back in minutes.
No login needed
25 reqs/day free
No credit card