Skip to Content
Agents

Clone an agent

Permissionagents:createRetriesIdempotency-Key requiredAuthentication
POST
/agents/{id}/clone

Copies the selected draft, staging, or production version into the mutable draft of a new agent in the same team. Copies the prompt or workflow, models, voice, behavior, and after-call configuration. Shared resources retain their IDs. The new agent starts without deployments, phone assignments, call history, or version history. Its first promotion creates version 1. Requires agents:create and agents:read. Pathway clones require the pathways entitlement.

Authorization

bearerAuth
headerAuthorizationBearer <token>

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

Path Parameters

id*string

Source agent 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.

Match^[a-z0-9_]+$
Length2 <= length <= 48
source*string

Version to copy. The request fails if the selected version is unavailable.

Value in"draft""staging""production"

Response Body

The new agent.

application/json
  1. response
id*string
Formatuuid
slug*string
name*string
mode*"prompt"
Value in"prompt"
draft_version_id*string
Formatuuid
revision*integer

Initial aggregate revision. Supply the response ETag rather than constructing one from this number.

Formatint64
Range1 <= value
updated_at*string
Formatdate-time
Example Request
curl -X POST 'https://api.kejue.co/v1/agents/497f6eca-6276-4993-bfeb-53cbbbba6f08/clone' \  -H 'Idempotency-Key: string' \  -H 'Content-Type: application/json' \  -d '{  "name": "Billing_clone",  "slug": "billing_clone",  "source": "production"}'
Example Response
{  "id": "44444444-4444-4444-8444-444444444444",  "slug": "billing_clone",  "name": "Billing_clone",  "mode": "prompt",  "draft_version_id": "55555555-5555-4555-8555-555555555555",  "revision": 1,  "updated_at": "2026-11-12T09:00:00Z"}