---
title: "Duplicate agent to another organization"
method: POST
path: "/agent/{id}/duplicate"
tags: ["Agents"]
---

# Duplicate agent to another organization

`POST /agent/{id}/duplicate`

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

## Path parameters

- `id` string, required

## Request body

- object
  - `targetOrganizationId` string, required — MongoDB ObjectId of the target organization. Must be a 24-character hex string. The authenticated user must be a member of this organization.

## Response `201`

Agent duplicated successfully

- object
  - `status` boolean
  - `data` object
    - `_id` string — The ID of the newly created agent

## Other responses

- `400` — Invalid input
- `401` — Unauthorized access
- `403` — Forbidden — authenticated user is not a member of the target organization
- `404` — Not found. Possible messages: - `"Agent not found"` — source agent doesn't exist or doesn't belong to the caller's org - `"Target organization not found"` — the `targetOrganizationId` doesn't exist
- `500` — Internal server error

## Changes

- **2026-05-26** `7131fe74f3cb` — 1 breaking, 1 warning, 3 info
  - added the pattern `^[a-fA-F0-9]{24}$` to the request property `targetOrganizationId`
  - removed the optional property `data` from the response with the `403` status
  - added the media type `application/json` for the response with the status `404`
  - added the non-success response with the status `401`
  - …1 more
- **2026-04-20** `801f1d220d57` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/smallest-inc/apis/agent-management-api/changes/agent/:id/duplicate/post.md)

---

[API](https://skmtc.dev/smallest-inc/apis/agent-management-api.md) · [All operations](https://skmtc.dev/smallest-inc/apis/agent-management-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/smallest-inc/agent-management-api/revisions/ea4ea58d7c4e/schema)
