Update Mock Data
Update the mock data for a template. Sets the input payload, recipient, tenant, actor, and batching configuration used for previews and testing.
curl -X PATCH "https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/mock_data/" \
--header 'Authorization: ServiceToken <token>' \
--header 'Content-Type: application/json' \
--data '{
"payload": {"order_id": "ORD-1234", "amount": "$99.99"},
"tenant_id": "default",
"is_batch": false,
"recipient_sub_type": "user",
"recipient_distinct_id": "user-123"
}'import requests
url = "https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/mock_data/"
payload = {
"payload": {},
"tenant_id": "default",
"is_batch": False,
"batch_count": 2,
"recipient_sub_type": "user",
"recipient_distinct_id": "user-123",
"recipient_object": {
"object_type": "<string>",
"id": "<string>"
},
"actor_distinct_id": "<string>",
"actor_object": {
"object_type": "<string>",
"id": "<string>"
}
}
headers = {
"ServiceToken <token>": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'ServiceToken <token>': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
payload: {},
tenant_id: 'default',
is_batch: false,
batch_count: 2,
recipient_sub_type: 'user',
recipient_distinct_id: 'user-123',
recipient_object: {object_type: '<string>', id: '<string>'},
actor_distinct_id: '<string>',
actor_object: {object_type: '<string>', id: '<string>'}
})
};
fetch('https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/mock_data/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/mock_data/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'payload' => [
],
'tenant_id' => 'default',
'is_batch' => false,
'batch_count' => 2,
'recipient_sub_type' => 'user',
'recipient_distinct_id' => 'user-123',
'recipient_object' => [
'object_type' => '<string>',
'id' => '<string>'
],
'actor_distinct_id' => '<string>',
'actor_object' => [
'object_type' => '<string>',
'id' => '<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/v2/{workspace}/template/{template_slug}/mock_data/"
payload := strings.NewReader("{\n \"payload\": {},\n \"tenant_id\": \"default\",\n \"is_batch\": false,\n \"batch_count\": 2,\n \"recipient_sub_type\": \"user\",\n \"recipient_distinct_id\": \"user-123\",\n \"recipient_object\": {\n \"object_type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"actor_distinct_id\": \"<string>\",\n \"actor_object\": {\n \"object_type\": \"<string>\",\n \"id\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/mock_data/")
.header("ServiceToken <token>", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"payload\": {},\n \"tenant_id\": \"default\",\n \"is_batch\": false,\n \"batch_count\": 2,\n \"recipient_sub_type\": \"user\",\n \"recipient_distinct_id\": \"user-123\",\n \"recipient_object\": {\n \"object_type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"actor_distinct_id\": \"<string>\",\n \"actor_object\": {\n \"object_type\": \"<string>\",\n \"id\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/mock_data/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["ServiceToken <token>"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"payload\": {},\n \"tenant_id\": \"default\",\n \"is_batch\": false,\n \"batch_count\": 2,\n \"recipient_sub_type\": \"user\",\n \"recipient_distinct_id\": \"user-123\",\n \"recipient_object\": {\n \"object_type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"actor_distinct_id\": \"<string>\",\n \"actor_object\": {\n \"object_type\": \"<string>\",\n \"id\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"payload": {
"user": {
"name": "Pat Morgan"
},
"event": {
"status": "shipped"
}
},
"tenant_id": "default",
"is_batch": false,
"batch_count": 2,
"recipient_sub_type": "user",
"recipient_object": null,
"recipient_distinct_id": "user_12345",
"actor_sub_type": "user",
"actor_object": null,
"actor_distinct_id": "actor_67890"
},
"transformed_data": {
"user": {
"name": "Pat Morgan"
},
"event": {
"status": "shipped"
},
"$batch_key": "evaluated batch_key",
"$batched_events": [
{
"user": {
"name": "Pat Morgan"
},
"event": {
"status": "shipped"
}
},
{
"user": {
"name": "Pat Morgan"
},
"event": {
"status": "shipped"
}
}
],
"$batched_events_count": 2,
"$brand": {
"brand_id": "default",
"brand_name": "My Company",
"logo": "https://cdn.example.com/logo.png",
"primary_color": "#2E70E8",
"secondary_color": "#63A3F7",
"tertiary_color": "#FFFFFF",
"embedded_preference_url": "https://preferences.example.com/embed",
"hosted_preference_domain": "preferences.example.com",
"blocked_channels": null,
"social_links": {
"website": "https://www.example.com",
"linkedin": "https://linkedin.com/company/example"
},
"properties": {},
"timezone": null
},
"$user": {
"name": "Jamie Rivera",
"email": "jamie.rivera@example.com",
"distinct_id": "user_12345"
},
"$recipient": {
"name": "Jamie Rivera",
"email": "jamie.rivera@example.com",
"distinct_id": "user_12345"
},
"$actor": {
"name": "Taylor Chen",
"email": "taylor.chen@example.com",
"distinct_id": "actor_67890"
},
"$embedded_preference_url": "https://preferences.example.com/embed",
"$hosted_preference_url": "https://preferences.example.com/?key=xxxxxxxxxxxxxxx"
}
}{
"code": 401,
"error_code": "authentication_failed",
"type": "AuthenticationFailed",
"message": "Invalid service token.",
"detail": "Invalid service token."
}{
"code": 404,
"error_code": "not_found",
"type": "NotFound",
"message": "workspace 'demo' not found",
"detail": "workspace 'demo' not found"
}Authorizations
You can get Service Token from SuprSend dashboard -> Account Settings -> Service Tokens section.
Body
Input payload data with sample variable values.
Tenant ID for preview.
"default"
Whether to simulate batched/digest data.
Number of batched events to simulate (only relevant when is_batch is true).
2
Type of recipient.
user, object "user"
Distinct ID of the test recipient (when recipient_sub_type is user).
"user-123"
Object identifier (when recipient_sub_type is object).
Show child attributes
Show child attributes
Type of actor.
user, object Distinct ID of the actor user.
Object identifier for actor.
Show child attributes
Show child attributes
Response
Mock data updated successfully. Returns the same structure as Get Mock Data - both data (raw config) and transformed_data (resolved values).
The response is of type object.
Was this page helpful?
curl -X PATCH "https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/mock_data/" \
--header 'Authorization: ServiceToken <token>' \
--header 'Content-Type: application/json' \
--data '{
"payload": {"order_id": "ORD-1234", "amount": "$99.99"},
"tenant_id": "default",
"is_batch": false,
"recipient_sub_type": "user",
"recipient_distinct_id": "user-123"
}'import requests
url = "https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/mock_data/"
payload = {
"payload": {},
"tenant_id": "default",
"is_batch": False,
"batch_count": 2,
"recipient_sub_type": "user",
"recipient_distinct_id": "user-123",
"recipient_object": {
"object_type": "<string>",
"id": "<string>"
},
"actor_distinct_id": "<string>",
"actor_object": {
"object_type": "<string>",
"id": "<string>"
}
}
headers = {
"ServiceToken <token>": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'ServiceToken <token>': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
payload: {},
tenant_id: 'default',
is_batch: false,
batch_count: 2,
recipient_sub_type: 'user',
recipient_distinct_id: 'user-123',
recipient_object: {object_type: '<string>', id: '<string>'},
actor_distinct_id: '<string>',
actor_object: {object_type: '<string>', id: '<string>'}
})
};
fetch('https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/mock_data/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/mock_data/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'payload' => [
],
'tenant_id' => 'default',
'is_batch' => false,
'batch_count' => 2,
'recipient_sub_type' => 'user',
'recipient_distinct_id' => 'user-123',
'recipient_object' => [
'object_type' => '<string>',
'id' => '<string>'
],
'actor_distinct_id' => '<string>',
'actor_object' => [
'object_type' => '<string>',
'id' => '<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/v2/{workspace}/template/{template_slug}/mock_data/"
payload := strings.NewReader("{\n \"payload\": {},\n \"tenant_id\": \"default\",\n \"is_batch\": false,\n \"batch_count\": 2,\n \"recipient_sub_type\": \"user\",\n \"recipient_distinct_id\": \"user-123\",\n \"recipient_object\": {\n \"object_type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"actor_distinct_id\": \"<string>\",\n \"actor_object\": {\n \"object_type\": \"<string>\",\n \"id\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/mock_data/")
.header("ServiceToken <token>", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"payload\": {},\n \"tenant_id\": \"default\",\n \"is_batch\": false,\n \"batch_count\": 2,\n \"recipient_sub_type\": \"user\",\n \"recipient_distinct_id\": \"user-123\",\n \"recipient_object\": {\n \"object_type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"actor_distinct_id\": \"<string>\",\n \"actor_object\": {\n \"object_type\": \"<string>\",\n \"id\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/mock_data/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["ServiceToken <token>"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"payload\": {},\n \"tenant_id\": \"default\",\n \"is_batch\": false,\n \"batch_count\": 2,\n \"recipient_sub_type\": \"user\",\n \"recipient_distinct_id\": \"user-123\",\n \"recipient_object\": {\n \"object_type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"actor_distinct_id\": \"<string>\",\n \"actor_object\": {\n \"object_type\": \"<string>\",\n \"id\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"payload": {
"user": {
"name": "Pat Morgan"
},
"event": {
"status": "shipped"
}
},
"tenant_id": "default",
"is_batch": false,
"batch_count": 2,
"recipient_sub_type": "user",
"recipient_object": null,
"recipient_distinct_id": "user_12345",
"actor_sub_type": "user",
"actor_object": null,
"actor_distinct_id": "actor_67890"
},
"transformed_data": {
"user": {
"name": "Pat Morgan"
},
"event": {
"status": "shipped"
},
"$batch_key": "evaluated batch_key",
"$batched_events": [
{
"user": {
"name": "Pat Morgan"
},
"event": {
"status": "shipped"
}
},
{
"user": {
"name": "Pat Morgan"
},
"event": {
"status": "shipped"
}
}
],
"$batched_events_count": 2,
"$brand": {
"brand_id": "default",
"brand_name": "My Company",
"logo": "https://cdn.example.com/logo.png",
"primary_color": "#2E70E8",
"secondary_color": "#63A3F7",
"tertiary_color": "#FFFFFF",
"embedded_preference_url": "https://preferences.example.com/embed",
"hosted_preference_domain": "preferences.example.com",
"blocked_channels": null,
"social_links": {
"website": "https://www.example.com",
"linkedin": "https://linkedin.com/company/example"
},
"properties": {},
"timezone": null
},
"$user": {
"name": "Jamie Rivera",
"email": "jamie.rivera@example.com",
"distinct_id": "user_12345"
},
"$recipient": {
"name": "Jamie Rivera",
"email": "jamie.rivera@example.com",
"distinct_id": "user_12345"
},
"$actor": {
"name": "Taylor Chen",
"email": "taylor.chen@example.com",
"distinct_id": "actor_67890"
},
"$embedded_preference_url": "https://preferences.example.com/embed",
"$hosted_preference_url": "https://preferences.example.com/?key=xxxxxxxxxxxxxxx"
}
}{
"code": 401,
"error_code": "authentication_failed",
"type": "AuthenticationFailed",
"message": "Invalid service token.",
"detail": "Invalid service token."
}{
"code": 404,
"error_code": "not_found",
"type": "NotFound",
"message": "workspace 'demo' not found",
"detail": "workspace 'demo' not found"
}