Skip to content
Skip to Content
Coder Docs

Update template settings by ID

PATCH
/api/v2/templates/{template}

Authorization

CoderSessionToken
headerCoder-Session-Token<token>

Path Parameters

template*string

Template ID

Formatuuid

Request Body

Patch template settings request

application/json
  1. body
activity_bump_ms?integer

ActivityBumpMillis allows optionally specifying the activity bump duration for all workspaces created from this template. Defaults to 1h but can be set to 0 to disable activity bumping.

agents_allowed?boolean

AgentsAllowed controls whether Coder Agents can create workspaces using this template. If omitted, the current value is preserved.

allow_user_autostart?boolean
allow_user_autostop?boolean
allow_user_cancel_workspace_jobs?boolean
allow_workspace_renames?boolean

AllowWorkspaceRenames permits users to rename workspaces built from this template. Renaming can be destructive for templates whose Terraform references the workspace name.

autostart_requirement?
autostop_requirement?

AutostopRequirement and AutostartRequirement can only be set if your license includes the advanced template scheduling feature. If you attempt to set this value while unlicensed, it will be ignored.

cors_behavior?codersdk.CORSBehavior
Value in"simple""passthru"
default_ttl_ms?integer
deprecation_message?string

DeprecationMessage if set, will mark the template as deprecated and block any new workspaces from using this template. If passed an empty string, will remove the deprecated message, making the template usable for new workspaces again.

description?string
disable_everyone_group_access?boolean

DisableEveryoneGroupAccess allows optionally disabling the default behavior of granting the 'everyone' group access to use the template. If this is set to true, the template will not be available to all users, and must be explicitly granted to users or groups in the permissions settings of the template.

disable_module_cache?boolean

DisableModuleCache disables the using of cached Terraform modules during provisioning. It is ignored while the deployment disables the module cache for all templates. It is recommended not to disable this.

display_name?string
failure_ttl_ms?integer
icon?string
max_port_share_level?codersdk.WorkspaceAgentPortShareLevel
Value in"owner""authenticated""organization""public"
name?string
require_active_version?boolean

RequireActiveVersion mandates workspaces built using this template use the active version of the template. This option has no effect on template admins.

time_til_autostop_notify_ms?integer

TimeTilAutostopNotifyMillis allows optionally specifying the duration before the autostop deadline at which a reminder notification is sent for workspaces created from this template. Defaults to 0 (disabled). Omitting the field keeps the existing value.

time_til_dormant_autodelete_ms?integer
time_til_dormant_ms?integer
update_workspace_dormant_at?boolean

UpdateWorkspaceDormantAt updates the dormant_at field of workspaces spawned from the template. This is useful for preventing dormant workspaces being immediately deleted when updating the dormant_ttl field to a new, shorter value.

update_workspace_last_used_at?boolean

UpdateWorkspaceLastUsedAt updates the last_used_at field of workspaces spawned from the template. This is useful for preventing workspaces being immediately locked when updating the inactivity_ttl field to a new, shorter value.

use_classic_parameter_flow?boolean

UseClassicParameterFlow is a flag that switches the default behavior to use the classic parameter flow when creating a workspace. This only affects deployments with the experiment "dynamic-parameters" enabled. This setting will live for a period after the experiment is made the default. An "opt-out" is present in case the new feature breaks some existing templates.

Response Body

OK

application/json
  1. response
active_user_count?integer

ActiveUserCount is set to -1 when loading.

active_version_id?string
Formatuuid
activity_bump_ms?integer
agents_allowed?boolean
allow_user_autostart?boolean

AllowUserAutostart and AllowUserAutostop are Premium features. Their values are only used if your license is entitled to use the advanced template scheduling feature.

allow_user_autostop?boolean
allow_user_cancel_workspace_jobs?boolean
allow_workspace_renames?boolean

AllowWorkspaceRenames permits users to rename workspaces built from this template. Renaming can be destructive for templates whose Terraform references the workspace name.

