---
canonical: 'https://htmlcsstoimage.com/features/code-templates'
title: 'Image Template API for HTML & CSS | HTML/CSS to Image'
description: 'Create and edit versioned HTML/CSS templates in the dashboard or through the API. Save layouts, fonts, assets, browser settings, and output options under one template ID.'
---

# Create a versioned image template with HTML and CSS

Create and edit HTML/CSS in the dashboard or through the API. Save the layout, assets, and image settings, then render the template by ID with named values.

## Key capabilities

- HTML and CSS layouts
- Reusable assets and settings
- Versioned template IDs

## Create templates with HTML and CSS

Create and edit a code template in the dashboard or through the API. Store its HTML, CSS, fonts, images, dimensions, browser settings, and output options. Image requests then send the template ID and named values instead of the full layout.

## Publish changes as new versions

Updating an API template publishes another version under the same ID. Render the latest version or choose a specific version without changing the template's named values.

Render a published template by sending its named values to `POST https://hcti.io/v1/image/{template_id}`. The response includes the generated image ID and hosted URL.

## MCP Integration

Connect an MCP-compatible client to `https://mcp.hcti.io` with OAuth. The tools use the connected organization's HTML/CSS to Image account, permissions, and plan limits.

- The `list_templates` tool returns the organization's available templates and their IDs.
- The `list_template_versions` tool returns the saved versions for a selected template.
- The `create_templated_image` tool renders a template with the named values supplied by the client.
- The `create_template` tool creates an HTML/CSS API template. The `update_template` tool publishes a new version under an existing template ID.

[Read the full MCP docs](https://docs.htmlcsstoimage.com/integrations/mcp/).

## Generate more images without duplicating the design

### Social and Open Graph images

Keep the approved layout while headlines, authors, dates, and artwork change for each page or post.

### Personalized graphics

Generate certificates, cards, summaries, and account-specific images from named template values.

### Product images

Turn catalog data into product cards, feature graphics, pricing images, and promotional assets.

### Reports and status images

Create status cards, schedules, dashboards, and recurring reports from one reusable design.

## Get started

REST API requests require an HTML/CSS to Image account and should be authenticated from trusted application code. Check the API docs and pricing for current setup instructions, limits, and feature availability.

- [View the full feature page](https://htmlcsstoimage.com/features/code-templates)
- [Browse all features](https://htmlcsstoimage.com/features.md)
- [View pricing](https://htmlcsstoimage.com/pricing.md)
- [Read the template API docs](https://docs.htmlcsstoimage.com/getting-started/templates/)
- [Read the MCP docs](https://docs.htmlcsstoimage.com/integrations/mcp/)
