Cancel Flows
Submit Step Response
Submit a response for the current step in a cancel flow session.
POST
/
v1
/
cancel-flows
/
sessions
/
{id}
/
submit
Submit a step response in a session
curl --request POST \
--url https://billing.example.com/v1/cancel-flows/sessions/{id}/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"response": "<unknown>",
"step_index": 1
}
'import requests
url = "https://billing.example.com/v1/cancel-flows/sessions/{id}/submit"
payload = {
"response": "<unknown>",
"step_index": 1
}
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({response: '<unknown>', step_index: 1})
};
fetch('https://billing.example.com/v1/cancel-flows/sessions/{id}/submit', 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://billing.example.com/v1/cancel-flows/sessions/{id}/submit",
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([
'response' => '<unknown>',
'step_index' => 1
]),
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://billing.example.com/v1/cancel-flows/sessions/{id}/submit"
payload := strings.NewReader("{\n \"response\": \"<unknown>\",\n \"step_index\": 1\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://billing.example.com/v1/cancel-flows/sessions/{id}/submit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"response\": \"<unknown>\",\n \"step_index\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/cancel-flows/sessions/{id}/submit")
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 \"response\": \"<unknown>\",\n \"step_index\": 1\n}"
response = http.request(request)
puts response.read_body{
"session_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "in_progress",
"next_step": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"flow_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"step_order": 123,
"step_type": "survey",
"config": "<unknown>",
"created_at": "2023-11-07T05:31:56Z"
},
"saved_by_offer": true,
"completed": true
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The cancel flow session ID (csess_ prefix). |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
step_id | string | Yes | The ID of the step being submitted. |
response | object | No | A key-value map of the customer’s response for this step. |
accepted_offer | boolean | No | Whether the customer accepted a retention offer. Defaults to false. |
Example Request
curl -X POST "https://api.recurso.io/v1/cancel-flows/sessions/csess_0a3f7c9e1b5d/submit" \
-H "Authorization: Bearer rsk_live_9f8a7b6c5d4e3f2a1b0c" \
-H "Content-Type: application/json" \
-d '{
"step_id": "cstep_01h8x3mw9n4q",
"response": {
"reason": "too_expensive",
"comment": "The price increased too much at renewal."
},
"accepted_offer": false
}'
Response
{
"id": "csess_0a3f7c9e1b5d",
"object": "cancel_flow_session",
"status": "in_progress",
"flow_id": "cflow_01h8x3kv7m2p",
"customer_id": "cust_4kTg8LpR2mXn",
"subscription_id": "sub_7vWq3JsN9bYz",
"current_step_index": 1,
"current_step": {
"id": "cstep_01h8x3pw2r6s",
"type": "offer",
"title": "How about a discount?",
"offer": {
"type": "percentage_discount",
"value": 25,
"duration_months": 3
}
},
"responses": [
{
"step_id": "cstep_01h8x3mw9n4q",
"response": {
"reason": "too_expensive",
"comment": "The price increased too much at renewal."
},
"accepted_offer": false,
"submitted_at": "2026-06-23T11:05:10Z"
}
],
"started_at": "2026-06-23T11:04:22Z",
"completed_at": null
}
Authorizations
Tenant API key obtained from POST /auth/register or POST /v1/developer/keys.
Path Parameters
Body
application/json
⌘I
Submit a step response in a session
curl --request POST \
--url https://billing.example.com/v1/cancel-flows/sessions/{id}/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"response": "<unknown>",
"step_index": 1
}
'import requests
url = "https://billing.example.com/v1/cancel-flows/sessions/{id}/submit"
payload = {
"response": "<unknown>",
"step_index": 1
}
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({response: '<unknown>', step_index: 1})
};
fetch('https://billing.example.com/v1/cancel-flows/sessions/{id}/submit', 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://billing.example.com/v1/cancel-flows/sessions/{id}/submit",
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([
'response' => '<unknown>',
'step_index' => 1
]),
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://billing.example.com/v1/cancel-flows/sessions/{id}/submit"
payload := strings.NewReader("{\n \"response\": \"<unknown>\",\n \"step_index\": 1\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://billing.example.com/v1/cancel-flows/sessions/{id}/submit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"response\": \"<unknown>\",\n \"step_index\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/cancel-flows/sessions/{id}/submit")
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 \"response\": \"<unknown>\",\n \"step_index\": 1\n}"
response = http.request(request)
puts response.read_body{
"session_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "in_progress",
"next_step": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"flow_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"step_order": 123,
"step_type": "survey",
"config": "<unknown>",
"created_at": "2023-11-07T05:31:56Z"
},
"saved_by_offer": true,
"completed": true
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}