autostart_requirement?
autostop_requirement?

AutostopRequirement and AutostartRequirement are Premium features. Their values are only used if your license is entitled to use the advanced template scheduling feature.

build_time_stats?
cors_behavior?codersdk.CORSBehavior
Value in"simple""passthru"
created_at?string
Formatdate-time
created_by_id?string
Formatuuid
created_by_name?string
default_ttl_ms?integer
deleted?boolean
deprecated?boolean
deprecation_message?string
description?string
disable_module_cache?boolean

DisableModuleCache disables the use of cached Terraform modules during provisioning for this template. It is read-only while ModuleCacheDisabledByDeployment is true.

display_name?string
failure_ttl_ms?integer

FailureTTLMillis, TimeTilDormantMillis, and TimeTilDormantAutoDeleteMillis are Premium features. Their values are used if your license is entitled to use the advanced template scheduling feature.

icon?string
id?string
Formatuuid
max_port_share_level?codersdk.WorkspaceAgentPortShareLevel
Value in"owner""authenticated""organization""public"
module_cache_disabled_by_deployment?boolean

ModuleCacheDisabledByDeployment reports that the deployment disables the Terraform module cache for every template. Templates cannot opt back in, so the effective state is disabled regardless of DisableModuleCache.

name?string
organization_display_name?string
organization_icon?string
organization_id?string
Formatuuid
organization_name?string
Formaturl
provisioner?"terraform"
Value in"terraform"
require_active_version?boolean

RequireActiveVersion mandates that workspaces are built with the active template version.

time_til_autostop_notify_ms?integer

TimeTilAutostopNotifyMillis is the duration before the workspace's autostop deadline at which a reminder notification is sent. 0 disables the notification.

time_til_dormant_autodelete_ms?integer
time_til_dormant_ms?integer
updated_at?string
Formatdate-time
use_classic_parameter_flow?boolean

The samples read CODER_URL and CODER_SESSION_TOKEN: set up your environment.

curl -X PATCH \	"$CODER_URL/api/v2/templates/{template}" \	-H "Coder-Session-Token: $CODER_SESSION_TOKEN" \	-H "Content-Type: application/json" \	-d '{  "activity_bump_ms": 0,  "agents_allowed": true,  "allow_user_autostart": true}'
Example Response200
{  "active_user_count": 0,  "active_version_id": "eae64611-bd53-4a80-bb77-df1e432c0fbc",  "activity_bump_ms": 0,  "agents_allowed": true,  "allow_user_autostart": true,  "allow_user_autostop": true,  "allow_user_cancel_workspace_jobs": true,  "allow_workspace_renames": true,  "autostart_requirement": {    "days_of_week": [      "monday"    ]  },  "autostop_requirement": {    "days_of_week": [      "monday"    ],    "weeks": 0  },  "build_time_stats": {    "property1": {      "p50": 123,      "p95": 146    },    "property2": {      "p50": 123,      "p95": 146    }  },  "cors_behavior": "simple",  "created_at": "2019-08-24T14:15:22Z",  "created_by_id": "9377d689-01fb-4abf-8450-3368d2c1924f",  "created_by_name": "string",  "default_ttl_ms": 0,  "deleted": true,  "deprecated": true,  "deprecation_message": "string",  "description": "string",  "disable_module_cache": true,  "display_name": "string",  "failure_ttl_ms": 0,  "icon": "string",  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "max_port_share_level": "owner",  "module_cache_disabled_by_deployment": true,  "name": "string",  "organization_display_name": "string",  "organization_icon": "string",  "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",  "organization_name": "string",  "provisioner": "terraform",  "require_active_version": true,  "time_til_autostop_notify_ms": 0,  "time_til_dormant_autodelete_ms": 0,  "time_til_dormant_ms": 0,  "updated_at": "2019-08-24T14:15:22Z",  "use_classic_parameter_flow": true}