curl --request POST \
--url https://api.usesimple.ai/api/v1/journeys/{key}/enrollments/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"idempotencyKey": "appt-APPT02984416",
"reason": "Appointment cancelled in Salesforce"
}
'import requests
url = "https://api.usesimple.ai/api/v1/journeys/{key}/enrollments/cancel"
payload = {
"idempotencyKey": "appt-APPT02984416",
"reason": "Appointment cancelled in Salesforce"
}
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({
idempotencyKey: 'appt-APPT02984416',
reason: 'Appointment cancelled in Salesforce'
})
};
fetch('https://api.usesimple.ai/api/v1/journeys/{key}/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.usesimple.ai/api/v1/journeys/{key}/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([
'idempotencyKey' => 'appt-APPT02984416',
'reason' => 'Appointment cancelled in Salesforce'
]),
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.usesimple.ai/api/v1/journeys/{key}/enrollments/cancel"
payload := strings.NewReader("{\n \"idempotencyKey\": \"appt-APPT02984416\",\n \"reason\": \"Appointment cancelled in Salesforce\"\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.usesimple.ai/api/v1/journeys/{key}/enrollments/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"idempotencyKey\": \"appt-APPT02984416\",\n \"reason\": \"Appointment cancelled in Salesforce\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usesimple.ai/api/v1/journeys/{key}/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 \"idempotencyKey\": \"appt-APPT02984416\",\n \"reason\": \"Appointment cancelled in Salesforce\"\n}"
response = http.request(request)
puts response.read_body{
"enrollmentId": "<string>",
"status": "active",
"endedReason": "<string>",
"skippedReason": "<string>",
"created": true,
"nextTouchAt": "2023-11-07T05:31:56Z",
"contact": {
"timezone": "<string>",
"timezoneSource": "<string>"
}
}{
"status": "error",
"success": false,
"error": "<string>",
"errors": [
"<string>"
]
}{
"status": "error",
"success": false,
"error": "<string>",
"errors": [
"<string>"
]
}{
"status": "error",
"success": false,
"error": "<string>",
"errors": [
"<string>"
]
}Cancel a Contact's Journey Enrollment
End a contact’s journey enrollment from your system by the idempotency key it was created with or by its external id, with an optional reason.
curl --request POST \
--url https://api.usesimple.ai/api/v1/journeys/{key}/enrollments/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"idempotencyKey": "appt-APPT02984416",
"reason": "Appointment cancelled in Salesforce"
}
'import requests
url = "https://api.usesimple.ai/api/v1/journeys/{key}/enrollments/cancel"
payload = {
"idempotencyKey": "appt-APPT02984416",
"reason": "Appointment cancelled in Salesforce"
}
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({
idempotencyKey: 'appt-APPT02984416',
reason: 'Appointment cancelled in Salesforce'
})
};
fetch('https://api.usesimple.ai/api/v1/journeys/{key}/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.usesimple.ai/api/v1/journeys/{key}/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([
'idempotencyKey' => 'appt-APPT02984416',
'reason' => 'Appointment cancelled in Salesforce'
]),
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.usesimple.ai/api/v1/journeys/{key}/enrollments/cancel"
payload := strings.NewReader("{\n \"idempotencyKey\": \"appt-APPT02984416\",\n \"reason\": \"Appointment cancelled in Salesforce\"\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.usesimple.ai/api/v1/journeys/{key}/enrollments/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"idempotencyKey\": \"appt-APPT02984416\",\n \"reason\": \"Appointment cancelled in Salesforce\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usesimple.ai/api/v1/journeys/{key}/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 \"idempotencyKey\": \"appt-APPT02984416\",\n \"reason\": \"Appointment cancelled in Salesforce\"\n}"
response = http.request(request)
puts response.read_body{
"enrollmentId": "<string>",
"status": "active",
"endedReason": "<string>",
"skippedReason": "<string>",
"created": true,
"nextTouchAt": "2023-11-07T05:31:56Z",
"contact": {
"timezone": "<string>",
"timezoneSource": "<string>"
}
}{
"status": "error",
"success": false,
"error": "<string>",
"errors": [
"<string>"
]
}{
"status": "error",
"success": false,
"error": "<string>",
"errors": [
"<string>"
]
}{
"status": "error",
"success": false,
"error": "<string>",
"errors": [
"<string>"
]
}idempotencyKey or externalId. An external id can belong to several enrollments over time, for example a lead enrolled again, and every active one carrying it ends.
The enrollment ends with reason cancelled, and the reason you send shows in the contact’s history.Authorizations
Your API key, sent as Authorization: Bearer YOUR_API_KEY
Path Parameters
The journey's key, such as appointment-confirmations. It is shown on the journey's Enrollment tab.
Body
The key the enrollment was created with. Send this or externalId.
255The enrollment's external id. Send this or idempotencyKey.
255Why the enrollment was cancelled. Shown in the contact's history.
500Response
The enrollment ended, or had already ended.
The enrollment's id. Empty when the contact was skipped.
active while the journey is working the contact, ended once it finished, skipped when the contact could not be enrolled.
active, ended, skipped Why the enrollment ended, such as goal_met, opted_out, cancelled, total_cap or exhausted.
Why the contact was not enrolled, in words, such as Active in another journey.
True when this request created the enrollment.
When a call or text is going out right away. Null when the next step is later; it is planned when it comes due.
The contact's time zone, when known.
Show child attributes
Show child attributes