Skip to main content
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"
}
'

Documentation Index

Fetch the complete documentation index at: https://docs.goyappr.com/llms.txt

Use this file to discover all available pages before exploring further.

Replaces 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 in flow_versions (deduped by content hash, so re-saving the same graph doesn’t create redundant rows). Calling restore:
  1. Looks up the row identified by version_id
  2. Verifies the row belongs to this agent
  3. Sets agents.flow_config to that row’s stored content
  4. Snapshots a new flow_versions row 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.
The current state stays in history before the restore happens, so you can always restore back to it later.

Workflow

  1. List versions: GET /agents/:id/flow/versions → pick a version_id
  2. Restore: POST /agents/:id/flow/restore with { "version_id": "..." }
  3. Optionally verify: GET /agents/:id and inspect flow_config

Constraints

  • Agent must be a flow agent (type='flow'). Restoring on a prompt agent returns 400.
  • version_id must 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

HTTPCodeWhen
400version_id missing or not a valid UUID.
400Agent in the path is not a flow agent (type is prompt).
404Agent id does not exist (or is not visible to the calling company).
404version_id does not exist, belongs to a different agent, or has been pruned.

Authorizations

Authorization
string
header
required

Your Yappr API key (e.g. ypr_live_...). Generate one in the dashboard under Settings → API Keys.

Path Parameters

id
string<uuid>
required

Body

application/json
version_id
string<uuid>
required

Id from GET /agents/:id/flow/versions[].id.

Response

Restored. Returns the updated agent (same shape as PATCH /agents/:id).