Duplicate agent to another organization

View as Markdown
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

Authentication

AuthorizationBearer

API key from the console ApiKey collection, sent as Bearer token. Also accepts session cookies for browser-based auth.

Path parameters

idstringRequired
The ID of the source agent to duplicate

Request

This endpoint expects an object.
targetOrganizationIdstringRequiredformat: "^[a-fA-F0-9]{24}$"

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

Response

Agent duplicated successfully
statusboolean
dataobject

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
500
Internal Server Error