---
title: "Create template by organization"
method: POST
path: "/api/v2/organizations/{organization}/templates"
tags: ["Templates"]
---

# Create template by organization

`POST /api/v2/organizations/{organization}/templates`

## Path parameters

- `organization` string, required

## Request body

- CodersdkCreateTemplateRequest
  - `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. Defaults to true.
  - `allow_user_autostart` boolean — AllowUserAutostart allows users to set a schedule for autostarting their workspace. By default this is true. This can only be disabled when using an enterprise license.
  - `allow_user_autostop` boolean — AllowUserAutostop allows users to set a custom workspace TTL to use in place of the template's DefaultTTL field. By default this is true. If false, the DefaultTTL will always be used. This can only be disabled when using an enterprise license.
  - `allow_user_cancel_workspace_jobs` boolean — Allow users to cancel in-progress workspace jobs. *bool as the default value is "true".
  - `autostart_requirement` CodersdkTemplateAutostartRequirement
    - `days_of_week` string[] — DaysOfWeek is a list of days of the week in which autostart is allowed to happen. If no days are specified, autostart is not allowed.
  - `autostop_requirement` CodersdkTemplateAutostopRequirement
    - `days_of_week` string[] — DaysOfWeek is a list of days of the week on which restarts are required. Restarts happen within the user's quiet hours (in their configured timezone). If no days are specified, restarts are not required. Weekdays cannot be specified twice. Restarts will only happen on weekdays in this list on weeks which line up with Weeks.
    - `weeks` integer — Weeks is the number of weeks between required restarts. Weeks are synced across all workspaces (and Coder deployments) using modulo math on a hardcoded epoch week of January 2nd, 2023 (the first Monday of 2023). Values of 0 or 1 indicate weekly restarts. Values of 2 indicate fortnightly restarts, etc.
  - `cors_behavior` 'simple' | 'passthru'
  - `default_ttl_ms` integer — DefaultTTLMillis allows optionally specifying the default TTL for all workspaces created from this template.
  - `delete_ttl_ms` integer — TimeTilDormantAutoDeleteMillis allows optionally specifying the max lifetime before Coder permanently deletes dormant workspaces created from this template.
  - `description` string — Description is a description of what the template contains. It must be less than 128 bytes.
  - `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.
  - `display_name` string — DisplayName is the displayed name of the template.
  - `dormant_ttl_ms` integer — TimeTilDormantMillis allows optionally specifying the max lifetime before Coder locks inactive workspaces created from this template.
  - `failure_ttl_ms` integer — FailureTTLMillis allows optionally specifying the max lifetime before Coder stops all resources for failed workspaces created from this template.
  - `icon` string — Icon is a relative path or external URL that specifies an icon to be displayed in the dashboard.
  - `max_port_share_level` 'owner' | 'authenticated' | 'organization' | 'public'
  - `name` string, required — Name is the name of the template.
  - `require_active_version` boolean — RequireActiveVersion mandates that workspaces are built with the active template version.
  - `template_use_classic_parameter_flow` boolean — UseClassicParameterFlow allows optionally specifying whether the template should use the classic parameter flow. The default if unset is true, and is why `*bool` is used here. When dynamic parameters becomes the default, this will default to false.
  - `template_version_id` string, uuid, required — VersionID is an in-progress or completed job to use as an initial version of the template. This is required on creation to enable a user-flow of validating a template works. There is no reason the data-model cannot support empty templates, but it doesn't make sense for users.
  - `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).

## Response `200`

OK

- CodersdkTemplate
  - `active_user_count` integer — ActiveUserCount is set to -1 when loading.
  - `active_version_id` string, uuid
  - `activity_bump_ms` integer
  - `agents_allowed` boolean
  - `allow_user_autostart` boolean — AllowUserAutostart and AllowUserAutostop are enterprise-only. 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
  - `autostart_requirement` CodersdkTemplateAutostartRequirement
    - `days_of_week` string[] — DaysOfWeek is a list of days of the week in which autostart is allowed to happen. If no days are specified, autostart is not allowed.
  - `autostop_requirement` CodersdkTemplateAutostopRequirement
    - `days_of_week` string[] — DaysOfWeek is a list of days of the week on which restarts are required. Restarts happen within the user's quiet hours (in their configured timezone). If no days are specified, restarts are not required. Weekdays cannot be specified twice. Restarts will only happen on weekdays in this list on weeks which line up with Weeks.
    - `weeks` integer — Weeks is the number of weeks between required restarts. Weeks are synced across all workspaces (and Coder deployments) using modulo math on a hardcoded epoch week of January 2nd, 2023 (the first Monday of 2023). Values of 0 or 1 indicate weekly restarts. Values of 2 indicate fortnightly restarts, etc.
  - `build_time_stats` CodersdkTemplateBuildTimeStats
  - `cors_behavior` 'simple' | 'passthru'
  - `created_at` string, date-time
  - `created_by_id` string, uuid
  - `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.
  - `display_name` string
  - `failure_ttl_ms` integer — FailureTTLMillis, TimeTilDormantMillis, and TimeTilDormantAutoDeleteMillis are enterprise-only. Their values are used if your license is entitled to use the advanced template scheduling feature.
  - `icon` string
  - `id` string, uuid
  - `max_port_share_level` 'owner' | 'authenticated' | 'organization' | 'public'
  - `name` string
  - `organization_display_name` string
  - `organization_icon` string
  - `organization_id` string, uuid
  - `organization_name` string, url
  - `provisioner` '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, date-time
  - `use_classic_parameter_flow` boolean

---

[API](https://skmtc.net/coder/apis/coder-api.md) · [All operations](https://skmtc.net/coder/apis/coder-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/coder/coder-api/versions/56b6e9f08540/schema)
