Skip to main content
POST
/
v2
/
{workspace}
/
template
/
{template_slug}
/
channel
/
{channel}
/
variant
/
{variant_id}
/
Upsert Variant
curl -X POST "https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/channel/{channel}/variant/{variant_id}/" \
  --header 'Authorization: ServiceToken <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "locale": "en",
    "tenant_id": null,
    "conditions": [],
    "content": { ... }
  }'
import requests

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

payload = {
"locale": "en",
"content": {},
"tenant_id": "<string>",
"conditions": [
{
"type": "expression_v1",
"expression_v1": {
"op": "AND",
"args": [
{
"op": "==",
"variable_ns": "<string>",
"variable": "<string>",
"value": "<string>"
}
]
}
}
],
"needs_vendor_approval": True,
"seq_no": 123,
"vendor_approvals": [{}]
}
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({
locale: 'en',
content: {},
tenant_id: '<string>',
conditions: [
{
type: 'expression_v1',
expression_v1: {
op: 'AND',
args: [{op: '==', variable_ns: '<string>', variable: '<string>', value: '<string>'}]
}
}
],
needs_vendor_approval: true,
seq_no: 123,
vendor_approvals: [{}]
})
};

fetch('https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/channel/{channel}/variant/{variant_id}/', 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}/channel/{channel}/variant/{variant_id}/",
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([
'locale' => 'en',
'content' => [

],
'tenant_id' => '<string>',
'conditions' => [
[
'type' => 'expression_v1',
'expression_v1' => [
'op' => 'AND',
'args' => [
[
'op' => '==',
'variable_ns' => '<string>',
'variable' => '<string>',
'value' => '<string>'
]
]
]
]
],
'needs_vendor_approval' => true,
'seq_no' => 123,
'vendor_approvals' => [
[

]
]
]),
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}/channel/{channel}/variant/{variant_id}/"

payload := strings.NewReader("{\n \"locale\": \"en\",\n \"content\": {},\n \"tenant_id\": \"<string>\",\n \"conditions\": [\n {\n \"type\": \"expression_v1\",\n \"expression_v1\": {\n \"op\": \"AND\",\n \"args\": [\n {\n \"op\": \"==\",\n \"variable_ns\": \"<string>\",\n \"variable\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n }\n }\n ],\n \"needs_vendor_approval\": true,\n \"seq_no\": 123,\n \"vendor_approvals\": [\n {}\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}/channel/{channel}/variant/{variant_id}/")
.header("ServiceToken <token>", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"locale\": \"en\",\n \"content\": {},\n \"tenant_id\": \"<string>\",\n \"conditions\": [\n {\n \"type\": \"expression_v1\",\n \"expression_v1\": {\n \"op\": \"AND\",\n \"args\": [\n {\n \"op\": \"==\",\n \"variable_ns\": \"<string>\",\n \"variable\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n }\n }\n ],\n \"needs_vendor_approval\": true,\n \"seq_no\": 123,\n \"vendor_approvals\": [\n {}\n ]\n}")
.asString();
require 'uri'
require 'net/http'

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

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 \"locale\": \"en\",\n \"content\": {},\n \"tenant_id\": \"<string>\",\n \"conditions\": [\n {\n \"type\": \"expression_v1\",\n \"expression_v1\": {\n \"op\": \"AND\",\n \"args\": [\n {\n \"op\": \"==\",\n \"variable_ns\": \"<string>\",\n \"variable\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n }\n }\n ],\n \"needs_vendor_approval\": true,\n \"seq_no\": 123,\n \"vendor_approvals\": [\n {}\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "$schema": "https://schema.suprsend.com/template/v2/variant_schema.json",
  "channel": "email",
  "id": "default",
  "tenant_id": null,
  "locale": "en",
  "conditions": [],
  "hash": "97f031b56ba642d137758652ce21dda6962ecee81d544fcf245661898107bcb9",
  "needs_vendor_approval": false,
  "sysgen_template_name": null,
  "approval_status": "auto_approved",
  "discard_comment": null,
  "approval_at": "2026-04-07T10:39:28.502737Z",
  "content": {
    "$schema": "https://schema.suprsend.com/template/v2/channel/email_schema.json",
    "templating_language": "handlebars",
    "from_name": "Acme Store",
    "from_address": "noreply@acme-store.com",
    "extra_to": "",
    "cc": "",
    "bcc": "",
    "reply_to": "",
    "subject": "Your order has been shipped - #{{order.number}}",
    "body": {
      "type": "raw",
      "raw": {
        "html": "<html><body><h1>Order Shipped!</h1><p>Hi {{customer.name}},</p><p>Your order <strong>#{{order.number}}</strong> has been shipped and is on its way.</p><p>Expected delivery: {{order.delivery_date}}</p><p><a href=\"{{{order.tracking_url}}}\">Track your order</a></p></body></html>",
        "text": "Hi {{customer.name}}, Your order #{{order.number}} has been shipped. Expected delivery: {{order.delivery_date}}. Track: {{{order.tracking_url}}}"
      },
      "designer": {
        "html": "...",
        "text": "...",
        "design_json": {},
        "merge_tags": [],
        "display_conditions": []
      },
      "preheader": "Your order #{{order.number}} is on its way",
      "plain_text": null,
      "email_markup": ""
    }
  },
  "errors": {},
  "vendor_approvals": [],
  "has_error": false,
  "seq_no": 1,
  "action": null,
  "created_at": "2026-04-07T10:39:28.510000Z"
}
{
"code": 401,
"error_code": "authentication_failed",
"type": "AuthenticationFailed",
"message": "Invalid service token.",
"detail": "Invalid service token."
}
{
"code": 404,
"error_code": "not_found",
"type": "NotFound",
"message": "workspace 'demo' not found",
"detail": "workspace 'demo' not found"
}

