Complete guide to template creation, testing, and API integration
Sign up at www.lorotemplates.com/login and confirm your email address.
After email confirmation, you'll receive your API key via email. This key authenticates all your API requests.
Login to access your dashboard where you can create, edit, and test templates.
Scriban is a powerful templating engine that allows you to generate dynamic content by combining templates with JSON data.
Hello {{ name }}!
Your order details:
{{~ for item in items ~}}
- {{ item.name }}: ${{ item.price }}
{{~ end ~}}
Total: ${{ total }}{{ variable_name }}
{{ user.first_name }}
{{ items[0].price }}{{~ if user.premium ~}}
  Premium user benefits
{{~ else ~}}
  Standard features
{{~ end ~}}{{~ for item in items ~}}
  {{ item.name }}
{{~ end ~}}{{ date.now | date.to_string "%Y-%m-%d" }}
{{ name | string.upcase }}
{{ items | array.size }}{
  "name": "John Doe",
  "email": "john@example.com",
  "items": [
    {
      "name": "Widget A",
      "price": 29.99,
      "quantity": 2
    },
    {
      "name": "Widget B", 
      "price": 19.99,
      "quantity": 1
    }
  ],
  "total": 79.97,
  "date": "2024-01-15"
}https://api.lorotemplates.comAll API requests require your API key in the request header:
X-API-Key: your-api-key-hereEvery API request must include your API key in the X-API-Key header.
Content-Type: application/json
X-API-Key: your-api-key-hereRender a template with JSON data
{
  "template_id": "uuid-of-template", // Optional: use saved template
  "template": "Hello {{ name }}!",   // Optional: inline template
  "data": {
    "name": "John Doe"
  }
}{
  "success": true,
  "result": "Hello John Doe!",
  "render_time_ms": 45
}Get all your templates
[
  {
    "id": "template-uuid",
    "name": "Welcome Email",
    "description": "Customer welcome email template",
    "category": "Emails",
    "is_active": true,
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T10:30:00Z"
  }
]Get a specific template by ID
{
  "id": "template-uuid",
  "name": "Welcome Email",
  "description": "Customer welcome email template", 
  "content": "Hello {{ customer.name }}!",
  "category": "Emails",
  "schema": "{ \"type\": \"object\" }",
  "sample_data": "{ \"customer\": { \"name\": \"John\" } }",
  "is_active": true,
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}const API_BASE = 'https://api.lorotemplates.com';
const API_KEY = process.env.LORO_API_KEY;
async function renderTemplate(templateData) {
  const response = await fetch(`${API_BASE}/api/templates/render`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-API-Key': API_KEY
    },
    body: JSON.stringify({
      template: 'Hello {{ name }}!',
      data: { name: 'John Doe' }
    })
  });
  
  const result = await response.json();
  console.log(result.result); // "Hello John Doe!"
}import requests
import os
API_BASE = 'https://api.lorotemplates.com'
API_KEY = os.getenv('LORO_API_KEY')
def render_template(template, data):
    response = requests.post(
        f'{API_BASE}/api/templates/render',
        headers={
            'Content-Type': 'application/json',
            'X-API-Key': API_KEY
        },
        json={
            'template': template,
            'data': data
        }
    )
    
    result = response.json()
    return result['result']
# Usage
output = render_template(
    'Hello {{ name }}!', 
    {'name': 'John Doe'}
)
print(output)  # "Hello John Doe!" $template,
        'data' => $data
    ]);
    
    $context = stream_context_create([
        'http' => [
            'method' => 'POST',
            'header' => "Content-Type: application/json\r\n" .
                       "X-API-Key: $apiKey\r\n",
            'content' => $postData
        ]
    ]);
    
    $response = file_get_contents("$apiBase/api/templates/render", false, $context);
    $result = json_decode($response, true);
    
    return $result['result'];
}
// Usage
$output = renderTemplate('Hello {{ name }}!', ['name' => 'John Doe']);
echo $output; // "Hello John Doe!"
?>curl -X POST https://api.lorotemplates.com/api/templates/render \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your-api-key-here" \
  -d '{
    "template": "Hello {{ name }}!",
    "data": {
      "name": "John Doe"
    }
  }'Loro Templates VS Code Extension
