Skip to main content
POST
/
v1
/
{workspace}
/
preference_category
/
Create/Update Category
curl -X POST "https://management-api.suprsend.com/v1/{workspace}/preference_category/?commit=false" \
  --header "Authorization: ServiceToken {token}" \
  --header "Content-Type: application/json" \
  --data '{
    "root_categories": [
      {
        "root_category": "system"
      },
      {
        "root_category": "transactional",
        "sections": [
          {
            "name": "Task Updates",
            "categories": [
              {
                "category": "tagged-to-me",
                "name": "Tagged to Me",
                "description": "Status Update or mentions on tasks assigned by me or tagged to me",
                "default_preference": "opt_in",
                "digest_schedule": {
                  "enabled": true,
                  "options": [
                    {
                      "id": "instant",
                      "label": "Instant",
                      "frequency": "instantly",
                      "is_default": true
                    },
                    {
                      "id": "daily-digest",
                      "label": "Daily at 9:00 AM",
                      "frequency": "daily",
                      "interval": 1,
                      "time": { "edit_policy": "editable", "default_value": "09:00" },
                      "is_default": false
                    }
                  ]
                },
                "properties": [
                  {
                    "key": "threshold",
                    "label": "Threshold",
                    "value_type": "integer",
                    "is_optional": false,
                    "default_value": 10,
                    "edit_policy": "editable"
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "root_category": "promotional",
        "sections": [
          {
            "name": "Product Updates",
            "categories": [
              {
                "category": "newsletter",
                "name": "Newsletter",
                "default_preference": "opt_out",
                "digest_schedule": null,
                "properties": null
              }
            ]
          }
        ]
      }
    ]
  }'
import requests

url = "https://management-api.suprsend.com/v1/{workspace}/preference_category/"

payload = { "root_categories": [{ "sections": [
{
"name": "<string>",
"description": "<string>",
"tags": ["<string>"],
"categories": [
{
"category": "<string>",
"name": "<string>",
"description": "<string>",
"default_mandatory_channels": [],
"default_opt_in_channels": [],
"tags": ["<string>"],
"digest_schedule": {
"enabled": True,
"options": [
{
"id": "<string>",
"label": "<string>",
"interval": 2,
"time": { "default_value": "00:00" },
"weekdays": { "default_value": [] },
"monthdays": { "default_value": [{ "pos": 123 }] },
"dtstart": { "default_value": "2026-06-20T00:00:00Z" },
"is_default": True
}
]
},
"properties": [
{
"key": "<string>",
"label": "<string>",
"is_optional": False,
"choices": [
{
"value": "<string>",
"label": "<string>"
}
],
"default_value": "<unknown>",
"dynamic_choices_key": "<string>"
}
]
}
]
}
] }] }
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({
root_categories: [
{
sections: [
{
name: '<string>',
description: '<string>',
tags: ['<string>'],
categories: [
{
category: '<string>',
name: '<string>',
description: '<string>',
default_mandatory_channels: [],
default_opt_in_channels: [],
tags: ['<string>'],
digest_schedule: {
enabled: true,
options: [
{
id: '<string>',
label: '<string>',
interval: 2,
time: {default_value: '00:00'},
weekdays: {default_value: []},
monthdays: {default_value: [{pos: 123}]},
dtstart: {default_value: '2026-06-20T00:00:00Z'},
is_default: true
}
]
},
properties: [
{
key: '<string>',
label: '<string>',
is_optional: false,
choices: [{value: '<string>', label: '<string>'}],
default_value: '<unknown>',
dynamic_choices_key: '<string>'
}
]
}
]
}
]
}
]
})
};

fetch('https://management-api.suprsend.com/v1/{workspace}/preference_category/', 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/v1/{workspace}/preference_category/",
  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([
    'root_categories' => [
        [
                'sections' => [
                                [
                                                                'name' => '<string>',
                                                                'description' => '<string>',
                                                                'tags' => [
                                                                                                                                '<string>'
                                                                ],
                                                                'categories' => [
                                                                                                                                [
                                                                                                                                                                                                                                                                'category' => '<string>',
                                                                                                                                                                                                                                                                'name' => '<string>',
                                                                                                                                                                                                                                                                'description' => '<string>',
                                                                                                                                                                                                                                                                'default_mandatory_channels' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                'default_opt_in_channels' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                'tags' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                '<string>'
                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                'digest_schedule' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'enabled' => true,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'options' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'id' => '<string>',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'label' => '<string>',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'interval' => 2,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'time' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'default_value' => '00:00'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'weekdays' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'default_value' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'monthdays' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'default_value' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'pos' => 123
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'dtstart' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'default_value' => '2026-06-20T00:00:00Z'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'is_default' => true
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ]
                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                'properties' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'key' => '<string>',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'label' => '<string>',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'is_optional' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'choices' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'value' => '<string>',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'label' => '<string>'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'default_value' => '<unknown>',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'dynamic_choices_key' => '<string>'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ]
                                                                                                                                                                                                                                                                ]
                                                                                                                                ]
                                                                ]
                                ]
                ]
        ]
    ]
  ]),
  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/v1/{workspace}/preference_category/"

payload := strings.NewReader("{\n \"root_categories\": [\n {\n \"sections\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"categories\": [\n {\n \"category\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"default_mandatory_channels\": [],\n \"default_opt_in_channels\": [],\n \"tags\": [\n \"<string>\"\n ],\n \"digest_schedule\": {\n \"enabled\": true,\n \"options\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"interval\": 2,\n \"time\": {\n \"default_value\": \"00:00\"\n },\n \"weekdays\": {\n \"default_value\": []\n },\n \"monthdays\": {\n \"default_value\": [\n {\n \"pos\": 123\n }\n ]\n },\n \"dtstart\": {\n \"default_value\": \"2026-06-20T00:00:00Z\"\n },\n \"is_default\": true\n }\n ]\n },\n \"properties\": [\n {\n \"key\": \"<string>\",\n \"label\": \"<string>\",\n \"is_optional\": false,\n \"choices\": [\n {\n \"value\": \"<string>\",\n \"label\": \"<string>\"\n }\n ],\n \"default_value\": \"<unknown>\",\n \"dynamic_choices_key\": \"<string>\"\n }\n ]\n }\n ]\n }\n ]\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/v1/{workspace}/preference_category/")
.header("ServiceToken <token>", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"root_categories\": [\n {\n \"sections\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"categories\": [\n {\n \"category\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"default_mandatory_channels\": [],\n \"default_opt_in_channels\": [],\n \"tags\": [\n \"<string>\"\n ],\n \"digest_schedule\": {\n \"enabled\": true,\n \"options\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"interval\": 2,\n \"time\": {\n \"default_value\": \"00:00\"\n },\n \"weekdays\": {\n \"default_value\": []\n },\n \"monthdays\": {\n \"default_value\": [\n {\n \"pos\": 123\n }\n ]\n },\n \"dtstart\": {\n \"default_value\": \"2026-06-20T00:00:00Z\"\n },\n \"is_default\": true\n }\n ]\n },\n \"properties\": [\n {\n \"key\": \"<string>\",\n \"label\": \"<string>\",\n \"is_optional\": false,\n \"choices\": [\n {\n \"value\": \"<string>\",\n \"label\": \"<string>\"\n }\n ],\n \"default_value\": \"<unknown>\",\n \"dynamic_choices_key\": \"<string>\"\n }\n ]\n }\n ]\n }\n ]\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://management-api.suprsend.com/v1/{workspace}/preference_category/")

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 \"root_categories\": [\n {\n \"sections\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"categories\": [\n {\n \"category\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"default_mandatory_channels\": [],\n \"default_opt_in_channels\": [],\n \"tags\": [\n \"<string>\"\n ],\n \"digest_schedule\": {\n \"enabled\": true,\n \"options\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"interval\": 2,\n \"time\": {\n \"default_value\": \"00:00\"\n },\n \"weekdays\": {\n \"default_value\": []\n },\n \"monthdays\": {\n \"default_value\": [\n {\n \"pos\": 123\n }\n ]\n },\n \"dtstart\": {\n \"default_value\": \"2026-06-20T00:00:00Z\"\n },\n \"is_default\": true\n }\n ]\n },\n \"properties\": [\n {\n \"key\": \"<string>\",\n \"label\": \"<string>\",\n \"is_optional\": false,\n \"choices\": [\n {\n \"value\": \"<string>\",\n \"label\": \"<string>\"\n }\n ],\n \"default_value\": \"<unknown>\",\n \"dynamic_choices_key\": \"<string>\"\n }\n ]\n }\n ]\n }\n ]\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "$schema": "https://schema.suprsend.com/preference_category/v1/schema.json",
  "root_categories": [
    {
      "root_category": "system",
      "sections": []
    },
    {
      "root_category": "transactional",
      "sections": [
        {
          "name": "Task Updates",
          "description": null,
          "tags": null,
          "categories": [
            {
              "category": "tagged-to-me",
              "name": "Tagged to Me",
              "description": "Status Update or mentions on tasks assigned by me or tagged to me",
              "default_preference": "opt_in",
              "default_mandatory_channels": null,
              "default_opt_in_channels": null,
              "tags": null,
              "digest_schedule": {
                "enabled": true,
                "options": [
                  {
                    "id": "instant",
                    "label": "Instant",
                    "frequency": "instantly",
                    "is_default": true
                  },
                  {
                    "id": "daily-digest",
                    "label": "Daily at 9:00 AM",
                    "frequency": "daily",
                    "interval": 1,
                    "time": {
                      "edit_policy": "editable",
                      "default_value": "09:00"
                    },
                    "is_default": false
                  }
                ]
              },
              "properties": [
                {
                  "key": "priority",
                  "label": "Minimum priority",
                  "value_type": "string_choice",
                  "is_optional": false,
                  "choices": [
                    {
                      "value": "low",
                      "label": "Low"
                    },
                    {
                      "value": "medium",
                      "label": "Medium"
                    },
                    {
                      "value": "high",
                      "label": "High"
                    }
                  ],
                  "default_value": "high",
                  "edit_policy": "editable"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "root_category": "promotional",
      "sections": [
        {
          "name": "Product Updates",
          "description": null,
          "tags": null,
          "categories": [
            {
              "category": "newsletter",
              "name": "Newsletter",
              "description": null,
              "default_preference": "opt_out",
              "default_mandatory_channels": null,
              "default_opt_in_channels": null,
              "tags": null,
              "digest_schedule": null,
              "properties": null
            }
          ]
        }
      ]
    }
  ],
  "version_no": 3,
  "status": "draft",
  "commit_message": null,
  "committed_at": null,
  "validation_result": {
    "is_valid": true
  }
}
{
"code": 401,
"message": "ServiceToken not found"
}
{
"code": 404,
"message": "workspace not found for slug/uid: workspace"
}
⚠️ This API call will override existing categories with whatever is passed in the request body. Recommended approach is to first fetch the current categories using GET method, modify the response as needed, and then send it back in the request body.
You can read more about preference categories here.

Note: Changes will only be pushed if "validation_result":{"is_valid":true} in the response. General reasons for validation failure are:

  • There are multiple categories with the same slug
  • Some subcategories have been deleted in this version, on which active workflows are configured
  • You’ve not passed all three categories in the request body - system, transactional, promotional

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 (staging, production, etc.)

Query Parameters

commit
boolean

Whether to commit changes immediately. Set to true to make changes live, false to save as draft.

commit_message
string

Optional commit message describing the changes made. Required when commit=true.

Body

application/json
root_categories
object[]

Array of root preference categories. Include all three root categories (system, transactional, promotional) even if empty.

Response

Successfully created/updated preference category

$schema
string

JSON schema reference for preference category structure

Example:

"https://schema.suprsend.com/preference_category/v1/schema.json"

root_categories
object[]

Array of root preference categories

status
enum<string>

Current status of the preference category

Available options:
draft,
active
Example:

"draft"

version_no
integer

Version number field as an identifier to track the version

Example:

3

commit_message
string

Commit message describing the changes that were made

Example:

null

committed_at
string<date-time>

Timestamp when the changes were committed

Example:

null

validation_result
object

Result of validating the preference category