{invoice_number} or {client_name}) that get replaced with actual values when preparing an email. They let you create reusable email templates that automatically populate with context-specific data.
For example, a template like:
| Parameter | Required | Description |
|---|---|---|
context_type | Yes | The entity type to get fields for (e.g., "invoice") |
| Context Type | Description |
|---|---|
invoice | Invoice-related fields (amounts, dates, client info, payment links) |
| Property | Description |
|---|---|
token | The placeholder to use in templates (e.g., {invoice_number}) |
label | Human-readable name for display in UI |
type | Data type hint: str, date, currency, int, email, url |
context_type=invoice, the following fields are available:
| Token | Label | Type | Example Value |
|---|---|---|---|
{invoice_number} | Invoice Number | str | INV-2024-001 |
{issue_date} | Issue Date | date | January 15, 2024 |
{due_date} | Due Date | date | February 15, 2024 |
{paid_date} | Paid Date | date | February 10, 2024 |
{status} | Status | str | overdue |
{currency} | Currency | str | USD |
{collection_method} | Collection Method | str | send_invoice |
{total_cents} | Total Amount | currency | $2,000.00 |
{amount_due} | Amount Due | currency | $1,500.00 |
{subtotal} | Subtotal | currency | $1,800.00 |
{discounts} | Discounts | currency | $0.00 |
{tax_amount} | Tax Amount | currency | $200.00 |
{credit_notes} | Credit Notes | currency | $0.00 |
{amount_paid} | Amount Paid | currency | $500.00 |
{amount_remaining} | Amount Remaining | currency | $1,500.00 |
{payment_link} | Payment Link | url | https://pay.example.com/… |
{days_overdue} | Days Overdue | int | 10 |
{age_in_days} | Invoice Age (Days) | int | 45 |
{client_name} | Client Name | str | Acme Corp |
{client_email} | Client Email | billing@acme.com | |
{organization_name} | Organization Name | str | My Company LLC |
{current_date} | Current Date | date | March 25, 2024 |
| Status | Cause |
|---|---|
400 | Missing context_type parameter |
400 | Invalid or unsupported context_type |