---
title: "HTML to Image Documentation"
description: "REST API docs for converting HTML, CSS or URLs to PNG. Authentication, parameters, language guides and named templates."
url: "https://html2img.com/docs/"
---

# HTML to Image Documentation

Pick the path that matches what you want to do.

- **I want to send my own HTML and get a PNG back.** [Read the html parameter docs](https://html2img.com/docs/parameters/html/).
- **I want a screenshot of an existing URL.** [Read the url parameter docs](https://html2img.com/docs/parameters/url/).
- **I want a pre-designed image with my data slotted in.** [Browse the templates gallery](https://html2img.com/templates/).

## Core sections

### [Getting Started](https://html2img.com/docs/getting-started/)
The four endpoints, response format, error codes, and a working first request.

### [Quick Start](https://html2img.com/docs/quick-start/)
The shortest path from a fresh API key to your first rendered PNG, plus how free credits work.

### [Authentication](https://html2img.com/docs/authentication/)
Generate a key, send it in the `X-API-Key` header, rotate keys safely.

### [Account Status](https://html2img.com/docs/account/)
Check your plan and credit balance with `GET /api/me`. Free to call and never consumes a credit.

### [Parameters Reference](https://html2img.com/docs/parameters/)
Every parameter the HTML and Screenshot APIs accept. Defaults, ranges, common values.

### [Examples](https://html2img.com/docs/examples/)
Worked code samples for invoices, charts, OG images, calendar events and more.

### [Template API Reference](https://html2img.com/docs/templates/)
The developer reference for every named template: inputs, defaults, response shape, error codes and code samples. (For sample renders and use cases, see the [templates gallery](https://html2img.com/templates/).)

### [Testing & Debugging](https://html2img.com/docs/testing/)
Reproduce and inspect errors locally, including validation failures, timeouts and authentication problems.

### [JavaScript Support](https://html2img.com/docs/javascript/)
How JavaScript runs on the HTML endpoint, what the Screenshot endpoint can and cannot do, and how `ms_delay` and `wait_for_selector` control capture timing.

### [MCP Server](https://html2img.com/docs/mcp/)
Render images straight from Claude, Cursor or any MCP client. Available on paid plans.

### [Integrations](https://html2img.com/integrations/)
Official SDKs, framework packages, CMS plugins and CI tooling: PHP, Laravel, JavaScript, Python, Django, Ruby and Rails, WordPress, Statamic, Craft CMS and GitHub Actions. Each page is a complete implementation guide for that ecosystem.

## Error handling

The API uses a consistent error envelope: `400` for validation failures (`422` on the Templates API), `401` for missing or invalid keys, `402` when you are out of credits, `403` when the account has no active plan, `404` for unknown routes or template slugs, `504` for renders that exceed the sync budget and `500` for service errors. The [Getting Started](https://html2img.com/docs/getting-started/) guide lists every status code, and the [Testing & Debugging](https://html2img.com/docs/testing/) guide shows how to reproduce each one.

## Pick your stack

- [PHP](https://html2img.com/integrations/php/) - the official Composer SDK, plus raw cURL and Guzzle.
- [Laravel](https://html2img.com/integrations/laravel/) - Blade views to images and PDFs, queued jobs, storage on any disk.
- [JavaScript](https://html2img.com/integrations/javascript/) - Node, TypeScript, Bun, Deno, Next.js and Nuxt, all server-side.
- [Python](https://html2img.com/integrations/python/) - sync and async clients, Flask, FastAPI and Celery, plus a CLI.
- [Django](https://html2img.com/integrations/django/) - automatic Open Graph images for your models.
- [Ruby and Rails](https://html2img.com/integrations/ruby/) - the official gem, Active Job and Active Storage.
- [WordPress](https://html2img.com/integrations/wordpress/) - an Open Graph image for every post and page.
- [Statamic](https://html2img.com/integrations/statamic/) and [Craft CMS](https://html2img.com/integrations/craft/) - entry-driven social images from your own templates.
- [GitHub Actions](https://html2img.com/integrations/github-actions/) - render assets in CI, with input hashing so unchanged runs cost nothing.

The [integrations hub](https://html2img.com/integrations/) has the full list. Each page covers installation, configuration, rendering, storage, error handling and troubleshooting for that ecosystem; this section covers the API itself.
