Usage Examples

HTML to Image is a simple REST API that accepts POST requests to two endpoints:

POST https://app.html2img.com/api/html     # Convert HTML to image
POST https://app.html2img.com/api/screenshot # Capture screenshots

All requests require authentication via the X-API-Key header. Since this is a standard REST API, you can use any programming language or framework capable of making HTTP requests.

Below are examples in popular languages to help you get started quickly, but feel free to use any language you prefer.

Available Language Examples

Backend Languages

Frontend Frameworks

Common Features

All examples demonstrate these key features:

  • HTML to Image conversion
  • Screenshot generation
  • Error handling
  • File storage
  • Environment configuration
  • Security best practices

Getting Started

  1. Choose your preferred language or framework from the examples above
  2. Follow the setup instructions to configure your environment
  3. Copy and adapt the example code for your specific use case

All examples assume you have an API key. If you haven’t gotten one yet, check out our Quick Start guide.

Need Help?

  • Check our API Reference for detailed endpoint documentation
  • See our Example Use Cases for real-world applications
  • Contact our support team if you need assistance

Remember to always keep your API key secure and never expose it in client-side code.