Skip to content

Node.js Screenshot API

Capture pixel-perfect screenshots of any URL in three lines of Node.js — no Puppeteer, no Chromium, no servers to maintain.
Node.js website screenshot API example
https://api.microlink.io?screenshot&url=https://apple.com

Take a screenshot in Node.js

The official SDK, @microlink/mql, is a tiny Promise-based client. Install it, point it at a URL, and you get back a hosted screenshot URL — ready to embed or store.
Step 01 · Install the SDK
A single dependency with zero native binaries. It runs anywhere Node runs.
npm install @microlink/mql
Step 02 · Capture any URL
Pass the page you want and set screenshot: true. With async/await you get the result in one call — both CommonJS (require) and ESM (import) are supported.
capture.js
import mql from '@microlink/mql'
// CommonJS: const mql = require('@microlink/mql')

const { status, data } = await mql('https://example.com', {
  screenshot: true,
  meta: false // skip metadata extraction for a faster response
})

if (status === 'success') {
  console.log(data.screenshot.url)
}
Step 03 · Customize the capture
Output format, full-page captures, device emulation, and waiting for content — every Headless Chrome option is just a field.
options.js
const { data } = await mql('https://example.com', {
  screenshot: {
    type: 'jpeg',   // png (default) | jpeg
    fullPage: true, // capture the entire scrollable page
    omitBackground: false
  },
  device: 'iPhone X',     // emulate any device
  waitForTimeout: 1000,   // wait before capturing
  adblock: true           // strip ads & cookie banners (default)
})
Step 04 · Save it to disk
The response is a hosted image URL on a global CDN. Use the built-in fetch to download it, or just hand the URL to the browser.
save.js
import { writeFile } from 'node:fs/promises'
import mql from '@microlink/mql'

const { data } = await mql('https://example.com', { screenshot: true })

const response = await fetch(data.screenshot.url)
const buffer = Buffer.from(await response.arrayBuffer())
await writeFile('screenshot.png', buffer)

Drop it into your framework

A route handler, a controller, or a plain HTTP server — the same three-line call becomes your own screenshot endpoint, perfect for dynamic Open Graph images on any runtime.
  • Express
  • Next.js
  • Fastify
  • NestJS
  • Node.js
import mql from '@microlink/mql'

// GET /api/screenshot?url=https://example.com
export async function GET (request) {
  const { searchParams } = new URL(request.url)
  const url = searchParams.get('url')

  const { data } = await mql(url, {
    screenshot: true,
    meta: false
  })

  // redirect to the hosted image, or return data.screenshot.url as JSON
  return Response.redirect(data.screenshot.url)
}

Skip the Puppeteer maintenance

Running Headless Chrome yourself means shipping a 300 MB browser, tuning memory, and fighting cold starts. The API gives you the same control without any of the infrastructure.

Self-hosted Puppeteer

  • Bundle & maintain Chromium (~300 MB) plus system libraries
  • Exceeds the AWS Lambda 50 MB limit — needs chrome-aws-lambda hacks
  • Each browser eats hundreds of MB of RAM; OOM crashes under load
  • Launching Chromium adds seconds of cold-start latency
  • You build the browser pool, queueing, retries and autoscaling
  • Write your own cookie-banner & ad dismissal scripts

Microlink for Node.js

  • npm install @microlink/mql — pure JavaScript, zero binaries
  • Runs anywhere: serverless, edge, containers, your laptop
  • Autoscaled managed browser fleet with a 99.95% uptime SLA
  • Sub-second cached responses from 240+ edge locations
  • Built-in adblock removes ads & cookie banners automatically
  • Full-page, device emulation, overlays & DOM interaction included

Built for the way you write Node.

