{}

Submit JSON with Custom Templates

✨🎨 Custom templates are available on Growth and Pro plans


Submission Templates

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 }}.

Enable on an endpoint

  1. Open your endpoint settings.
  2. Set Submission format to 🎨 Custom.
  3. Add your Custom template in the textarea.
  4. Save.

Enable project-wide defaults

  1. Open your project settings.
  2. Set Submission format to 🎨 Custom.
  3. Add a Custom template in the textarea.
  4. Save.

This template becomes the default for endpoints that use project defaults.

Template syntax

Templates support:

  • Variable interpolation with {{ ... }}
  • Dot-path access like {{ data.user.email }}
  • Select HTML tags <p>, <br>, <b>, <strong>, <i>, <em>, <u>, <ul>, <ol>, <li>

Templates do not support loops, conditionals, or custom helpers.

Template variable context

Templates are rendered with these context roots:

  • ...data: top-level submission data
  • data: your submitted payload
  • submission: submission metadata

Examples:

  • {{ name }} (top-level submitted field)
  • {{ data.name }}
  • {{ data.contact.email }}
  • {{ submission.submissionId }}
  • {{ submission.endpointSlug }}
  • {{ submission.endpointName }}
  • {{ submission.createdAt }}

Example template

<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>
html

Configure defaults with the JS client

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]',
})
ts

Override per submission

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>"
    }
  }'
bash

Fallback behavior

If a custom template is missing or cannot be rendered safely, Submit JSON falls back to the pretty format for that submission.

Email Subject Templates

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.