TemplateTiger API Integration Guide

Everything you need to move templates out of your applications

Integration Approaches

TemplateTiger offers two powerful integration patterns to fit your architecture and use case:

Server-Side Rendering

Recommended

Pattern: Send template variables to TemplateTiger and receive fully-rendered HTML.

POST /api/v1/templates/{name}/render

Best For:

  • Email generation and delivery systems
  • Server-side rendering workflows
  • Build-time static site generation
  • Systems where template content should remain server-controlled
  • Scenarios requiring consistent rendering across different client environments

Benefits:

  • Centralized template management and version control
  • Consistent rendering logic across all integrations
  • Reduced client-side dependencies
  • Template content remains secure on the server
  • Automatic updates when templates are modified

Example Use Case: Your application needs to send personalized welcome emails. You call the render endpoint with user data, and TemplateTiger returns ready-to-send HTML.

Client-Side Rendering

Advanced

Pattern: Retrieve raw template content and render it in your own application using Handlebars.js or similar templating engines.

GET /api/v1/templates/{name}

Best For:

  • High-performance applications requiring local rendering
  • Offline-capable applications
  • Systems with existing client-side templating infrastructure
  • Use-cases that can accept eventually-consistent template changes

Benefits:

  • Lower server load for repeated renders
  • Faster rendering after initial template fetch
  • Offline rendering capability
  • Full control over rendering pipeline
  • Reduced API calls for multiple renders of the same template

Example Use Case: Your document generation service creates PDFs from templates for hundreds of users. You fetch the template once and render it locally for each user's data, enabling efficient batch PDF generation while reducing server load and improving performance.

API Endpoint Reference

Authentication

Secure API Access with API Keys

All API requests require authentication using API keys. Create and manage your keys from your account settings.

How API Keys Work

  • Create API Key: Generate a secure API key from your account settings
  • Include in Requests: Add X-API-Key header to all API calls
  • Account Context: Keys automatically scope access to your account's templates

Getting Started

  1. Log in to your TemplateTiger account
  2. Navigate to the API Keys page (/api-keys)
  3. Click "Create API Key"
  4. Give your key a descriptive name
  5. Copy the key immediately (shown only once)
  6. Use the key in your API requests
Security Note: Store your API keys securely. They provide access to all templates in your account.

Handlebars Templating

TemplateTiger uses the Handlebars templating engine for powerful template rendering. Create dynamic content with variables, conditionals, and loops.

Need More Handlebars Help?

For comprehensive Handlebars documentation, syntax reference, and advanced features, visit the official guide.

Official Handlebars Guide
<h1>Hello {{name}}!</h1>
<p>Welcome to {{company}}</p>
<p>Your email: {{email}}</p>

Error Handling

The API returns structured error responses to help you handle different scenarios effectively.

Error Codes

Best Practices

Template Design

  • Use descriptive variable names
  • Provide fallback content with conditionals
  • Keep templates focused and reusable
  • Test with various data scenarios
  • Document expected data structure

API Integration

  • 4xx Errors: Do not retry client errors - fix the request instead
  • 500 Errors: Implement retry logic with exponential backoff and jitter (start with 1-2 second delays) for transient failures
  • 503 Errors: Check the retryAfter field for suggested retry timing
  • Retry Limits: Limit retries to 3-5 attempts to avoid infinite loops
  • Monitoring: Monitor API calls and log all errors.
  • Caching: Cache rendered content when appropriate