Overview #
Davix H2I can automate social media asset generation by rendering HTML templates into image output through the public HTML-rendering endpoint. Requests sent to Davix H2I are executed by the H2I engine (PixLab), which renders the HTML and returns a generated image URL. HTML rendering into images or PDFs is a defining capability of the platform, and the broader product docs explicitly include dynamic marketing assets, template-based content generation, and automation workflows among its supported use cases.
This recipe is appropriate when a content system, marketing platform, or automation workflow needs to generate consistent visual assets automatically from reusable HTML templates and dynamic content. Davix H2I provides that rendering capability as an API-accessible backend service instead of requiring applications to build their own rendering infrastructure.
When to use this recipe #
This workflow is suitable for systems that need to generate image-based assets automatically from structured content. The loaded Davix H2I docs support use cases such as dynamic marketing assets, automated content generation, and template-driven rendering workflows.
Example architecture #
Typical automation flow for social media assets:
Content Management System
│
│ generate HTML visual template
│
▼
Davix H2I API
https://pixlab.davix.dev/v1/h2i
│
│ HTML rendered by
│ H2I engine (PixLab)
│
▼
Generated social media image URL
│
▼
Used by the application workflow
This matches the documented Davix H2I interaction model: the client sends a request to the public API, the backend engine performs the render, and the result is returned as a generated file URL.
Step 1 — Create a social media HTML template #
Davix H2I accepts HTML layouts, templates, and dynamically generated markup as input to the H2I rendering workflow. A visual asset can therefore be built as a reusable HTML template and populated with dynamic content before sending it to the API.
Example template for a promotional banner:
<div style="
width:100%;
height:100%;
display:flex;
flex-direction:column;
align-items:center;
justify-content:center;
background:#1e293b;
color:white;
font-family:Arial, sans-serif;
text-align:center;
padding:80px;
box-sizing:border-box;
">
<h1 style="font-size:72px;margin-bottom:20px;">
New Feature Released
</h1>
<p style="font-size:36px;color:#94a3b8;">
Try it today with Davix H2I
</p>
</div>
Applications can replace the example content with real campaign or announcement data before sending the request.
Step 2 — Send the rendering request #
Endpoint:
POST https://pixlab.davix.dev/v1/h2i
The /v1/h2i endpoint is the public HTML-rendering route. It accepts JSON or URL-encoded request bodies, supports both image and pdf actions, and requires API-key authentication. This recipe uses the image action.
Authentication is accepted through:
X-Api-Key: <key>Authorization: Bearer <key>
In non-production environments, body-based api_key and query-based ?key= are also accepted. In production, those locations are rejected.
Full example request #
curl -sS -X POST "https://pixlab.davix.dev/v1/h2i" \
-H "X-Api-Key: <YOUR_API_KEY>" \
-H "Idempotency-Key: social-asset-001" \
-H "Content-Type: application/json" \
-d '{
"action": "image",
"html": "<div style=\"width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:#1e293b;color:white;font-size:60px\">New Feature</div>",
"css": "body{margin:0}",
"width": 1200,
"height": 1200,
"format": "png"
}'
This is the full supported public parameter set for the /v1/h2i image action:
actionhtmlcsswidthheightformat
Request parameters #
| Parameter | Required | Description |
|---|---|---|
action | yes | Must be image for image generation |
html | yes | HTML template used for rendering |
css | no | Additional CSS styling injected into the rendered document |
width | no | Rendering viewport width |
height | no | Rendering viewport height |
format | no | Output image format |
Documented image behavior for /v1/h2i:
widthdefaults to1000heightdefaults to1500formatdefaults topngformat=jpegyields JPEG output; other values become PNG
Example success response #
A successful /v1/h2i image request returns a generated output URL:
{
"url": "https://pixlab.davix.dev/h2i/<generated-image>?exp=<SIGNED_EXPIRY>&sig=<SIGNED_SIGNATURE>",
"request_id": "<REQUEST_ID>"
}
The documented success shape for /v1/h2i is a JSON response with the generated output URL in url. request_id may also be included. File-producing external routes return signed output URLs.
Output behavior #
H2I-generated outputs are served through the /h2i/* output path. Output URLs are built through the platform’s signed URL system, and guarded output fetches require valid signature parameters when signed output enforcement is enabled. Clients should use the returned url directly rather than constructing output URLs manually.
Example automation workflow #
A common automation pattern is:
Content created or updated
│
▼
Generate HTML visual template
│
▼
Call Davix H2I API
│
▼
Receive generated asset URL
│
▼
Use asset in the application workflow
This aligns with the broader Davix H2I documentation describing API-driven automation workflows and template-based generation.
Limits and processing behavior #
The /v1/h2i route applies documented limits and controls, including:
- HTML length cap
- render width cap
- render height cap
- render pixel-area cap
- timeout handling
- concurrency control
- customer quota handling
The canonical limits documentation shows that:
- HTML over the cap returns
html_too_large - width and height are clamped to configured ceilings
- pixel-area overflow is rejected
- semaphore wait exhaustion returns
server_busy - timeouts return
timeout
The loaded docs are not fully aligned on the exact render-size error name:
- the error architecture uses
render_size_exceeded - the limits-side material uses
render_too_largefor H2I pixel-area overflow
Because you want numeric limits centralized under Errors and Limits, this page should link there instead of repeating limit values here.
Summary #
This recipe demonstrates how to automate social media asset generation using Davix H2I’s HTML-to-image workflow.
The documented flow is:
- create an HTML visual template
- send it to
POST /v1/h2i - render the image through the H2I engine (PixLab)
- receive a generated output URL in response
