Edit a phase (prose and tools)
curl --request PATCH \
--url https://app.pepline.ai/api/v1/agents/{agent_slug}/flow/states/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"objective": "<string>",
"exit_criteria": "<string>",
"max_turns": 2,
"tools": [
"<string>"
]
}
'import requests
url = "https://app.pepline.ai/api/v1/agents/{agent_slug}/flow/states/{id}"
payload = {
"title": "<string>",
"objective": "<string>",
"exit_criteria": "<string>",
"max_turns": 2,
"tools": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
objective: '<string>',
exit_criteria: '<string>',
max_turns: 2,
tools: ['<string>']
})
};
fetch('https://app.pepline.ai/api/v1/agents/{agent_slug}/flow/states/{id}', 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.pepline.ai/api/v1/agents/{agent_slug}/flow/states/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'title' => '<string>',
'objective' => '<string>',
'exit_criteria' => '<string>',
'max_turns' => 2,
'tools' => [
'<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://app.pepline.ai/api/v1/agents/{agent_slug}/flow/states/{id}"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"objective\": \"<string>\",\n \"exit_criteria\": \"<string>\",\n \"max_turns\": 2,\n \"tools\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://app.pepline.ai/api/v1/agents/{agent_slug}/flow/states/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"objective\": \"<string>\",\n \"exit_criteria\": \"<string>\",\n \"max_turns\": 2,\n \"tools\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.pepline.ai/api/v1/agents/{agent_slug}/flow/states/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"objective\": \"<string>\",\n \"exit_criteria\": \"<string>\",\n \"max_turns\": 2,\n \"tools\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"object": "<string>",
"id": 123,
"key": "<string>",
"title": "<string>",
"position": 123,
"objective": "<string>",
"exit_criteria": "<string>",
"max_turns": 123,
"archived": true,
"slots": [
{
"object": "<string>",
"id": 123,
"key": "<string>",
"title": "<string>",
"archived": true,
"required": true,
"enum_values": [
"<string>"
],
"enum_labels": {},
"translations": {},
"description": "<string>"
}
],
"tools": [
"<string>"
]
}{
"error": {
"message": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"param": "<string>"
}
}Flow
Edit a phase (prose and tools)
Updates the phase’s title, objective, exit_criteria, max_turns, and/or tools. Trial-compiles.
PATCH
/
agents
/
{agent_slug}
/
flow
/
states
/
{id}
Edit a phase (prose and tools)
curl --request PATCH \
--url https://app.pepline.ai/api/v1/agents/{agent_slug}/flow/states/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"objective": "<string>",
"exit_criteria": "<string>",
"max_turns": 2,
"tools": [
"<string>"
]
}
'import requests
url = "https://app.pepline.ai/api/v1/agents/{agent_slug}/flow/states/{id}"
payload = {
"title": "<string>",
"objective": "<string>",
"exit_criteria": "<string>",
"max_turns": 2,
"tools": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
objective: '<string>',
exit_criteria: '<string>',
max_turns: 2,
tools: ['<string>']
})
};
fetch('https://app.pepline.ai/api/v1/agents/{agent_slug}/flow/states/{id}', 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.pepline.ai/api/v1/agents/{agent_slug}/flow/states/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'title' => '<string>',
'objective' => '<string>',
'exit_criteria' => '<string>',
'max_turns' => 2,
'tools' => [
'<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://app.pepline.ai/api/v1/agents/{agent_slug}/flow/states/{id}"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"objective\": \"<string>\",\n \"exit_criteria\": \"<string>\",\n \"max_turns\": 2,\n \"tools\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://app.pepline.ai/api/v1/agents/{agent_slug}/flow/states/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"objective\": \"<string>\",\n \"exit_criteria\": \"<string>\",\n \"max_turns\": 2,\n \"tools\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.pepline.ai/api/v1/agents/{agent_slug}/flow/states/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"objective\": \"<string>\",\n \"exit_criteria\": \"<string>\",\n \"max_turns\": 2,\n \"tools\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"object": "<string>",
"id": 123,
"key": "<string>",
"title": "<string>",
"position": 123,
"objective": "<string>",
"exit_criteria": "<string>",
"max_turns": 123,
"archived": true,
"slots": [
{
"object": "<string>",
"id": 123,
"key": "<string>",
"title": "<string>",
"archived": true,
"required": true,
"enum_values": [
"<string>"
],
"enum_labels": {},
"translations": {},
"description": "<string>"
}
],
"tools": [
"<string>"
]
}{
"error": {
"message": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"param": "<string>"
}
}Authorizations
Your secret key (pep_sk_…) from Settings → API. Keys are org-scoped; treat them like passwords.
Body
application/json
Required range:
x >= 1Full replacement set of the phase's tools. Known tools: consult_knowledge (ground replies in activated knowledge), capture_slots (record configured answers), suggest_replies (one-tap option chips), offer_deliverable (promise + trigger the wrap-up document). Removing capture_slots is refused while the phase has required answers.
Response
The updated phase.
Allowed value:
"flow_state"Available options:
step, loop, terminal Show child attributes
Show child attributes
⌘I

