Skip to content

Create a template

POST
/v1/templates
curl --request POST \
--url https://your-notavia-host/v1/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "key": "example", "name": "example", "subject_template": "example", "html_body_template": "example", "text_body_template": "example" }'
Media type application/json
object
key
required
string
name
required
string
subject_template
required
string
html_body_template
required
string
text_body_template
string
nullable
Example generated
{
"key": "example",
"name": "example",
"subject_template": "example",
"html_body_template": "example",
"text_body_template": "example"
}

Template created.

Media type application/json
object
id
string format: uuid
key
string
name
string
subject_template

Populated from the Email channel body for backwards compatibility.

string
nullable
html_body_template

Populated from the Email channel body for backwards compatibility.

string
nullable
text_body_template

Populated from the Email/SMS channel body for backwards compatibility.

string
nullable
created_at
string format: date-time
updated_at
string format: date-time
bodies

Per-channel body variants. Replaces the legacy flat fields for new integrations.

Array<object>

Per-channel body variant for a template. The channel-specific fields that apply depend on the channel:

  • Email: subject_template + html_template (+ optional text_template)
  • InApp: html_template (or text_template for plain-text in-app)
  • SMS: text_template
  • Slack: structured_template (Block Kit JSON as Liquid template)
  • Teams: structured_template (Adaptive Card v1.5 JSON as Liquid template)
  • Discord: text_template (content) and/or structured_template (embed JSON)
object
channel

Notification channel identifier.

string
Allowed values: email in_app webhook sms slack teams discord
subject_template
string
nullable
text_template
string
nullable
html_template
string
nullable
structured_template
string
nullable
body_channels

Kebab-case list of channels for which a body variant exists.

Array<string>
Allowed values: email in_app sms slack teams discord
Example
{
"bodies": [
{
"channel": "email"
}
],
"body_channels": [
"email"
]
}

Validation or request error.

Media type application/json
object
error
required
object
type
required
string
code
required
string
message
required
string
param
string
nullable
Example generated
{
"error": {
"type": "example",
"code": "example",
"message": "example",
"param": "example"
}
}

Missing or invalid credentials.

Media type application/json
object
error
required
object
type
required
string
code
required
string
message
required
string
param
string
nullable
Example generated
{
"error": {
"type": "example",
"code": "example",
"message": "example",
"param": "example"
}
}

Credentials do not have the required scope.

Media type application/json
object
error
required
object
type
required
string
code
required
string
message
required
string
param
string
nullable
Example generated
{
"error": {
"type": "example",
"code": "example",
"message": "example",
"param": "example"
}
}

Conflict (e.g. duplicate key, idempotency collision).

Media type application/json
object
error
required
object
type
required
string
code
required
string
message
required
string
param
string
nullable
Example generated
{
"error": {
"type": "example",
"code": "example",
"message": "example",
"param": "example"
}
}