Email Header template
The email-header 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.
Marketing page
See the Email Header template in our gallery
Sample renders, use cases and pricing context.
Endpoint
POST https://app.html2img.com/api/v1/templates/email-header
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 Production Hour Weekly |
subtitle | string | No | Secondary line of text shown below the title. | Conversations from the people running real systems |
issue_number | string | No | Text value for the issue number. | Issue #042 |
publication_date | string | No | Text value for the publication date. | May 6, 2026 |
background_pattern | enum (none | dots | grid | waves) | No | One of the supported background pattern values listed below. | dots |
accent_color | string | No | Hex colour code for the accent. | #7C3AED |
background_color | string | No | Hex colour code for the background. | #0F172A |
brand_logo_url | url | No | URL of the brand logo to include in the rendered image. | - |
Enum values
background_pattern accepts one of:
none , dots , grid , waves .
Defaults
Defaults applied automatically when not overridden in the request:
| Option | Default value |
|---|---|
width | 1200 |
height | 300 |
Code examples
curl -X POST https://app.html2img.com/api/v1/templates/email-header \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"title":"The Production Hour Weekly","subtitle":"Conversations from the people running real systems","issue_number":"Issue #042","publication_date":"May 6, 2026","background_pattern":"dots","accent_color":"#7C3AED","background_color":"#0F172A"}' <?php
$response = \Illuminate\Support\Facades\Http::withHeaders([
'X-API-Key' => 'YOUR_API_KEY',
])->post('https://app.html2img.com/api/v1/templates/email-header', ['title' => 'The Production Hour Weekly', 'subtitle' => 'Conversations from the people running real systems', 'issue_number' => 'Issue #042', 'publication_date' => 'May 6, 2026', 'background_pattern' => 'dots', 'accent_color' => '#7C3AED', 'background_color' => '#0F172A']);
$url = $response->json('url'); const response = await fetch('https://app.html2img.com/api/v1/templates/email-header', {
method: 'POST',
headers: {
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"title": "The Production Hour Weekly",
"subtitle": "Conversations from the people running real systems",
"issue_number": "Issue #042",
"publication_date": "May 6, 2026",
"background_pattern": "dots",
"accent_color": "#7C3AED",
"background_color": "#0F172A"
}),
});
const { url } = await response.json(); import requests
response = requests.post(
'https://app.html2img.com/api/v1/templates/email-header',
headers={'X-API-Key': 'YOUR_API_KEY'},
json={'title': 'The Production Hour Weekly', 'subtitle': 'Conversations from the people running real systems', 'issue_number': 'Issue #042', 'publication_date': 'May 6, 2026', 'background_pattern': 'dots', 'accent_color': '#7C3AED', 'background_color': '#0F172A'},
)
url = response.json()['url'] 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": "email-header"
}
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
Other templates in the content and marketing category:
- Blog hero image - Editorial hero images for blog posts and article pages
- Code screenshot - Beautiful syntax-highlighted code screenshots with window chrome
- GitHub social preview - Repo cards sized for GitHub social preview, share posts, and READMEs
- Open Graph image - Generate dynamic Open Graph images from JSON
- Podcast cover - Square cover artwork sized for Apple Podcasts, Spotify, and the major directories
- Podcast episode card - Per-episode share cards sized for Twitter, LinkedIn, and Slack unfurls
- Product card - E-commerce product cards with price, optional sale price, and CTA
- Project showcase - "We shipped X" hero cards for changelogs and launch announcements
- Quote card - Pull-quote cards for testimonials, reviews, and shareable quotes
Browse by category
A starting point from each of the other template categories. The templates index lists every reference page.
Social media: Facebook post , Instagram square post
Business and commerce: Business card , Certificate of completion
See the Email Header marketing page for sample renders and use cases.