Create a new flow execution
curl --request POST \
--url https://app.kapso.ai/api/v1/flows/{flow_id}/executions \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"phone_number": "+1234567890",
"whatsapp_config_id": "config-123abc",
"variables": {
"user_id": "123",
"name": "John Doe",
"email": "john@example.com"
},
"context": {
"source": "mobile_app",
"version": "1.2.3"
},
"initial_data": {}
}
'import requests
url = "https://app.kapso.ai/api/v1/flows/{flow_id}/executions"
payload = {
"phone_number": "+1234567890",
"whatsapp_config_id": "config-123abc",
"variables": {
"user_id": "123",
"name": "John Doe",
"email": "john@example.com"
},
"context": {
"source": "mobile_app",
"version": "1.2.3"
},
"initial_data": {}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phone_number: '+1234567890',
whatsapp_config_id: 'config-123abc',
variables: {user_id: '123', name: 'John Doe', email: 'john@example.com'},
context: {source: 'mobile_app', version: '1.2.3'},
initial_data: {}
})
};
fetch('https://app.kapso.ai/api/v1/flows/{flow_id}/executions', 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://app.kapso.ai/api/v1/flows/{flow_id}/executions",
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([
'phone_number' => '+1234567890',
'whatsapp_config_id' => 'config-123abc',
'variables' => [
'user_id' => '123',
'name' => 'John Doe',
'email' => 'john@example.com'
],
'context' => [
'source' => 'mobile_app',
'version' => '1.2.3'
],
'initial_data' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://app.kapso.ai/api/v1/flows/{flow_id}/executions"
payload := strings.NewReader("{\n \"phone_number\": \"+1234567890\",\n \"whatsapp_config_id\": \"config-123abc\",\n \"variables\": {\n \"user_id\": \"123\",\n \"name\": \"John Doe\",\n \"email\": \"john@example.com\"\n },\n \"context\": {\n \"source\": \"mobile_app\",\n \"version\": \"1.2.3\"\n },\n \"initial_data\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://app.kapso.ai/api/v1/flows/{flow_id}/executions")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"phone_number\": \"+1234567890\",\n \"whatsapp_config_id\": \"config-123abc\",\n \"variables\": {\n \"user_id\": \"123\",\n \"name\": \"John Doe\",\n \"email\": \"john@example.com\"\n },\n \"context\": {\n \"source\": \"mobile_app\",\n \"version\": \"1.2.3\"\n },\n \"initial_data\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.kapso.ai/api/v1/flows/{flow_id}/executions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone_number\": \"+1234567890\",\n \"whatsapp_config_id\": \"config-123abc\",\n \"variables\": {\n \"user_id\": \"123\",\n \"name\": \"John Doe\",\n \"email\": \"john@example.com\"\n },\n \"context\": {\n \"source\": \"mobile_app\",\n \"version\": \"1.2.3\"\n },\n \"initial_data\": {}\n}"
response = http.request(request)
puts response.read_body{
"flow_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tracking_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"message": "Flow execution queued"
}{
"error": "Resource not found",
"status": 404,
"message": "The requested resource could not be found"
}{
"error": "Resource not found",
"status": 404,
"message": "The requested resource could not be found"
}{
"error": "Flow is not active",
"details": "Flow must be in active status and have an active API trigger, or whatsapp_config_id does not belong to this project"
}Flow Executions
Create a new flow execution
Triggers a new execution of a flow via API. The flow must have an active API trigger configured.
POST
/
flows
/
{flow_id}
/
executions
Create a new flow execution
curl --request POST \
--url https://app.kapso.ai/api/v1/flows/{flow_id}/executions \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"phone_number": "+1234567890",
"whatsapp_config_id": "config-123abc",
"variables": {
"user_id": "123",
"name": "John Doe",
"email": "john@example.com"
},
"context": {
"source": "mobile_app",
"version": "1.2.3"
},
"initial_data": {}
}
'import requests
url = "https://app.kapso.ai/api/v1/flows/{flow_id}/executions"
payload = {
"phone_number": "+1234567890",
"whatsapp_config_id": "config-123abc",
"variables": {
"user_id": "123",
"name": "John Doe",
"email": "john@example.com"
},
"context": {
"source": "mobile_app",
"version": "1.2.3"
},
"initial_data": {}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phone_number: '+1234567890',
whatsapp_config_id: 'config-123abc',
variables: {user_id: '123', name: 'John Doe', email: 'john@example.com'},
context: {source: 'mobile_app', version: '1.2.3'},
initial_data: {}
})
};
fetch('https://app.kapso.ai/api/v1/flows/{flow_id}/executions', 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://app.kapso.ai/api/v1/flows/{flow_id}/executions",
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([
'phone_number' => '+1234567890',
'whatsapp_config_id' => 'config-123abc',
'variables' => [
'user_id' => '123',
'name' => 'John Doe',
'email' => 'john@example.com'
],
'context' => [
'source' => 'mobile_app',
'version' => '1.2.3'
],
'initial_data' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://app.kapso.ai/api/v1/flows/{flow_id}/executions"
payload := strings.NewReader("{\n \"phone_number\": \"+1234567890\",\n \"whatsapp_config_id\": \"config-123abc\",\n \"variables\": {\n \"user_id\": \"123\",\n \"name\": \"John Doe\",\n \"email\": \"john@example.com\"\n },\n \"context\": {\n \"source\": \"mobile_app\",\n \"version\": \"1.2.3\"\n },\n \"initial_data\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://app.kapso.ai/api/v1/flows/{flow_id}/executions")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"phone_number\": \"+1234567890\",\n \"whatsapp_config_id\": \"config-123abc\",\n \"variables\": {\n \"user_id\": \"123\",\n \"name\": \"John Doe\",\n \"email\": \"john@example.com\"\n },\n \"context\": {\n \"source\": \"mobile_app\",\n \"version\": \"1.2.3\"\n },\n \"initial_data\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.kapso.ai/api/v1/flows/{flow_id}/executions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone_number\": \"+1234567890\",\n \"whatsapp_config_id\": \"config-123abc\",\n \"variables\": {\n \"user_id\": \"123\",\n \"name\": \"John Doe\",\n \"email\": \"john@example.com\"\n },\n \"context\": {\n \"source\": \"mobile_app\",\n \"version\": \"1.2.3\"\n },\n \"initial_data\": {}\n}"
response = http.request(request)
puts response.read_body{
"flow_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tracking_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"message": "Flow execution queued"
}{
"error": "Resource not found",
"status": 404,
"message": "The requested resource could not be found"
}{
"error": "Resource not found",
"status": 404,
"message": "The requested resource could not be found"
}{
"error": "Flow is not active",
"details": "Flow must be in active status and have an active API trigger, or whatsapp_config_id does not belong to this project"
}Authorizations
API key required for all endpoints
Path Parameters
Body
application/json
Phone number to associate with this flow execution (required for conversation tracking)
Pattern:
^\+[1-9]\d{1,14}$Example:
"+1234567890"
Optional WhatsApp configuration to use for this execution. Must belong to the project (direct or via customer). When omitted, uses project's default WhatsApp config.
Example:
"config-123abc"
Variables to pass to the flow execution
Example:
{
"user_id": "123",
"name": "John Doe",
"email": "john@example.com"
}
Additional context for the execution
Example:
{
"source": "mobile_app",
"version": "1.2.3"
}
Initial data to pass to the flow
⌘I

