curl --request POST \
--url https://brew.new/api/v1/automations/runs/{automationRunId}/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "Wrong segment — stopping before the second email."
}
'import requests
url = "https://brew.new/api/v1/automations/runs/{automationRunId}/cancel"
payload = { "reason": "Wrong segment — stopping before the second email." }
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({reason: 'Wrong segment — stopping before the second email.'})
};
fetch('https://brew.new/api/v1/automations/runs/{automationRunId}/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://brew.new/api/v1/automations/runs/{automationRunId}/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([
'reason' => 'Wrong segment — stopping before the second email.'
]),
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://brew.new/api/v1/automations/runs/{automationRunId}/cancel"
payload := strings.NewReader("{\n \"reason\": \"Wrong segment — stopping before the second email.\"\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://brew.new/api/v1/automations/runs/{automationRunId}/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"Wrong segment — stopping before the second email.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://brew.new/api/v1/automations/runs/{automationRunId}/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 \"reason\": \"Wrong segment — stopping before the second email.\"\n}"
response = http.request(request)
puts response.read_body{
"automationRunId": "jh7acthhe99pq4448xh83gn54x8eennb",
"status": "canceled",
"previousStatus": "running"
}Cancel an automation run
Stops ONE run (an event execution or a test run). Marks it canceled (first-terminal-wins: a late completion from the dying workflow can never overwrite it), wakes a run parked on a wait node so it observes the cancel now, and terminates the durable workflow run so a step stuck retrying is freed too.
Use when a contact must not receive the remaining steps of a journey that already started.
Input automationRunId in the path; an optional reason for the audit trail. Nothing further is sent; emails already delivered are NOT recalled and a canceled run cannot be resumed.
Returns 200 with the run’s new status and the previousStatus it held.
Errors 409 RUN_NOT_CANCELLABLE when the run already finished (completed, failed or canceled); 404 AUTOMATION_RUN_NOT_FOUND for an unknown or cross-brand id.
See also getAutomationRun, cancelAudienceRun (manual-audience launches), updateAutomation (paused / published).
curl --request POST \
--url https://brew.new/api/v1/automations/runs/{automationRunId}/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "Wrong segment — stopping before the second email."
}
'import requests
url = "https://brew.new/api/v1/automations/runs/{automationRunId}/cancel"
payload = { "reason": "Wrong segment — stopping before the second email." }
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({reason: 'Wrong segment — stopping before the second email.'})
};
fetch('https://brew.new/api/v1/automations/runs/{automationRunId}/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://brew.new/api/v1/automations/runs/{automationRunId}/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([
'reason' => 'Wrong segment — stopping before the second email.'
]),
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://brew.new/api/v1/automations/runs/{automationRunId}/cancel"
payload := strings.NewReader("{\n \"reason\": \"Wrong segment — stopping before the second email.\"\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://brew.new/api/v1/automations/runs/{automationRunId}/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"Wrong segment — stopping before the second email.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://brew.new/api/v1/automations/runs/{automationRunId}/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 \"reason\": \"Wrong segment — stopping before the second email.\"\n}"
response = http.request(request)
puts response.read_body{
"automationRunId": "jh7acthhe99pq4448xh83gn54x8eennb",
"status": "canceled",
"previousStatus": "running"
}Authorizations
Send your Brew API key as Authorization: Bearer brew_xxx.
Headers
The brand this request acts on. REQUIRED for organization-scoped credentials (otherwise 400 BRAND_ID_REQUIRED — there is no default brand); list ids with GET /v1/brands. Brand-scoped credentials may omit it, and sending a different brand returns 403 BRAND_SCOPE_MISMATCH. A brand outside your organization returns 404 BRAND_NOT_FOUND.
1 - 64Path Parameters
1 - 64Body
Why the run was stopped; stored on the run for the audit trail.
1 - 500Was this page helpful?