Home / Docs / Language guides | HTML to Image Docs

Language guides

The HTML to Image API is a REST API. Any language that can make an HTTP request will work. The guides below cover seven stacks, plus the three official SDK clients, with idiomatic code, queueing patterns, and template integration.

Pick your language

Every example assumes you have an API key. If you have not signed up yet, see the quick start.

Official SDKs and integrations

Prefer a maintained package over hand-rolled HTTP calls? These are built and maintained by us:

  • PHP SDK - a typed client for the HTML, screenshot and template endpoints. Install with composer require html2img/html2img-php. Source on GitHub.
  • Laravel Package - an auto-registered facade with a config file, storage helpers and an artisan test command, built on the PHP SDK. Install with composer require html2img/html2img-laravel. Source on GitHub.
  • JavaScript SDK - a zero-dependency typed client for Node.js, Bun, Deno and edge runtimes, with full TypeScript types and dual ESM/CommonJS builds. Install with npm install @html2img/client. Source on GitHub.
  • Auto Open Graph Images for Statamic - a Statamic 6 addon that automatically renders branded Open Graph images for every entry from your own Antlers or Blade templates. Install with composer require html2img/statamic-og-images.

Common features across guides

  • HTML to Image conversion via the html endpoint
  • Screenshot generation via the screenshot endpoint
  • Templates via the /api/v1/templates/{slug} endpoint
  • Error handling for 400, 401, 402, 504 and 500 responses
  • File storage for storing returned URLs
  • Environment variable patterns for API keys
  • Account and credit checks via GET /api/me

See also