Restore a previous flow version
curl --request POST \
--url https://api.goyappr.com/agents/{id}/flow/restore \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.goyappr.com/agents/{id}/flow/restore"
payload = { "version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }
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({version_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'})
};
fetch('https://api.goyappr.com/agents/{id}/flow/restore', 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.goyappr.com/agents/{id}/flow/restore",
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([
'version_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
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.goyappr.com/agents/{id}/flow/restore"
payload := strings.NewReader("{\n \"version_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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.goyappr.com/agents/{id}/flow/restore")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"version_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/agents/{id}/flow/restore")
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 \"version_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_bodyFlow Agents
Restore Flow Version
Replaces the agent’s current flow_config with the contents of a previously-saved
version. The current state stays in version history (every save creates a snapshot,
deduped by content hash) so you can always restore back to it later.
Validation:
- Agent must be a flow agent (
type='flow'). version_idmust reference a row fromGET /agents/:id/flow/versionsfor the same agent.
Required scope: agents:update.
POST
/
agents
/
{id}
/
flow
/
restore
Restore a previous flow version
curl --request POST \
--url https://api.goyappr.com/agents/{id}/flow/restore \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.goyappr.com/agents/{id}/flow/restore"
payload = { "version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }
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({version_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'})
};
fetch('https://api.goyappr.com/agents/{id}/flow/restore', 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.goyappr.com/agents/{id}/flow/restore",
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([
'version_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
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.goyappr.com/agents/{id}/flow/restore"
payload := strings.NewReader("{\n \"version_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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.goyappr.com/agents/{id}/flow/restore")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"version_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/agents/{id}/flow/restore")
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 \"version_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_bodyReplaces a flow agent’s current
flow_config with the contents of a previously-saved version. Useful when a recent change broke the flow and you want to go back to a known-good state without manually rebuilding.
Required scope: agents:update (same as PATCH /agents/:id).
How it works
Every save of a flow agent creates a row inflow_versions (deduped by content hash, so re-saving the same graph doesn’t create redundant rows). Calling restore:
- Looks up the row identified by
version_id - Verifies the row belongs to this agent
- Sets
agents.flow_configto that row’s stored content - Snapshots a new
flow_versionsrow reflecting the restored state — but if the restored content equals the current head (you’re restoring to where you already are), the unique constraint silently swallows it. No history pollution.
Workflow
- List versions:
GET /agents/:id/flow/versions→ pick aversion_id - Restore:
POST /agents/:id/flow/restorewith{ "version_id": "..." } - Optionally verify:
GET /agents/:idand inspectflow_config
Constraints
- Agent must be a flow agent (
type='flow'). Restoring on a prompt agent returns 400. version_idmust belong to the agent named in the path. Cross-agent version ids return 404.
Example request
curl -X POST "https://api.goyappr.com/agents/AGENT_ID/flow/restore" \
-H "Authorization: Bearer $YAPPR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"version_id": "9c1e9f04-2c5d-4a02-9c1a-1b5e9d1f0001"}'
Example response
{
"id": "AGENT_ID",
"type": "flow",
"name": "Booking flow",
"flow_config": {
"flow_config_version": "1",
"nodes": [
{ "id": "start-1", "type": "start", "transitions": [{ "id": "to-ask-date", "next_step_id": "ask-date-1" }] }
]
},
"restored_from_version_id": "9c1e9f04-2c5d-4a02-9c1a-1b5e9d1f0001",
"updated_at": "2026-05-11T12:34:56.789Z"
}
Errors
| HTTP | Code | When |
|---|---|---|
| 400 | — | version_id missing or not a valid UUID. |
| 400 | — | Agent in the path is not a flow agent (type is prompt). |
| 404 | — | Agent id does not exist (or is not visible to the calling company). |
| 404 | — | version_id does not exist, belongs to a different agent, or has been pruned. |
Authorizations
Your Yappr API key (e.g. ypr_live_...). Generate one in the dashboard under Settings → API Keys.
Path Parameters
Body
application/json
Id from GET /agents/:id/flow/versions[].id.
Response
Restored. Returns the updated agent (same shape as PATCH /agents/:id).