The official VS Code extension provides syntax highlighting, IntelliSense, and debugging support for Scriban templates directly in your editor.
code --install-extension lorotemplates.loro-templatesFull syntax highlighting for .scriban files with proper color coding for variables, functions, and control structures.
Auto-completion for Scriban functions, variables, and built-in objects like date, string, math, and array functions.
Real-time syntax error detection and validation with helpful error messages and suggestions.
Test templates directly in VS Code with sample JSON data and see rendered output instantly.
.scriban extensionConfigure the extension through VS Code settings:
{
  "loro.apiKey": "your-api-key-here",
  "loro.apiUrl": "https://api.lorotemplates.com",
  "loro.autoValidate": true,
  "loro.showInlineErrors": true
}Security Note: Store your API key securely using VS Code's built-in secrets management or environment variables.
Loro CLI
The command-line interface allows you to transform templates, manage configurations, and integrate Loro Templates into your build processes and automation workflows.
npm install -g @lorotemplates/cliloro --versionConfigure your API credentials before using the CLI:
# Interactive configuration
loro config
# Set API key directly
loro config --api-key YOUR_API_KEY
# Set API URL (if using custom endpoint)
loro config --api-url https://api.lorotemplates.com
# View current configuration
loro config --listTransform using a remote template by GUID
# Basic usage
loro remote 72d561bf-3c17-4b34-b48d-cee00f1f0e1e -d data.json
# Save to file
loro remote 72d561bf-3c17-4b34-b48d-cee00f1f0e1e -d data.json -o output.txt
# Show template before transformation
loro remote 72d561bf-3c17-4b34-b48d-cee00f1f0e1e -d data.json --show-template
# Verbose output
loro remote 72d561bf-3c17-4b34-b48d-cee00f1f0e1e -d data.json --verboseList all available templates
# List templates
loro list
# Search templates
loro list -s "invoice"
# Show more results
loro list -l 20
# Output as JSON
loro list --jsonShow usage statistics and account information
# View usage stats
loro stats
# Detailed statistics
loro stats --verbose
# Output as JSON
loro stats --jsonTransform local templates or use remote templates
# Transform local template
loro transform template.scriban -d data.json
# Use remote template by GUID
loro transform --guid 72d561bf-3c17-4b34-b48d-cee00f1f0e1e -d data.json
# Save to file
loro transform template.scriban -d data.json -o output.html#!/bin/bash
# Generate reports using templates
echo "Generating monthly report..."
loro remote 72d561bf-3c17-4b34-b48d-cee00f1f0e1e \
  -d monthly-data.json \
  -o reports/monthly-report.html
echo "Generating invoice..."
loro remote 22222222-2222-2222-2222-222222222222 \
  -d invoice-data.json \
  -o invoices/invoice-$(date +%Y%m%d).html
echo "Reports generated successfully!"{
  "scripts": {
    "generate-docs": "loro remote DOC_TEMPLATE_GUID -d docs-data.json -o README.md",
    "build-emails": "loro list -s email | xargs -I {} loro remote {} -d user-data.json",
    "deploy-templates": "loro stats && npm run build"
  }
}You can also configure the CLI using environment variables:
export LORO_API_KEY="your-api-key"
export LORO_API_URL="https://api.lorotemplates.com"
# Now you can use CLI without --api-key flag
loro remote 72d561bf-3c17-4b34-b48d-cee00f1f0e1e -d data.jsonCause: Missing or invalid API key
Solution: Ensure your API key is included in the X-API-Key header
Cause: Syntax error in your template or invalid JSON data
Solution: Use the template tester to debug your template and data
Cause: You've exceeded your monthly API call limit
Solution: Upgrade your plan or wait until next month
Cause: Invalid template ID
Solution: Verify the template ID exists in your dashboard
Need additional support?
Email us at admin@lorotemplates.com and we'll help you resolve any issues.
Made with care by the Loro Templates team
