---
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

---

[API](https://skmtc.net/smallest-inc/apis/agent-management-api.md) · [All operations](https://skmtc.net/smallest-inc/apis/agent-management-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/smallest-inc/agent-management-api/versions/6d1036a76fbc/schema)
