Skip to main content
Endprompt uses Liquid templating to create dynamic prompts. This lets you inject request data, apply transformations, and add conditional logic to your prompts.

Basic Syntax

Variable Output

Use double curly braces to output values:

Filters

Apply filters to transform values:

Tags

Use tags for logic and control flow:

Accessing Input Values

All input fields are available under inputs:

Default Values

Use the default filter for optional fields:
Always provide defaults for optional fields to ensure your prompt works even when values aren’t provided.

Common Filters

String Filters

Number Filters

Array Filters

Control Flow

If / Else

Unless

Case / When

Loops

For Loop

Loop Variables

Loop Example with Conditions

Working with Objects

Access nested properties with dot notation:

Iterate Over Object Properties

Including Snippets

Reuse common template fragments with includes:
Snippets are defined in the Prompt Snippets section. See Working with Snippets for details.

Real-World Examples

Email Generator

Content Classifier

Multi-Language Support

Best Practices

Optional fields should have sensible defaults to prevent empty values in prompts.
Use truncate to prevent extremely long inputs from exceeding token limits.
Common instructions (JSON formatting, tone guidelines) should be snippets.
Test with empty arrays, missing optional fields, and unusual values.
Complex logic is hard to debug. Keep conditionals straightforward.

Debugging Templates

If your template isn’t working:
  1. Check the rendered preview in the prompt editor
  2. Verify input field names match exactly
  3. Test with simple values first
  4. Check for typos in filter names
  5. Ensure conditionals have proper endif / endfor tags

Next Steps

Create a Prompt

Put your template skills to use

Prompt Snippets

Learn to create reusable template fragments