Skip to main content
POST
/
v2
/
{workspace}
/
template
/
{template_slug}
/
Upsert Template
curl -X POST "https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/" \
  --header 'Authorization: ServiceToken <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "Order Confirmed",
    "description": "Sent when an order is placed",
    "tags": ["transactional"],
    "enabled_channels": ["email", "sms"]
  }'
import requests

url = "https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/"

payload = {
"name": "Order Confirmed",
"description": "Sent when an order is placed",
"tags": ["transactional"],
"enabled_channels": ["email", "sms"]
}
headers = {
"ServiceToken <token>": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'ServiceToken <token>': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Order Confirmed',
description: 'Sent when an order is placed',
tags: ['transactional'],
enabled_channels: ['email', 'sms']
})
};

fetch('https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Order Confirmed',
'description' => 'Sent when an order is placed',
'tags' => [
'transactional'
],
'enabled_channels' => [
'email',
'sms'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"ServiceToken <token>: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/"

payload := strings.NewReader("{\n \"name\": \"Order Confirmed\",\n \"description\": \"Sent when an order is placed\",\n \"tags\": [\n \"transactional\"\n ],\n \"enabled_channels\": [\n \"email\",\n \"sms\"\n ]\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("ServiceToken <token>", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/")
.header("ServiceToken <token>", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Order Confirmed\",\n \"description\": \"Sent when an order is placed\",\n \"tags\": [\n \"transactional\"\n ],\n \"enabled_channels\": [\n \"email\",\n \"sms\"\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["ServiceToken <token>"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Order Confirmed\",\n \"description\": \"Sent when an order is placed\",\n \"tags\": [\n \"transactional\"\n ],\n \"enabled_channels\": [\n \"email\",\n \"sms\"\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "$schema": "https://schema.suprsend.com/template/v2/schema.json",
  "slug": "welcome-onboarding",
  "created_at": "2026-04-01T05:57:21.081312Z",
  "last_triggered_at": null,
  "name": "Welcome Onboarding",
  "description": "Welcome email for new users",
  "tags": [
    "onboarding",
    "welcome"
  ],
  "enabled_channels": [
    "email",
    "slack"
  ],
  "status": "draft",
  "version_no": null,
  "hash": "74335de96f6ddc077b90310ff746a8f8cd64852acbbe260c626be54ff28bed0d",
  "commit_message": null,
  "active_at": null,
  "updated_at": "2026-04-08T09:24:38.918548Z",
  "updated_by": {
    "name": "API Service",
    "email": "service-token@api.example.com"
  },
  "channels": [
    {
      "channel": "email",
      "is_active": false,
      "variants_count": 1
    },
    {
      "channel": "slack",
      "is_active": false,
      "variants_count": 1
    }
  ]
}
{
"code": 401,
"error_code": "authentication_failed",
"type": "AuthenticationFailed",
"message": "Invalid service token.",
"detail": "Invalid service token."
}

Authorizations

ServiceToken <token>
string
header
required

You can get Service Token from SuprSend dashboard -> Account Settings -> Service Tokens section.

Path Parameters

workspace
string
required

Workspace slug.

template_slug
string
required

Unique template slug. Used as the identifier for the template.

Body

application/json
name
string
required

Template display name.

Example:

"Order Confirmed"

description
string

Optional description for the template.

Example:

"Sent when an order is placed"

tags
string[]

Tags for organising templates.

Example:
["transactional"]
enabled_channels
enum<string>[]

Channels to enable for this template.

Available options:
email,
sms,
whatsapp,
inbox,
androidpush,
iospush,
webpush,
slack,
ms_teams
Example:
["email", "sms"]

Response

Template created or updated successfully

The response is of type object.