v45

latestOpenAPI 3.0.0raw.githubusercontent.com2026-08-0114775543.6 KB
Agents

Duplicate agent to another organization

Duplicates a SINGLE_PROMPT agent's live active version into a target organization (can also be the same organization). Copies all versioned configuration but strips organization-specific resources: knowledge base tools are removed, default variable values are blanked, and a new avatar is generated. The duplicate starts with a published V1 as its active version.

400 is returned when:

  • The source agent is archived ("Cannot duplicate an archived agent")
  • The agent has no activeVersionId ("This agent has no active version and cannot be duplicated")
  • The active version exists but is not published/active ("This agent has no active published version and cannot be duplicated")
  • The agent is not SINGLE_PROMPT workflow type
post/agent/{id}/duplicate

Path parameters

idstring required

The ID of the source agent to duplicate

Request body

targetOrganizationIdstring required

MongoDB ObjectId of the target organization. Must be a 24-character hex string. The authenticated user must be a member of this organization.

Example request

{
  "targetOrganizationId": "60d0fe4f5311236168a109ca"
}

Response

Agent duplicated successfully

statusboolean

Example response

{
  "status": true,
  "data": {
    "_id": "60d0fe4f5311236168a109cb"
  }
}