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

# Clone Job To Template V1

> Promote a job's configuration into a reusable template. Captures params minus the per-call fields (instruction, idempotency key, etc.) into the new template's…

Promote a job's configuration into a reusable template.

Captures `params` minus the per-call fields (instruction, idempotency
key, etc.) into the new template's `defaults`. Useful workflow:
iterate on a one-off `/trigger` call until it works, then
`clone-to-template` to make it the team's reusable starting point.

Reserved per-call params NOT carried into defaults:
`instruction` (unless `include_instruction=true`), `tags`,
`webhook_url`, `webhook_secret`, `output_schema`. Everything else
(model, effort, max\_cost\_usd, custom params) is preserved.

### Path parameters

<ParamField path="job_id" type="string (uuid)" required />

### Request body

`CloneJobToTemplateRequest`

<ParamField body="name" type="string" required>
  Template name. Same rules as `POST /templates`: alphanumeric + underscore + dash, must not collide with a built-in or an existing tenant template.
</ParamField>

<ParamField body="description" type="string" required>
  Human-readable purpose; surfaces in `GET /templates`.
</ParamField>

<ParamField body="include_instruction" type="boolean">
  When true, the source job's `instruction` is captured as a template default. Most callers want false (the instruction is per-call, the template captures the surrounding config).
</ParamField>

### Response

`TemplateInfo`

<ResponseField name="name" type="string" required>
  The exact string to pass as `agent_type` on /trigger.
</ResponseField>

<ResponseField name="kind" type="string" required>
  `builtin` ships with the platform; `tenant` is owned by your org.
</ResponseField>

<ResponseField name="description" type="string,null">
  Human-readable description (tenant templates only).
</ResponseField>

### Status codes

| Code  | Meaning             |
| ----- | ------------------- |
| `201` | Successful Response |
| `422` | Validation Error    |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api.computer.stateset.app/api/v1/jobs/{job_id}/clone-to-template' \
    --header 'X-API-Key: YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
    "name": "Two-Person Tent",
    "description": "Two-person tent, green — replacement for damaged pole set.",
    "include_instruction": false
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "name": "Two-Person Tent",
    "kind": "builtin",
    "description": "Two-person tent, green — replacement for damaged pole set."
  }
  ```
</ResponseExample>
