Blog Featured Hero template

The blog-hero template renders a content image as a PNG. POST a JSON payload to the endpoint below and you receive a CDN URL in the response.

Endpoint

POST https://html2img.com/api/v1/templates/blog-hero
X-API-Key: <your-api-key>
Content-Type: application/json

Authentication uses the X-API-Key header. See the authentication docs for details on issuing and rotating keys.

Inputs

The full set of inputs the template accepts:

Name Type Required Description Example
title string Yes Main headline shown in the image. The quiet rise of the small-team dev shop
subtitle string No Secondary line of text shown below the title. Why eight-person studios are quietly outperforming the unicorn class.
category string No Text value for the category. Industry
read_time string No Text value for the read time. 7 min read
author_name string No Author or brand name displayed alongside the image. Adaeze Okafor
author_role string No Text value for the author role. Editor at Northwind Weekly
author_avatar_url url No URL of the author avatar to include in the rendered image. https://i.pravatar.cc/160?img=49
background_image_url url No URL of the background image to include in the rendered image. https://picsum.photos/seed/blog-hero/1600/900
background_color string No Hex colour code for the background. #0F172A
accent_color string No Hex colour code for the accent. #22D3EE

Defaults

Defaults applied automatically when not overridden in the request:

Option Default value
width 1600
height 900

Code examples

curl -X POST https://app.html2img.com/api/v1/templates/blog-hero \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title":"The quiet rise of the small-team dev shop","subtitle":"Why eight-person studios are quietly outperforming the unicorn class.","category":"Industry","read_time":"7 min read","author_name":"Adaeze Okafor","author_role":"Editor at Northwind Weekly","author_avatar_url":"https://i.pravatar.cc/160?img=49","background_image_url":"https://picsum.photos/seed/blog-hero/1600/900","background_color":"#0F172A","accent_color":"#22D3EE"}'

Looking for a fuller integration sketch in your language? The usage guides cover PHP, Laravel, Rails, Python, JavaScript, React and Vue.

Response

A successful render returns:

{
  "success": true,
  "id": "abc123",
  "url": "https://i.html2img.com/abc123.png",
  "credits_remaining": 1234,
  "template": "blog-hero"
}

The url field is a CDN URL for the rendered PNG. credits_remaining tracks your monthly quota. Shared response fields are documented in the API parameters reference.

Errors

The template endpoint returns the following error responses:

422 Validation failed

Returned when one or more inputs fail validation. The errors object lists field-specific messages.

{
  "success": false,
  "error": "validation_failed",
  "errors": {
    "title": ["The title field is required."]
  }
}

404 Template not found

Returned with {"code": "template_not_found"} if the slug is not registered. Check the template list for current slugs.

401 Unauthorised

Missing or invalid API key. See the authentication docs.

429 Too many requests

You have hit the rate limit or used your monthly credits. The pricing page covers higher-volume plans.

Related templates

  • Quote Card — Pull-quote cards for testimonials, reviews, and shareable quotes

See the Blog Featured Hero template in our gallery for sample renders and use cases.