> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qoder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Clone a template

> Clone an existing Forward template.

`POST /api/v1/forward/templates/{template_id}/clone`

Creates a new template by copying the source template's agent configuration and session defaults.

## Headers

| Header            | Required | Description                                   |
| ----------------- | -------- | --------------------------------------------- |
| `Authorization`   | Yes      | `Bearer <PAT>`                                |
| `Content-Type`    | Yes      | `application/json`                            |
| `Idempotency-Key` | No       | Optional idempotency key for unsafe requests. |

## Path parameters

| Parameter     | Type   | Required | Description                 |
| ------------- | ------ | -------- | --------------------------- |
| `template_id` | string | Yes      | Source Forward Template ID. |

## Body parameters

| Parameter     | Type   | Required | Description                                                           |
| ------------- | ------ | -------- | --------------------------------------------------------------------- |
| `name`        | string | No       | New template name. If omitted, the source name plus ` Copy` is used.  |
| `description` | string | No       | New template description. If omitted, the source description is used. |

## Example request

```bash theme={null}
curl -s -X POST 'https://api.qoder.com/api/v1/forward/templates/tmpl_support/clone' \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Support assistant copy",
    "description": "Cloned from Support assistant"
  }'
```

## Example response

**HTTP 201 Created**

```json theme={null}
{
  "type": "template",
  "id": "tmpl_019eYYYY",
  "name": "Support assistant copy",
  "description": "Cloned from Support assistant",
  "status": "active",
  "model": "ultimate",
  "system": "You are a helpful support assistant.",
  "tools": [],
  "mcp_servers": [],
  "skills": [],
  "multiagent": null,
  "environment_id": "env_support",
  "vault_ids": ["vault_crm"],
  "files": {},
  "environment_variables": {
    "BASE_MODE": "support"
  },
  "metadata": {},
  "created_at": "2026-06-18T10:31:00Z",
  "updated_at": "2026-06-18T10:31:00Z"
}
```

## Response fields

Returns the newly created Template object.

## Errors

| HTTP | Type                    | Trigger                           |
| ---- | ----------------------- | --------------------------------- |
| 400  | `invalid_request_error` | Invalid clone request.            |
| 401  | `authentication_error`  | PAT invalid or expired.           |
| 404  | `not_found_error`       | Source template does not exist.   |
| 409  | `conflict_error`        | New template name already exists. |

## Notes

* Clone generates a new Template ID.
* Cloning does not copy Identity Config records.

## Related

<CardGroup cols={2}>
  <Card title="Create a template" icon="plus" href="/cloud-agents/api/forward/templates/create" />

  <Card title="Update a template" icon="pencil" href="/cloud-agents/api/forward/templates/update" />
</CardGroup>
