Skip to Content
Flows

Clone a flow

Permissionflows:createAdd-onFlowsRetriesIdempotency-Key requiredAuthentication
POST
/flows/{id}/clone

Copies the current saved flow into a new flow in the same team at resource revision 1. Copies the graph, start agent, description, and after-call configuration. Member agents and shared after-call resources retain their IDs. The clone starts without phone assignments or call history. Requires flows:create and flows:read.

Authorization

bearerAuth
headerAuthorizationBearer <token>

Use a Voice API key or connected-app OAuth access token. Authentication.

Path Parameters

id*string

Source flow UUID.

Formatuuid

Header Parameters

Idempotency-Key*string

Required. Reuse the same key to retry this write safely. Retries and idempotency.

Match^[A-Za-z0-9!#$%&'*+.^_`|~-]+$
Length1 <= length <= 255
If-Match?string

Optional strong ETag (or *) from a prior response. A stale tag returns 412 without changing the resource.

Request Body

application/json
  1. body
name*string

Display name for the copy.

Length1 <= length <= 200
slug?string

Unique routing identifier for the copy. Derived from the name when omitted.

Match^[a-z0-9]+(?:-[a-z0-9]+)*$
Length2 <= length <= 64

Response Body

The new flow.

application/json
  1. response

A named graph of existing agents joined by agent-to-agent handoffs. The same representation is returned for a single flow and for each element of a list page. A flow owns the graph, the start agent and an after-call override; prompt, model and voice configuration stays on each member agent's own version. Flows are not versioned — resource_version feeds the strong ETag that PATCH's If-Match is checked against.

id*string
Formatuuid
org_id*string
Formatuuid
slug*string
Match^[a-z0-9]+(?:-[a-z0-9]+)*$
Length2 <= length <= 64
name*string
Length1 <= length <= 200
description?string

Absent when no description is set.

Lengthlength <= 2000
start_agent_id?string

The agent that ANSWERS a call routed at this flow; the graph's edges take over from there. Must be one of the agents on the canvas. Absent when the flow has no start agent yet, in which case the flow cannot be targeted by a number, a job or a call.

Formatuuid
graph*

The flow canvas — the agents on it and the handoffs between them.

agent_count*integer

Derived count of graph.nodes, so a list page can show each flow's shape.

Range0 <= value
handoff_count*integer

Derived count of graph.edges.

Range0 <= value
summary_enabled*boolean

After-call override. These four fields REPLACE every member agent's own after-call configuration for calls that run inside the flow.

summary_prompt?string

Absent when no override prompt is set.

Lengthlength <= 50000
extraction_object_ids*array<>
Itemsitems <= 100
webhook_config_ids*array<>
Itemsitems <= 100
resource_version*integer

Monotonic row version maintained by the database, never by the handler. It is the value behind the strong ETag.

Formatint64
Range0 <= value
archived_at?string

Absent unless the flow has been archived.

Formatdate-time
created_at*string
Formatdate-time
updated_at*string
Formatdate-time
Example Request
curl -X POST 'https://api.kejue.co/v1/flows/497f6eca-6276-4993-bfeb-53cbbbba6f08/clone' \  -H 'Idempotency-Key: string' \  -H 'Content-Type: application/json' \  -d '{  "name": "Billing_clone",  "slug": "billing-clone"}'
Example Response
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",  "slug": "string",  "name": "string",  "description": "string",  "start_agent_id": "867cfc4d-88ad-4208-a6ae-feca15061904",  "graph": {    "nodes": [      {        "id": "string",        "agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",        "x": 0,        "y": 0,        "agent_slug": "string",        "agent_name": "string"      }    ],    "edges": [      {        "id": "string",        "source": "string",        "target": "string",        "label": "string",        "condition": "string"      }    ]  },  "agent_count": 0,  "handoff_count": 0,  "summary_enabled": true,  "summary_prompt": "string",  "extraction_object_ids": [    "cd42e880-fa3c-4a25-8b4c-6cf3646646b0"  ],  "webhook_config_ids": [    "b40731a3-5fdb-4318-998b-c6770a21278f"  ],  "resource_version": 0,  "archived_at": "2019-08-24T14:15:22Z",  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z"}