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

> 既存の Forward テンプレートをクローンします。

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

ソーステンプレートのエージェント設定とセッションのデフォルト値をコピーして、新しいテンプレートを作成します。

## Headers

| Header            | Required | Description             |
| ----------------- | -------- | ----------------------- |
| `Authorization`   | Yes      | `Bearer <PAT>`          |
| `Content-Type`    | Yes      | `application/json`      |
| `Idempotency-Key` | No       | 安全でないリクエストに対する任意の冪等性キー。 |

## Path parameters

| Parameter     | Type   | Required | Description                   |
| ------------- | ------ | -------- | ----------------------------- |
| `template_id` | string | Yes      | ソースとなる Forward の Template ID。 |

## Body parameters

| Parameter     | Type   | Required | Description                                      |
| ------------- | ------ | -------- | ------------------------------------------------ |
| `name`        | string | No       | 新しいテンプレート名。省略した場合は、ソース名に ` Copy` を付加したものが使用されます。 |
| `description` | string | No       | 新しいテンプレートの説明。省略した場合は、ソースの説明が使用されます。              |

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

新しく作成された Template オブジェクトを返します。

## Errors

| HTTP | Type                    | Trigger            |
| ---- | ----------------------- | ------------------ |
| 400  | `invalid_request_error` | クローンリクエストが不正。      |
| 401  | `authentication_error`  | PAT が無効または期限切れ。    |
| 404  | `not_found_error`       | ソーステンプレートが存在しない。   |
| 409  | `conflict_error`        | 新しいテンプレート名が既に存在する。 |

## Notes

* クローンは新しい Template ID を生成します。
* クローンでは Identity Config のレコードはコピーされません。

## Related

<CardGroup cols={2}>
  <Card title="テンプレートの作成" icon="plus" href="/cloud-agents/api/forward/templates/create" />

  <Card title="テンプレートの更新" icon="pencil" href="/cloud-agents/api/forward/templates/update" />
</CardGroup>
