Skip to main content

AI Template Generation

POST https://api.getdeckle.dev/v1/ai/generate-template Generate a complete HTML template from a natural language description using AI. The response includes ready-to-use HTML with Handlebars variables that you can save as a template or use directly with /v1/generate. Requires the ANTHROPIC_API_KEY environment variable to be configured on the server.

Request Body

Example

Response

The variables array in the response includes all Handlebars variables detected in the generated HTML, which may include additional variables beyond those you requested.

Using the Generated Template

Save the generated HTML as a reusable template:
Or generate a PDF directly:

Errors