Sequences
Cancel Sequence Enrollments
Cancel active or waiting subscriber enrollments in one sequence
POST
/
api
/
v1
/
sequences
/
{sequenceId}
/
enrollments
/
cancel
Cancel Sequence Enrollments
curl --request POST \
--url https://api.sequenzy.com/api/v1/sequences/{sequenceId}/enrollments/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cancelAll": true,
"subscriberId": "<string>",
"subscriberIds": [
{}
],
"fieldPath": "<string>",
"fieldValues": [
{}
],
"dryRun": true,
"reason": "<string>"
}
'import requests
url = "https://api.sequenzy.com/api/v1/sequences/{sequenceId}/enrollments/cancel"
payload = {
"cancelAll": True,
"subscriberId": "<string>",
"subscriberIds": [{}],
"fieldPath": "<string>",
"fieldValues": [{}],
"dryRun": True,
"reason": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
cancelAll: true,
subscriberId: '<string>',
subscriberIds: [{}],
fieldPath: '<string>',
fieldValues: [{}],
dryRun: true,
reason: '<string>'
})
};
fetch('https://api.sequenzy.com/api/v1/sequences/{sequenceId}/enrollments/cancel', 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.sequenzy.com/api/v1/sequences/{sequenceId}/enrollments/cancel",
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([
'cancelAll' => true,
'subscriberId' => '<string>',
'subscriberIds' => [
[
]
],
'fieldPath' => '<string>',
'fieldValues' => [
[
]
],
'dryRun' => true,
'reason' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.sequenzy.com/api/v1/sequences/{sequenceId}/enrollments/cancel"
payload := strings.NewReader("{\n \"cancelAll\": true,\n \"subscriberId\": \"<string>\",\n \"subscriberIds\": [\n {}\n ],\n \"fieldPath\": \"<string>\",\n \"fieldValues\": [\n {}\n ],\n \"dryRun\": true,\n \"reason\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.sequenzy.com/api/v1/sequences/{sequenceId}/enrollments/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cancelAll\": true,\n \"subscriberId\": \"<string>\",\n \"subscriberIds\": [\n {}\n ],\n \"fieldPath\": \"<string>\",\n \"fieldValues\": [\n {}\n ],\n \"dryRun\": true,\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sequenzy.com/api/v1/sequences/{sequenceId}/enrollments/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cancelAll\": true,\n \"subscriberId\": \"<string>\",\n \"subscriberIds\": [\n {}\n ],\n \"fieldPath\": \"<string>\",\n \"fieldValues\": [\n {}\n ],\n \"dryRun\": true,\n \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"sequenceId": "seq_abc123",
"dryRun": false,
"target": { "mode": "all" },
"matchedCount": 3522,
"cancelledCount": 1000,
"remainingCount": 2522,
"enrollments": [
{
"tokenId": "tok_abc123",
"subscriberId": "sub_abc123",
"subscriberEmail": "customer@example.com",
"status": "cancelled",
"enrollmentKey": "segment:seg_abc123"
}
],
"hasMore": true,
"message": "Cancelled 1000 sequence enrollments. 2522 still match; repeat this request to continue."
}
{
"error": "Provide exactly one target: subscriberId, subscriberIds, fieldValues, or cancelAll."
}
{
"error": "Invalid API key"
}
{
"error": "No companies found. Create a company first using the create_company tool."
}
{
"error": "Sequence not found"
}
Cancel Sequence Enrollments
Cancel active or waiting enrollments in a single sequence. Provide exactly one target:| Target | Use it when |
|---|---|
cancelAll | You want to fully stop a live sequence, including segment-triggered enrollments that share no entry field value |
subscriberIds | You have a specific batch of contacts to pull out |
subscriberId | You are cancelling one contact |
fieldValues | Enrollments are keyed on a stored entry event property such as order.id |
cancelAll is what removes the contacts already mid-flight.
Request
string
required
Sequence ID.
boolean
Cancel every active or waiting enrollment in the sequence, regardless of how
contacts entered it. Defaults to a dry run unless you set
dryRun to false.string
Subscriber ID to cancel in this sequence.
array
Up to 500 subscriber IDs to cancel in this sequence. IDs that do not resolve
come back in
target.notFoundSubscriberIds. Defaults to a dry run unless you
set dryRun to false.string
Dot-path inside the token’s entry event properties, such as
order.id or
event.id. If omitted, the sequence’s enrollmentFieldPath is used.array
Entry field values to match.
boolean
When
true, returns matching enrollments without cancelling them.
cancelAll, subscriberIds, and fieldValues default to a dry run unless
you set dryRun to false. A single subscriberId cancels immediately.string
Optional reason stored on cancelled enrollment tokens.
curl -X POST "https://api.sequenzy.com/api/v1/sequences/seq_abc123/enrollments/cancel" \
-H "Authorization: Bearer seq_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"cancelAll": true,
"dryRun": false,
"reason": "Lifecycle cutover"
}'
Paging through a large cancellation
Cancelling an enrollment emits asequence.stopped event per contact, so each request cancels at most 1,000 enrollments. When the response reports remainingCount above zero, send the same request again until it reaches zero.
# The CLI does this loop for you.
sequenzy sequences cancel-enrollments seq_abc123 --all --apply --reason "Lifecycle cutover"
Responses
{
"success": true,
"sequenceId": "seq_abc123",
"dryRun": false,
"target": { "mode": "all" },
"matchedCount": 3522,
"cancelledCount": 1000,
"remainingCount": 2522,
"enrollments": [
{
"tokenId": "tok_abc123",
"subscriberId": "sub_abc123",
"subscriberEmail": "customer@example.com",
"status": "cancelled",
"enrollmentKey": "segment:seg_abc123"
}
],
"hasMore": true,
"message": "Cancelled 1000 sequence enrollments. 2522 still match; repeat this request to continue."
}
{
"error": "Provide exactly one target: subscriberId, subscriberIds, fieldValues, or cancelAll."
}
{
"error": "Invalid API key"
}
{
"error": "No companies found. Create a company first using the create_company tool."
}
{
"error": "Sequence not found"
}
⌘I
Cancel Sequence Enrollments
curl --request POST \
--url https://api.sequenzy.com/api/v1/sequences/{sequenceId}/enrollments/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cancelAll": true,
"subscriberId": "<string>",
"subscriberIds": [
{}
],
"fieldPath": "<string>",
"fieldValues": [
{}
],
"dryRun": true,
"reason": "<string>"
}
'import requests
url = "https://api.sequenzy.com/api/v1/sequences/{sequenceId}/enrollments/cancel"
payload = {
"cancelAll": True,
"subscriberId": "<string>",
"subscriberIds": [{}],
"fieldPath": "<string>",
"fieldValues": [{}],
"dryRun": True,
"reason": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
cancelAll: true,
subscriberId: '<string>',
subscriberIds: [{}],
fieldPath: '<string>',
fieldValues: [{}],
dryRun: true,
reason: '<string>'
})
};
fetch('https://api.sequenzy.com/api/v1/sequences/{sequenceId}/enrollments/cancel', 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.sequenzy.com/api/v1/sequences/{sequenceId}/enrollments/cancel",
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([
'cancelAll' => true,
'subscriberId' => '<string>',
'subscriberIds' => [
[
]
],
'fieldPath' => '<string>',
'fieldValues' => [
[
]
],
'dryRun' => true,
'reason' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.sequenzy.com/api/v1/sequences/{sequenceId}/enrollments/cancel"
payload := strings.NewReader("{\n \"cancelAll\": true,\n \"subscriberId\": \"<string>\",\n \"subscriberIds\": [\n {}\n ],\n \"fieldPath\": \"<string>\",\n \"fieldValues\": [\n {}\n ],\n \"dryRun\": true,\n \"reason\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.sequenzy.com/api/v1/sequences/{sequenceId}/enrollments/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cancelAll\": true,\n \"subscriberId\": \"<string>\",\n \"subscriberIds\": [\n {}\n ],\n \"fieldPath\": \"<string>\",\n \"fieldValues\": [\n {}\n ],\n \"dryRun\": true,\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sequenzy.com/api/v1/sequences/{sequenceId}/enrollments/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cancelAll\": true,\n \"subscriberId\": \"<string>\",\n \"subscriberIds\": [\n {}\n ],\n \"fieldPath\": \"<string>\",\n \"fieldValues\": [\n {}\n ],\n \"dryRun\": true,\n \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"sequenceId": "seq_abc123",
"dryRun": false,
"target": { "mode": "all" },
"matchedCount": 3522,
"cancelledCount": 1000,
"remainingCount": 2522,
"enrollments": [
{
"tokenId": "tok_abc123",
"subscriberId": "sub_abc123",
"subscriberEmail": "customer@example.com",
"status": "cancelled",
"enrollmentKey": "segment:seg_abc123"
}
],
"hasMore": true,
"message": "Cancelled 1000 sequence enrollments. 2522 still match; repeat this request to continue."
}
{
"error": "Provide exactly one target: subscriberId, subscriberIds, fieldValues, or cancelAll."
}
{
"error": "Invalid API key"
}
{
"error": "No companies found. Create a company first using the create_company tool."
}
{
"error": "Sequence not found"
}