A REST API designed to feel native in JavaScript — typed, Promise-based, and at home in any runtime, from a long-running server to a Cloudflare Worker. Read the screenshot guide to go deeper.

  • TypeScript Ready

    Ships type definitions out of the box, so every screenshot option autocompletes and type-checks in your editor.
  • ESM & CommonJS

    Use `import mql from "@microlink/mql"` or `require("@microlink/mql")` — it works in any Node project without config.
  • Serverless & Edge Friendly

    No Chromium binary to bundle. Deploy to Vercel, AWS Lambda, or Cloudflare Workers with the lightweight build.
  • Promise-Based API

    A single async call returns the hosted image URL. No callbacks, no streams to manage, no browser lifecycle to babysit.
  • Zero Infrastructure

    Managed Headless Chrome, autoscaled and load-balanced. No browser pool, no servers, no patching to maintain.
  • Built-in Adblock

    Captures arrive clean — GDPR cookie banners, newsletter popups, and injected ads are removed before the shot.
  • Full Browser Control

    Full-page captures, viewport and device emulation, click and wait, plus custom CSS and JavaScript injection.
  • Global Edge Caching

    Repeat captures are served sub-second from 240+ edge locations, with configurable TTL to keep them fresh.
  • Generous Free Tier

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

    Ships type definitions out of the box, so every screenshot option autocompletes and type-checks in your editor.
  • ESM & CommonJS

    Use `import mql from "@microlink/mql"` or `require("@microlink/mql")` — it works in any Node project without config.
  • Serverless & Edge Friendly

    No Chromium binary to bundle. Deploy to Vercel, AWS Lambda, or Cloudflare Workers with the lightweight build.
  • Promise-Based API

    A single async call returns the hosted image URL. No callbacks, no streams to manage, no browser lifecycle to babysit.
  • Zero Infrastructure

    Managed Headless Chrome, autoscaled and load-balanced. No browser pool, no servers, no patching to maintain.
  • Built-in Adblock

    Captures arrive clean — GDPR cookie banners, newsletter popups, and injected ads are removed before the shot.
  • Full Browser Control

    Full-page captures, viewport and device emulation, click and wait, plus custom CSS and JavaScript injection.
  • Global Edge Caching

    Repeat captures are served sub-second from 240+ edge locations, with configurable TTL to keep them fresh.
  • Generous Free Tier

    Start with 50 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 exact API request before you write a line of Node.

Node.js Screenshot FAQ

Everything Node developers ask before integrating the Microlink screenshot API.

Do I need Puppeteer or Chromium installed?

No. @microlink/mql is a thin HTTP client with zero native dependencies — there is no Chromium binary to download and nothing to compile. The Headless Chrome fleet runs on Microlink's side.
That is what makes it deploy cleanly to serverless and edge environments where bundling is painful.

Does it work with TypeScript?

Yes. The package ships its own type definitions, so the mql() client and every screenshot option are typed and autocomplete in your editor — no @types package required.

Can I use ESM and CommonJS?

Both. Use import mql from '@microlink/mql' in ESM projects or const mql = require('@microlink/mql') in CommonJS. The same options work either way.

Does it run on Next.js, serverless, or the edge?

Yes. Because there is no browser binary to bundle, it works inside Next.js Route Handlers, AWS Lambda, and Vercel functions out of the box. For the Edge runtime, import the lightweight build: @microlink/mql/lightweight.
See the installation guide for runtime details.

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

The free tier gives you 50 requests per day with no account, no credit card, and no API key. Just call the endpoint and start capturing.
When you need more throughput or caching control, pass apiKey to mql() and requests route to the Pro tier. See pricing for the limits.

How fast is it and how does it scale?

Cached captures return sub-second from a global edge network, and the browser fleet autoscales behind a 99.95% uptime SLA — so a traffic spike does not mean provisioning more servers.
Compare the numbers on the screenshot API benchmarks.

Start capturing in Node.js

Get 50 requests/day with zero commitment — no account and no credit card. Install the SDK and ship your first screenshot in minutes.
No login needed
50 reqs/day free
No credit card