✨🎨 Custom templates are available on Growth and Pro plans
Custom templates let you control how a submission is displayed in email notifications, integrations (Slack, Discord, Telegram), and the Submit JSON UI.
Use double curly braces for variables, for example: {{ data.name }}.
This template becomes the default for endpoints that use project defaults.
Templates support:
{{ ... }}{{ data.user.email }}<p>, <br>, <b>, <strong>, <i>, <em>, <u>, <ul>, <ol>, <li>Templates do not support loops, conditionals, or custom helpers.
Templates are rendered with these context roots:
...data: top-level submission datadata: your submitted payloadsubmission: submission metadataExamples:
{{ name }} (top-level submitted field){{ data.name }}{{ data.contact.email }}{{ submission.submissionId }}{{ submission.endpointSlug }}{{ submission.endpointName }}{{ submission.createdAt }}<p><strong>New Lead</strong></p>
<ul>
<li>Name: {{ name }}</li>
<li>Email: {{ email }}</li>
<li>Company: {{ company }}</li>
<li>Endpoint: {{ submission.endpointName }} ({{ submission.endpointSlug }})</li>
<li>Submission ID: {{ submission.submissionId }}</li>
</ul>
You can define submissionFormat and submissionTemplate as defaults in client initialization:
import SubmitJSON from 'submitjson'
const sj = new SubmitJSON({
apiKey: 'sjk_xxxxxxxxxxxxxx',
endpoint: 'XxXxXxXxX',
options: {
submissionFormat: 'custom',
submissionTemplate: '<p><strong>{{ name }}</strong> ({{ email }})</p>',
},
})
await sj.submit({
name: 'Yo Yoerson',
email: '[email protected]',
})
Per-submission options can override endpoint/project templates.
options.submissionTemplate takes precedence over the template configured on the endpoint.
curl -X POST "https://api.submitjson.com/v1/submit/XxXxXxXxX" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-API-Key: sjk_xxxxxxxxxxxxxx" \
-d '{
"data": {
"name": "Yo Yoerson",
"email": "[email protected]"
},
"options": {
"submissionFormat": "custom",
"submissionTemplate": "<p><strong>{{ data.name }}</strong> ({{ data.email }})</p>"
}
}'
If a custom template is missing or cannot be rendered safely, Submit JSON falls back to the pretty format for that submission.
Email subjects also support {{ variables }} interpolation with the same context as submission templates.
Example:
New message from {{ data.name }} ({{ submission.endpointSlug }})
Subject templates render plain strings and are useful for per-endpoint or per-submission customization.