mode: "template")subject and body_text containing dynamic field tokens (e.g., {invoice_number}, {client_name}). The endpoint resolves these tokens against the context entity and returns the fully rendered content.
Required parameters:
subject - Email subject with optional dynamic tokensbody_text - Email body with optional dynamic tokenscontext_type - The entity type (e.g., "invoice")context_uid - UUID of the entity to resolve fields frommode: "inference")context_uid)prompt_hint{tokens} in your input. Instead, the resolved context data is automatically provided to the AI. The AI sees the actual values (e.g., “Invoice INV-2024-001”, “$1,500.00”) and composes the email accordingly.
Parameters:
context_type - The entity type (e.g., "invoice")context_uid - UUID of the entity whose data informs the AIprompt_hint (optional) - Additional guidance for the AI (e.g., “friendly tone”, “focus on urgency”, “mention late fee policy”)subject / body_text (optional) - Fallback content if inference fails| Aspect | Template Mode | Inference Mode |
|---|---|---|
| Content source | You provide the exact text with tokens | AI generates the content |
| Dynamic fields | {token} placeholders in your text are replaced | Context data is passed to AI automatically |
| Customization | Full control over wording | Guide via prompt_hint |
| Use case | Standardized templates | Personalized, context-aware drafts |
context_type. For invoice context:
| Token | Description | Example Value |
|---|---|---|
{invoice_number} | Invoice identifier | INV-2024-001 |
{issue_date} | Date invoice was issued | January 15, 2024 |
{due_date} | Payment due date | February 15, 2024 |
{amount_due} | Outstanding amount | $1,500.00 |
{total_cents} | Total invoice amount | $2,000.00 |
{days_overdue} | Days past due date | 10 |
{client_name} | Customer/client name | Acme Corp |
{client_email} | Customer email | billing@acme.com |
{payment_link} | Link to payment portal | https://pay.example.com/… |
{organization_name} | Your organization name | My Company LLC |
{current_date} | Today’s date | March 25, 2024 |
errors array contains any issues encountered during processing:
{inference} error if AI generation fails (falls back to provided subject/body_text)body_html from the resolved/generated body_text. The HTML conversion supports:
**bold text** → <strong>bold text</strong>[Link Text]{https://example.com} → <a href="https://example.com">Link Text</a>[Link Text]{{example.com}} → <a href="https://example.com">Link Text</a><br> tagsBearer authentication header of the form Bearer <token>, where <token> is your auth token.