Popular Language

Capture screenshots in Node.js

Add screenshot and scrolling GIF capabilities to your Node.js applications with native fetch API. No Puppeteer, no headless browsers to manage.

Installation

  1. 1Use Node.js 18+ (includes native fetch API)
  2. 2Get your API key from the dashboard
  3. 3Set the X-KEY header in your fetch requests

Authentication

Include your API key in the X-KEY header with every request:

const response = await fetch(url, {
  headers: { 'X-KEY': 'your-api-key' }
});

Node.js Screenshot Example

Capture a screenshot or create a scrolling GIF animation with a simple GET request:

curl "https://api.scrnpix.com/screenshot?url=https%3A%2F%2Fexample.com&width=1280&height=720&format=png" \
  -H "X-KEY: your-api-key" \
  -o screenshot.png
curl "https://api.scrnpix.com/animate?url=https%3A%2F%2Fexample.com&scroll_duration=3000&scroll_easing=ease-in-out" \
  -H "X-KEY: your-api-key" \
  -o animation.gif

Response Format

On success, the API returns the image binary data directly in the response body.

Status Code200 OK
Content-Typeimage/png, image/jpeg, or image/gif
BodyBinary image data (ArrayBuffer)
Error ResponseError message with 4xx/5xx status

Key Features

Zero Setup

No need to install Puppeteer or manage headless Chrome. Just use the native fetch API available in Node.js 18+.

Production Ready

Built on Cloudflare Workers with global edge network. Handles concurrency and browser lifecycle automatically.

Node.js Integration

Simple async/await pattern. Integrates seamlessly with Express, Koa, Fastify, Next.js, or any Node.js framework.

Rich Features

Custom viewport sizes, full page capture, PNG/JPEG formats, scrolling GIFs with 15 easing functions.

Frequently Asked Questions

Do I need to install any browser dependencies for Node.js?

No. Scrnpix runs browsers on our infrastructure. You only need Node.js 18+ with native fetch API to make HTTP calls.

Can I use this with Express or Next.js?

Yes. Scrnpix works with any Node.js framework — Express, Koa, Fastify, Next.js, or plain Node.js scripts.

How do I handle errors in Node.js?

Check the response status code. A 200 status means success with image bytes in the body. 4xx errors indicate invalid params or auth issues, 5xx errors are server-side.

What Node.js version is required?

Node.js 18+ is recommended for native fetch API support. The API is a simple HTTP GET request.

Ready to capture screenshots in Node.js?

Get your API key and start rendering screenshots in seconds. Free tier includes 50 screenshots per month.

Start Free