Authorizations

ServiceToken <token>
string
header
required

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

Path Parameters

workspace
string
required
template_slug
string
required
channel
enum<string>
required
Available options:
email,
sms,
whatsapp,
inbox,
androidpush,
iospush,
webpush,
slack,
ms_teams
variant_id
string
required

Variant identifier. If a variant with this ID doesn't exist, a new one is created.

Body

application/json
locale
string
required

Locale code for the variant (e.g., en, es, fr).

Example:

"en"

content
object
required

Channel-specific content. See variant content schema for the structure of each channel.

tenant_id
string | null

Tenant ID this variant is scoped to. null for the default variant.

conditions
object[]

Conditions for variant selection. Structure follows the expression format.

needs_vendor_approval
boolean

(SMS only) Whether this variant requires vendor (DLT) approval.

seq_no
integer

Ordering of the variant within the same channel + tenant + locale combination.

vendor_approvals
object[]

Vendor approval entries for WhatsApp/SMS variants. See approval schema.

Response

Variant created or updated successfully. Returns the full variant including rendered content.

$schema
string

Schema URL for variant validation.

Example:

"https://schema.suprsend.com/template/v2/variant_schema.json"

channel
string

Channel this variant belongs to.

Example:

"email"

id
string

Variant identifier.

Example:

"default"

tenant_id
string | null

Tenant this variant is scoped to, or null for default.

locale
string

Locale code.

Example:

"en"

conditions
object[]

Conditions for variant selection at send time.

hash
string

Content hash for change detection.

needs_vendor_approval
boolean

Whether this variant requires vendor approval (SMS DLT, WhatsApp).

sysgen_template_name
string | null

System-generated template name for vendor approval.

approval_status
enum<string>

Current approval status of the variant.

Available options:
auto_approved,
pending,
sent_for_approval,
approved,
rejected
discard_comment
string | null

Reason provided when a variant is discarded.

approval_at
string<date-time> | null

Timestamp when the variant was approved.

has_error
boolean

Whether the variant has validation errors.

seq_no
integer

Ordering within the channel + tenant + locale combination.

action
string | null

Action taken in the latest commit (Updated, Added, Unchanged, or null).

created_at
string<date-time>

Timestamp when the variant was created.

content
object

Channel-specific content. Structure varies by channel. Only returned in variant detail endpoint.

vendor_approvals
object[]

Vendor approval entries (WhatsApp/SMS only). Only returned in variant detail endpoint.