Dynamic Data5 min read•Audience: Developers
Injecting Dynamic Data via API
Pass structured variables, arrays, booleans, and nested objects to the render endpoint.
Key Takeaways
- Supply a JSON variables object in the POST request body.
- Supports primitives, nested objects, and arrays.
- Handlebars resolves variables recursively.
Complex Payload Example#
code
json
Performance Guidelines for API Payloads#
When injecting high-cardinality data:
- Limit array sizes to what is practically readable in an email (e.g. 20 items max).
- Format large numbers and currency on your server or use the built-in
formatCurrencyhelper. - Avoid sending deeply nested database entities containing sensitive fields (like hashed passwords or internal IDs) that are unused in the email.
Frequently Asked Questions
What is the maximum JSON payload size accepted by the Render API?
The API accepts JSON payloads up to 5 MB, which is more than sufficient for high-volume order receipts and itineraries.
Can I inject unescaped raw HTML via the API?
If the template author used triple curly braces {{{rawHtmlContent}}}, the string will be rendered without escaping. Use with care to prevent XSS.