curl --request POST \
--url https://api.example.com/simulated-connections \
--header 'Content-Type: application/json' \
--data '
{
"retailer_id": "walmart",
"customer_id": "test-customer-1",
"email": "[email protected]",
"mobile": "+15555550100",
"include_purchases": true
}
'import requests
url = "https://api.example.com/simulated-connections"
payload = {
"retailer_id": "walmart",
"customer_id": "test-customer-1",
"email": "[email protected]",
"mobile": "+15555550100",
"include_purchases": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
retailer_id: 'walmart',
customer_id: 'test-customer-1',
email: '[email protected]',
mobile: '+15555550100',
include_purchases: true
})
};
fetch('https://api.example.com/simulated-connections', 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://api.example.com/simulated-connections",
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([
'retailer_id' => 'walmart',
'customer_id' => 'test-customer-1',
'email' => '[email protected]',
'mobile' => '+15555550100',
'include_purchases' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://api.example.com/simulated-connections"
payload := strings.NewReader("{\n \"retailer_id\": \"walmart\",\n \"customer_id\": \"test-customer-1\",\n \"email\": \"[email protected]\",\n \"mobile\": \"+15555550100\",\n \"include_purchases\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.example.com/simulated-connections")
.header("Content-Type", "application/json")
.body("{\n \"retailer_id\": \"walmart\",\n \"customer_id\": \"test-customer-1\",\n \"email\": \"[email protected]\",\n \"mobile\": \"+15555550100\",\n \"include_purchases\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/simulated-connections")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"retailer_id\": \"walmart\",\n \"customer_id\": \"test-customer-1\",\n \"email\": \"[email protected]\",\n \"mobile\": \"+15555550100\",\n \"include_purchases\": true\n}"
response = http.request(request)
puts response.read_body{
"connection_id": "01J51S0JYV6N7K1030CV1ZKSCA",
"customer_id": "8a46e581-48ba-498a-9ad0-2ee72582e1af",
"retailer_id": "01J7SC0NN73R6F5VVSP3ZKPDA3",
"status": "active",
"email": "[email protected]",
"mobile": "+1234567890",
"creation_date": "2024-08-13T17:27:57.913Z",
"tags": {
"campaign": "summer_sweeps"
},
"is_simulated": false
}Simulate Connection
Create an active simulated test connection, as the dashboard’s event simulator does, to test your webhook or integration. Emits connection.activated to your webhooks, marked is_simulated; starter purchases are backdated history and emit nothing (simulate a purchase to send purchase.created). Simulated connections never collect real purchases.
curl --request POST \
--url https://api.example.com/simulated-connections \
--header 'Content-Type: application/json' \
--data '
{
"retailer_id": "walmart",
"customer_id": "test-customer-1",
"email": "[email protected]",
"mobile": "+15555550100",
"include_purchases": true
}
'import requests
url = "https://api.example.com/simulated-connections"
payload = {
"retailer_id": "walmart",
"customer_id": "test-customer-1",
"email": "[email protected]",
"mobile": "+15555550100",
"include_purchases": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
retailer_id: 'walmart',
customer_id: 'test-customer-1',
email: '[email protected]',
mobile: '+15555550100',
include_purchases: true
})
};
fetch('https://api.example.com/simulated-connections', 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://api.example.com/simulated-connections",
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([
'retailer_id' => 'walmart',
'customer_id' => 'test-customer-1',
'email' => '[email protected]',
'mobile' => '+15555550100',
'include_purchases' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://api.example.com/simulated-connections"
payload := strings.NewReader("{\n \"retailer_id\": \"walmart\",\n \"customer_id\": \"test-customer-1\",\n \"email\": \"[email protected]\",\n \"mobile\": \"+15555550100\",\n \"include_purchases\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.example.com/simulated-connections")
.header("Content-Type", "application/json")
.body("{\n \"retailer_id\": \"walmart\",\n \"customer_id\": \"test-customer-1\",\n \"email\": \"[email protected]\",\n \"mobile\": \"+15555550100\",\n \"include_purchases\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/simulated-connections")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"retailer_id\": \"walmart\",\n \"customer_id\": \"test-customer-1\",\n \"email\": \"[email protected]\",\n \"mobile\": \"+15555550100\",\n \"include_purchases\": true\n}"
response = http.request(request)
puts response.read_body{
"connection_id": "01J51S0JYV6N7K1030CV1ZKSCA",
"customer_id": "8a46e581-48ba-498a-9ad0-2ee72582e1af",
"retailer_id": "01J7SC0NN73R6F5VVSP3ZKPDA3",
"status": "active",
"email": "[email protected]",
"mobile": "+1234567890",
"creation_date": "2024-08-13T17:27:57.913Z",
"tags": {
"campaign": "summer_sweeps"
},
"is_simulated": false
}connection.activated to webhook destinations that accept simulated events. The connection is marked is_simulated: true and never collects real purchases. Every call creates a new connection.
By default it also gets 1 to 4 simulated purchases, dated in the last 60 days as history. They don’t send purchase.created. Set include_purchases to false to skip them, and use Simulate a purchase to send that event. Simulated connections appear in List connections and Get a connection, marked is_simulated.
An unknown retailer_id returns 422.
Call it with your API key, or with a Subtotal Connector OAuth token that includes simulator:write. A token without it receives 403 insufficient_scope. Partner app tokens don’t include it.Body
The public POST /simulated-connections body.
The retailer to simulate a link to
1"walmart"
Your identifier for the test customer; generated when omitted
64"test-customer-1"
The test customer's mobile
16"+15555550100"
Also create 1–4 simulated purchases of random retailer products, dated in the last 60 days as history; they emit no events
Response
Successful Response
A unique identifier for the connection
"01J51S0JYV6N7K1030CV1ZKSCA"
A unique identifier used to map connections to customer records in external systems.
"8a46e581-48ba-498a-9ad0-2ee72582e1af"
The unique identifier for the retailer in the connection
"01J7SC0NN73R6F5VVSP3ZKPDA3"
The status of the connection
active, initialized, unauthenticated, disconnected "active"
The customer's email address
The customer's mobile phone number
"+1234567890"
When the connection was created
"2024-08-13T17:27:57.913Z"
Client-defined attribution tags recorded when the connection is created, for grouping connection metrics — e.g. {"campaign": "summer_sweeps", "program": "loyalty"}. Names and values are opaque to Subtotal and are never interpreted. At most 10 tags; names up to 64 characters, values up to 256. Intended for campaign and source metadata — do not put consumer PII in tags.
Show child attributes
Show child attributes
{ "campaign": "summer_sweeps" }
True for a test connection made with the event simulator. Its events are marked is_simulated too, and it never collects real purchases.
false