---
title: "Quick Start"
description: "Render your first HTML to PNG in under 5 minutes. Full Node.js example with code."
url: "https://html2img.com/docs/quick-start/"
---

# Quick Start

Render your first image in five minutes. One Node.js example, end to end.

## 1. Get your API key

Sign up at [app.html2img.com](https://app.html2img.com/register). Copy your key from the dashboard. The free tier gives you 50 renders, no card needed - they are a one-time allowance that never renews, while paid plans top up monthly.

> **Warning**
>
> Keep your API key out of client-side code. Store it in an environment variable on your server.

## 2. Send your first request

```javascript
const response = await fetch('https://app.html2img.com/api/html', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': process.env.HTML2IMG_API_KEY
  },
  body: JSON.stringify({
    html: '<div style="padding: 40px; font-family: Inter, sans-serif; font-size: 48px;">Hello from html2img</div>',
    width: 1200,
    height: 630
  })
});

const { url } = await response.json();
console.log('PNG ready at', url);
```

The response includes a CDN URL on `i.html2img.com`. On a paid plan the image stays hosted permanently. Free-tier renders are hosted for 7 days - the `expires_at` field tells you when yours expires, and upgrading makes everything still hosted permanent.

## 3. Inspect the response

```json
{
  "success": true,
  "id": "8a9dda43-5f42-4b93-8ff4-cd69ed32d402",
  "expires_at": "2026-08-14T09:16:39+00:00",
  "credits_remaining": 49,
  "url": "https://i.html2img.com/image-1786092598870-921691.png"
}
```

A 400 means a validation error. A 401 means a missing or wrong API key, and a 402 means you are out of credits - [`GET /api/me`](https://html2img.com/docs/account/) diagnoses both without spending a credit. A 504 means the render exceeded the 30 second sync budget; switch to `webhook_url`. See the [getting started guide](https://html2img.com/docs/getting-started/) for the full error reference.

## What next

Need a different language? See the [integration guides](https://html2img.com/integrations/).

Need to tweak the render? See the [parameters reference](https://html2img.com/docs/parameters/).

> **Note**
>
> Looking for a pre-built design instead of writing HTML? Browse the [templates gallery](https://html2img.com/templates/) and POST a JSON payload to a named endpoint.
