# Template

Templates are a pre-set configuration used to quickly configure and submit workloads using existing assets.

## List templates.

> Retrieve a list of templates.

```json
{"openapi":"3.0.3","info":{"title":"Runai API","version":"2.19"},"tags":[{"name":"Template","description":"Templates are a pre-set configuration used to quickly configure and submit workloads using existing assets."}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"parameters":{"AssetNameFilter":{"name":"name","in":"query","required":false,"description":"Filter results by name.","schema":{"type":"string"}},"AssetScopeFilter":{"name":"scope","in":"query","required":false,"description":"Filter results by scope.","schema":{"type":"string"}},"AssetProjectFilter":{"name":"projectId","in":"query","required":false,"description":"Filter results by project id. if scope filter is project, only assets from the specific project will be included in the response. otherwise, the response will include both project, department, cluster and tenant assets.","schema":{"type":"integer","format":"int32"}},"FilterByDepartment":{"name":"departmentId","in":"query","description":"Filter using the department id.","required":false,"schema":{"type":"string"}},"FilterByCluster":{"name":"clusterId","in":"query","description":"Filter using the Universally Unique Identifier (UUID) of the cluster.","required":false,"schema":{"type":"string","format":"uuid"}},"DistributedFrameworkQuery":{"name":"distributedFramework","in":"query","required":false,"description":"Filter results to workload of type distributed and distributedFramework.","schema":{"type":"string"},"allowReserved":true},"IsDistributedQuery":{"name":"isDistributed","in":"query","required":false,"description":"Filter results to workload of type distributed.","schema":{"type":"boolean"},"allowReserved":true},"IsTrainingQuery":{"name":"isTraining","in":"query","required":false,"description":"Filter results to workload of type training.","schema":{"type":"boolean"},"allowReserved":true},"IsWorkspaceQuery":{"name":"isWorkspace","in":"query","required":false,"description":"Filter results to workload of type workspace.","schema":{"type":"boolean"},"allowReserved":true}},"schemas":{"WorkloadTemplateListResponse":{"type":"object","required":["entries"],"properties":{"entries":{"type":"array","items":{"$ref":"#/components/schemas/WorkloadTemplate"}}}},"WorkloadTemplate":{"required":["meta","spec"],"properties":{"meta":{"$ref":"#/components/schemas/AssetMeta"},"spec":{"$ref":"#/components/schemas/SpecificRunInfoFields"}}},"AssetMeta":{"allOf":[{"$ref":"#/components/schemas/AssetUpdatableFields"},{"$ref":"#/components/schemas/AssetCreationFields"},{"$ref":"#/components/schemas/AssetReadOnlyFields"}]},"AssetUpdatableFields":{"required":["name"],"properties":{"name":{"$ref":"#/components/schemas/AssetName"},"description":{"$ref":"#/components/schemas/AssetDescription"}}},"AssetName":{"description":"The name of the asset.","type":"string","minLength":1},"AssetDescription":{"description":"The description of the asset.","type":"string","minLength":1,"maxLength":250,"nullable":true},"AssetCreationFields":{"type":"object","required":["scope"],"properties":{"scope":{"$ref":"#/components/schemas/Scope"},"clusterId":{"$ref":"#/components/schemas/ClusterIdOptional"},"departmentId":{"description":"The id of the department. Must be specified for department scoped assets.","type":"string","nullable":true,"minLength":1},"projectId":{"description":"The id of the project. Must be specified for project scoped assets.","type":"integer","format":"int32","nullable":true},"autoDelete":{"description":"The asset will be deleted automatically. This is intended for internal use.","type":"boolean","nullable":true,"default":false},"workloadSupportedTypes":{"$ref":"#/components/schemas/WorkloadSupportedTypes"}}},"Scope":{"description":"The scope in which an asset can be used. The highest scope, system, is intended for internal purposes only.","type":"string","minLength":1,"enum":["system","tenant","cluster","department","project"]},"ClusterIdOptional":{"description":"The id of the cluster.","type":"string","format":"uuid","minLength":1,"nullable":true},"WorkloadSupportedTypes":{"properties":{"inference":{"description":"Is inference a supported workload type.","type":"boolean","nullable":true},"workspace":{"description":"Is workspace a supported workload type.","type":"boolean","nullable":true},"training":{"description":"Is training a supported workload type.","type":"boolean","nullable":true},"distributed":{"description":"Is distributed a supported workload type.","type":"boolean","nullable":true},"distFramework":{"description":"The distributed training framework used in the workload.","type":"string","enum":["MPI","PyTorch","TF","XGBoost"],"nullable":true}},"nullable":true,"type":"object"},"AssetReadOnlyFields":{"required":["id","kind","createdBy","createdAt","updatedBy","updatedAt"],"properties":{"id":{"$ref":"#/components/schemas/AssetId"},"kind":{"$ref":"#/components/schemas/AssetKind"},"tenantId":{"description":"The id of the tenant.","type":"integer","format":"int32","nullable":true},"createdBy":{"description":"The user who created the asset.","type":"string","minLength":1},"createdAt":{"description":"The time at which the asset were created","type":"string","minLength":1,"format":"date-time"},"updatedBy":{"description":"The user who updated the asset.","type":"string","minLength":1},"updatedAt":{"description":"The time at which the asset has been updated","type":"string","minLength":1,"format":"date-time"},"projectName":{"description":"The name of the project that the asset is associated with, for project scoped assets.","type":"string","minLength":1,"nullable":true}},"type":"object"},"AssetId":{"description":"Unique identifier of the asset.","type":"string","format":"uuid","minLength":1},"AssetKind":{"description":"The kind of the asset.","type":"string","minLength":1,"enum":["compute","environment","accessKey","dockerRegistry","password","genericSecret","registry","s3","git","nfs","pvc","hostPath","workload-template","model","config-map","secret-volume"]},"SpecificRunInfoFields":{"description":"Information about the set of assets which comprises a workspace, training or template, and an optional set of specific run parameters.","required":["assets"],"properties":{"assets":{"$ref":"#/components/schemas/AssetsRef"},"specificEnv":{"$ref":"#/components/schemas/SpecificRunParams"},"distributed":{"$ref":"#/components/schemas/InfoDistributed"}}},"AssetsRef":{"description":"Reference information about a set of assets. used to describe - assets comprising a workspace - assets comprising a workspace template - assets that use other assets (e.g. s3 asset which uses access key).","required":["environment"],"properties":{"environment":{"description":"environment asset.","allOf":[{"$ref":"#/components/schemas/EnvironmentAssetRef"}]},"compute":{"$ref":"#/components/schemas/AssetsRefCompute"},"datasources":{"type":"array","items":{"$ref":"#/components/schemas/DatasourceRef"}},"workloadVolumes":{"type":"array","items":{"type":"string"}}}},"EnvironmentAssetRef":{"description":"Reference information about environment asset.","required":["id","name"],"properties":{"id":{"$ref":"#/components/schemas/AssetId"},"name":{"$ref":"#/components/schemas/AssetName"},"toolTypes":{"description":"the type of tools as defined in the connections of the environment asset.","type":"array","nullable":true,"items":{"$ref":"#/components/schemas/ToolType"}}}},"ToolType":{"description":"Super set of Internal and External tool types.","type":"string","minLength":1,"enum":["jupyter-notebook","pycharm","visual-studio-code","tensorboard","rstudio","mlflow","custom","wandb","matlab","comet","chatbot-ui"]},"AssetsRefCompute":{"allOf":[{"$ref":"#/components/schemas/AssetRef"}],"nullable":true,"type":"object"},"AssetRef":{"description":"Reference information about an asset.","required":["id","name"],"properties":{"id":{"$ref":"#/components/schemas/AssetId"},"name":{"$ref":"#/components/schemas/AssetName"}}},"DatasourceRef":{"description":"Reference information about a datasource asset.","required":["id","name","kind"],"properties":{"id":{"$ref":"#/components/schemas/AssetId"},"name":{"$ref":"#/components/schemas/AssetName"},"kind":{"$ref":"#/components/schemas/AssetKind"},"overrides":{"$ref":"#/components/schemas/DataSourceOverrides"}}},"DataSourceOverrides":{"description":"specific fields to override in the data source.","type":"object","nullable":true,"properties":{"containerPath":{"type":"string","minLength":1,"nullable":true}}},"SpecificRunParams":{"description":"Parameters which apply to a specific workload. They complement the information gathered from the assets comprising the workload.\n","allOf":[{"$ref":"#/components/schemas/SpecificRunParamsCommon"},{"$ref":"#/components/schemas/AllowOverQuota"},{"$ref":"#/components/schemas/SpecificRunAutoScaling"}],"nullable":true,"type":"object"},"SpecificRunParamsCommon":{"allOf":[{"$ref":"#/components/schemas/ContainerOverridable"},{"$ref":"#/components/schemas/CommonSecurityOverridable"},{"$ref":"#/components/schemas/EnvironmentVariablesField"},{"$ref":"#/components/schemas/ResourcesFlatFields"},{"$ref":"#/components/schemas/AdvancedFlatFields"},{"$ref":"#/components/schemas/AdvancedItemizedFields"},{"$ref":"#/components/schemas/SpecificRunConnections"}],"nullable":true,"type":"object"},"ContainerOverridable":{"description":"Container overrideable fields. In the context of assets,these are environment asset fields that can be overriden in the submit workload request.","properties":{"command":{"description":"A command to the server as the entry point of the container running the workspace.","type":"string","minLength":1,"nullable":true},"args":{"description":"Arguments to the command that the container running the workspace executes.","type":"string","minLength":1,"nullable":true}},"nullable":true,"type":"object"},"CommonSecurityOverridable":{"description":"Security overrideable fields. In the context of assets,these are environment asset fields that can be overriden in the submit workload request.","properties":{"runAsUid":{"description":"The user id to run the entrypoint of the container which executes the workspace. Default to the value specified in the environment asset `runAsUid` field (optional). Use only when the source uid/gid of the environment asset is not `fromTheImage`, and `overrideUidGidInWorkspace` is enabled.","type":"integer","format":"int64","nullable":true},"runAsGid":{"description":"The group id to run the entrypoint of the container which executes the workspace. Default to the value specified in the environment asset `runAsGid` field (optional). Use only when the source uid/gid of the environment asset is not `fromTheImage`, and `overrideUidGidInWorkspace` is enabled.","type":"integer","format":"int64","nullable":true},"supplementalGroups":{"description":"Comma separated list of groups that the user running the container belongs to, in addition to the group indicated by runAsGid. Use only when the source uid/gid of the environment asset is not `fromTheImage`, and `overrideUidGidInWorkspace` is enabled. Using an empty string implies reverting the supplementary groups of the image.","type":"string","nullable":true}},"nullable":true,"type":"object"},"EnvironmentVariablesField":{"properties":{"environmentVariables":{"$ref":"#/components/schemas/EnvironmentVariables2"}},"nullable":true,"type":"object"},"EnvironmentVariables2":{"description":"Set of environment variables to populate into the container running the workspace.","type":"array","items":{"$ref":"#/components/schemas/EnvironmentVariable2"},"nullable":true},"EnvironmentVariable2":{"description":"Details of an environment variable which is populated into the container.","properties":{"name":{"description":"The name of the environment variable. (mandatory)","type":"string","minLength":1,"nullable":true},"value":{"description":"The value of the environment variable. (mutually exclusive with secret)","type":"string","nullable":true},"secret":{"$ref":"#/components/schemas/EnvironmentVariableSecret"},"exclude":{"description":"Use 'true' in case the environment variable is defined in defaults of the policy, and you wish to exclude it from the workload.","type":"boolean","nullable":true}},"nullable":true,"type":"object"},"EnvironmentVariableSecret":{"description":"Details of the secret and key use to populated the environment variable. (mutually exclusive with value)","properties":{"name":{"description":"The name of the secret resource. (mandatory)","type":"string","minLength":1,"nullable":true},"key":{"description":"The key in the secret resource. (mandatory)","type":"string","minLength":1,"nullable":true}},"nullable":true,"type":"object"},"ResourcesFlatFields":{"description":"Resource parameters.","properties":{"nodeType":{"description":"Nodes (machines), or a group of nodes on which the workload will run. To use this feature, your Administrator will need to label nodes. For more information, see [Group Nodes](https://docs.run.ai/v2.19/admin/researcher-setup/limit-to-node-group). When using this flag with with Project-based affinity, it refines the list of allowable node groups set in the Project. For more information, see [Projects](https://docs.run.ai/admin/admin-ui-setup/project-setup).","type":"string","minLength":1,"nullable":true},"nodePools":{"description":"A prioritized list of node pools for the scheduler to run the workspace on. The scheduler will always try to use the first node pool before moving to the next one if the first is not available.","type":"array","items":{"type":"string"},"nullable":true},"podAffinity":{"$ref":"#/components/schemas/PodAffinity"}},"nullable":true,"type":"object"},"PodAffinity":{"description":"Pod affinity scheduling rules (e.g. co-locate this workload in the same node, zone, etc. as some other workloads).","type":"object","properties":{"type":{"$ref":"#/components/schemas/PodAffinityType"},"key":{"description":"The label key to use. (mandatory)","type":"string","nullable":true}},"nullable":true},"PodAffinityType":{"description":"The affinity type, required or preferred. (mandatory)","type":"string","enum":["Required","Preferred"],"nullable":true},"AdvancedFlatFields":{"properties":{"terminateAfterPreemption":{"description":"Indicates if the job should be terminated by the system after it has been preempted.","type":"boolean","nullable":true},"autoDeletionTimeAfterCompletionSeconds":{"description":"Specifies the duration after which a finished workload (completed or failed) will be automatically deleted. The default is 30 days.","format":"int64","type":"integer","nullable":true},"backoffLimit":{"description":"Specifies the number of retries before marking a workload as failed (not applicable to Inference workloads). The default value is 6.","format":"int64","type":"integer","nullable":true}},"nullable":true,"type":"object"},"AdvancedItemizedFields":{"allOf":[{"$ref":"#/components/schemas/AnnotationsField"},{"$ref":"#/components/schemas/LabelsField"},{"$ref":"#/components/schemas/TolerationsField"}],"nullable":true,"type":"object"},"AnnotationsField":{"properties":{"annotations":{"$ref":"#/components/schemas/Annotations"}},"nullable":true,"type":"object"},"Annotations":{"description":"Set of annotations to populate into the container running the workspace.","type":"array","items":{"$ref":"#/components/schemas/Annotation"},"nullable":true},"Annotation":{"description":"Annotation details to be populated into the container.","properties":{"name":{"description":"The name of the annotation (mandatory)","type":"string","minLength":1,"maxLength":63,"nullable":true},"value":{"description":"The value of the annotation.","type":"string","nullable":true},"exclude":{"description":"Use 'true' in case the annotation is defined in defaults of the policy, and you wish to exclude it from the workload.","type":"boolean","default":false,"nullable":true}},"nullable":true,"type":"object"},"LabelsField":{"properties":{"labels":{"$ref":"#/components/schemas/Labels"}},"nullable":true,"type":"object"},"Labels":{"description":"Set of labels to populate into the container running the workspace.","type":"array","items":{"$ref":"#/components/schemas/Label"},"nullable":true},"Label":{"description":"Label details to be populated into the container.","properties":{"name":{"description":"The name of the label (mandatory)","type":"string","minLength":1,"maxLength":63,"nullable":true},"value":{"description":"The value of the label.","type":"string","nullable":true},"exclude":{"description":"Use 'true' in case the label is defined in defaults of the policy, and you wish to exclude it from the workload.","type":"boolean","nullable":true}},"nullable":true,"type":"object"},"TolerationsField":{"properties":{"tolerations":{"$ref":"#/components/schemas/Tolerations"}},"nullable":true,"type":"object"},"Tolerations":{"description":"Set of tolerations to apply to the workload.","type":"array","items":{"$ref":"#/components/schemas/Toleration"},"nullable":true},"Toleration":{"description":"Toleration details.","properties":{"name":{"description":"The name of the toleration.","type":"string","minLength":1,"nullable":true},"operator":{"$ref":"#/components/schemas/TolerationOperator"},"key":{"description":"The taint key that the toleration applies to. (mandatory)","type":"string","nullable":true},"value":{"description":"The taint value the toleration matches to. Mandatory if operator is Exists, forbidden otherwise.","type":"string","nullable":true},"effect":{"$ref":"#/components/schemas/TolerationEffect"},"seconds":{"description":"The period of time the toleration tolerates the taint. Valid only if effect is NoExecute. taint.","type":"integer","minimum":1,"nullable":true},"exclude":{"description":"Use 'true' in case the label is defined in defaults of the policy, and you wish to exclude it from the workload.","type":"boolean","nullable":true}},"nullable":true,"type":"object"},"TolerationOperator":{"description":"A key's relationship to the value. Equal uses key and value. Exists is equivalent to wildcard for value, so that a workload can tolerate all taints of a particular category. (mandatory)","type":"string","enum":["Equal","Exists"],"nullable":true},"TolerationEffect":{"description":"The taint effect to match. (mandatory)","type":"string","enum":["NoSchedule","NoExecute","PreferNoSchedule","Any"],"nullable":true},"SpecificRunConnections":{"properties":{"connections":{"type":"array","items":{"$ref":"#/components/schemas/SpecificRunConnectionInfo"},"nullable":true}},"nullable":true,"type":"object"},"SpecificRunConnectionInfo":{"required":["connectionName"],"properties":{"name":{"type":"string","minLength":1,"description":"Unique identifier of the connection. Will be used to correlate between the information given here and the information provided for the connection in the environment asset."},"nodePort":{"description":"Port number of the host that will be connected with the container port. Required if and only if isCustomPort is set to true in the environment asset.","type":"integer","format":"int32","minimum":0,"maximum":65535,"nullable":true},"externalUrl":{"description":"URL to associated with the container port. Required if and only if isCustomExternalUrl is set to true in the environment asset.","type":"string","minLength":1,"nullable":true},"authorizedUsers":{"description":"Specifies the emails of those users that are allowed to access the connection. Note that authorizedUsers and authorizedGroups are mutually exclusive.","type":"array","items":{"type":"string"},"nullable":true},"authorizedGroups":{"description":"Specifies the names of those groups that are allowed to access the connection. Note that authorizedUsers and authorizedGroups are mutually exclusive.","type":"array","items":{"type":"string"},"nullable":true}}},"AllowOverQuota":{"properties":{"allowOverQuota":{"description":"Whether to allow the workload to exceed the quota of the project.","type":"boolean","nullable":true}}},"SpecificRunAutoScaling":{"properties":{"autoScaling":{"allOf":[{"$ref":"#/components/schemas/AutoScalingCommonFields"},{"$ref":"#/components/schemas/SpecificRunMetricFields"}],"nullable":true,"type":"object"}},"nullable":true,"type":"object"},"AutoScalingCommonFields":{"description":"Auto scaling common fields","properties":{"minReplicas":{"description":"The minimum number of replicas for autoscaling. Defaults to 1. Use 0 to allow scale-to-zero","type":"integer","format":"int32","minimum":0,"nullable":true},"maxReplicas":{"description":"The maximum number of replicas for autoscaling. Defaults to minReplicas, or to 1 if minReplicas is set to 0","type":"integer","format":"int32","minimum":1,"nullable":true},"scaleToZeroRetentionSeconds":{"description":"The minimum amount of time (in seconds) that the last replica will remain active after a scale-to-zero decision. Defaults to 0. Available only if minReplicas is set to 0","type":"integer","format":"int32","minimum":0,"maximum":3600,"nullable":true}},"nullable":true,"type":"object"},"SpecificRunMetricFields":{"properties":{"thresholdMetric":{"$ref":"#/components/schemas/AutoScalingMetric"},"thresholdValue":{"description":"The threshold value to use with the specified metric for autoscaling","type":"integer","format":"int32","nullable":true}},"type":"object","nullable":true},"AutoScalingMetric":{"description":"The metric to use for autoscaling. Mandatory if minReplicas < maxReplicas, except for the special case where minReplicas is set to 0 and maxReplicas is set to 1, as in this case autoscaling decisions are made according to network activity rather than metrics. Only the 'throughput' and 'concurrency' metrics support scale-to-zero","type":"string","enum":["throughput","concurrency","latency"],"nullable":true},"InfoDistributed":{"description":"Parameters which apply to distributed training.\n","allOf":[{"properties":{"numWorkers":{"type":"integer"},"noMaster":{"type":"boolean","nullable":true},"distFramework":{"$ref":"#/components/schemas/DistributedFramework"},"master":{"$ref":"#/components/schemas/InfoDistMaster"}}}],"nullable":true,"type":"object"},"DistributedFramework":{"description":"The distributed training framework used in the workload.","type":"string","enum":["MPI","PyTorch","TF","XGBoost"],"nullable":true},"InfoDistMaster":{"description":"Parameters which apply to the master in a distributed training.\n","nullable":true,"type":"object","properties":{"assets":{"$ref":"#/components/schemas/AssetsRefOptional"},"specificEnv":{"$ref":"#/components/schemas/SpecificRunParams"}}},"AssetsRefOptional":{"allOf":[{"$ref":"#/components/schemas/AssetsRef"}],"type":"object","nullable":true},"Error":{"required":["code","message"],"properties":{"code":{"type":"integer","minimum":100,"maximum":599},"message":{"type":"string"},"details":{"type":"string"}}}},"responses":{"401Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503ServiceUnavailable":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/v1/asset/workload-template":{"get":{"summary":"List templates.","description":"Retrieve a list of templates.","operationId":"list_templates","deprecated":true,"tags":["Template"],"parameters":[{"$ref":"#/components/parameters/AssetNameFilter"},{"$ref":"#/components/parameters/AssetScopeFilter"},{"$ref":"#/components/parameters/AssetProjectFilter"},{"$ref":"#/components/parameters/FilterByDepartment"},{"$ref":"#/components/parameters/FilterByCluster"},{"$ref":"#/components/parameters/DistributedFrameworkQuery"},{"$ref":"#/components/parameters/IsDistributedQuery"},{"$ref":"#/components/parameters/IsTrainingQuery"},{"$ref":"#/components/parameters/IsWorkspaceQuery"}],"responses":{"200":{"description":"Request completed successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkloadTemplateListResponse"}}}},"401":{"$ref":"#/components/responses/401Unauthorized"},"403":{"$ref":"#/components/responses/403Forbidden"},"503":{"$ref":"#/components/responses/503ServiceUnavailable"}}}}}}
```

## Create a template.

> Use to create a template.

```json
{"openapi":"3.0.3","info":{"title":"Runai API","version":"2.19"},"tags":[{"name":"Template","description":"Templates are a pre-set configuration used to quickly configure and submit workloads using existing assets."}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"schemas":{"WorkloadTemplateCreationRequest":{"required":["meta","spec"],"properties":{"meta":{"$ref":"#/components/schemas/AssetCreationRequest"},"spec":{"$ref":"#/components/schemas/SpecificRunCreationFields"}}},"AssetCreationRequest":{"allOf":[{"$ref":"#/components/schemas/AssetUpdatableFields"},{"$ref":"#/components/schemas/AssetCreationFields"}]},"AssetUpdatableFields":{"required":["name"],"properties":{"name":{"$ref":"#/components/schemas/AssetName"},"description":{"$ref":"#/components/schemas/AssetDescription"}}},"AssetName":{"description":"The name of the asset.","type":"string","minLength":1},"AssetDescription":{"description":"The description of the asset.","type":"string","minLength":1,"maxLength":250,"nullable":true},"AssetCreationFields":{"type":"object","required":["scope"],"properties":{"scope":{"$ref":"#/components/schemas/Scope"},"clusterId":{"$ref":"#/components/schemas/ClusterIdOptional"},"departmentId":{"description":"The id of the department. Must be specified for department scoped assets.","type":"string","nullable":true,"minLength":1},"projectId":{"description":"The id of the project. Must be specified for project scoped assets.","type":"integer","format":"int32","nullable":true},"autoDelete":{"description":"The asset will be deleted automatically. This is intended for internal use.","type":"boolean","nullable":true,"default":false},"workloadSupportedTypes":{"$ref":"#/components/schemas/WorkloadSupportedTypes"}}},"Scope":{"description":"The scope in which an asset can be used. The highest scope, system, is intended for internal purposes only.","type":"string","minLength":1,"enum":["system","tenant","cluster","department","project"]},"ClusterIdOptional":{"description":"The id of the cluster.","type":"string","format":"uuid","minLength":1,"nullable":true},"WorkloadSupportedTypes":{"properties":{"inference":{"description":"Is inference a supported workload type.","type":"boolean","nullable":true},"workspace":{"description":"Is workspace a supported workload type.","type":"boolean","nullable":true},"training":{"description":"Is training a supported workload type.","type":"boolean","nullable":true},"distributed":{"description":"Is distributed a supported workload type.","type":"boolean","nullable":true},"distFramework":{"description":"The distributed training framework used in the workload.","type":"string","enum":["MPI","PyTorch","TF","XGBoost"],"nullable":true}},"nullable":true,"type":"object"},"SpecificRunCreationFields":{"description":"The information needed for creating az template - a set of assets and an optional set of specific environment parameters.","required":["assets"],"properties":{"assets":{"$ref":"#/components/schemas/AssetsIds"},"specificEnv":{"$ref":"#/components/schemas/SpecificRunParams"}}},"AssetsIds":{"description":"Set of assets comprising a workspace or a workspace template.","required":["environment"],"properties":{"environment":{"$ref":"#/components/schemas/AssetId"},"compute":{"nullable":true,"type":"string","allOf":[{"$ref":"#/components/schemas/AssetId"}]},"datasources":{"type":"array","items":{"$ref":"#/components/schemas/AssetIdAndKind"}},"workloadVolumes":{"type":"array","items":{"type":"string"}}}},"AssetId":{"description":"Unique identifier of the asset.","type":"string","format":"uuid","minLength":1},"AssetIdAndKind":{"description":"Asset id and its kind.","required":["id","kind"],"properties":{"id":{"$ref":"#/components/schemas/AssetId"},"kind":{"$ref":"#/components/schemas/AssetKind"},"overrides":{"$ref":"#/components/schemas/DataSourceOverrides"}}},"AssetKind":{"description":"The kind of the asset.","type":"string","minLength":1,"enum":["compute","environment","accessKey","dockerRegistry","password","genericSecret","registry","s3","git","nfs","pvc","hostPath","workload-template","model","config-map","secret-volume"]},"DataSourceOverrides":{"description":"specific fields to override in the data source.","type":"object","nullable":true,"properties":{"containerPath":{"type":"string","minLength":1,"nullable":true}}},"SpecificRunParams":{"description":"Parameters which apply to a specific workload. They complement the information gathered from the assets comprising the workload.\n","allOf":[{"$ref":"#/components/schemas/SpecificRunParamsCommon"},{"$ref":"#/components/schemas/AllowOverQuota"},{"$ref":"#/components/schemas/SpecificRunAutoScaling"}],"nullable":true,"type":"object"},"SpecificRunParamsCommon":{"allOf":[{"$ref":"#/components/schemas/ContainerOverridable"},{"$ref":"#/components/schemas/CommonSecurityOverridable"},{"$ref":"#/components/schemas/EnvironmentVariablesField"},{"$ref":"#/components/schemas/ResourcesFlatFields"},{"$ref":"#/components/schemas/AdvancedFlatFields"},{"$ref":"#/components/schemas/AdvancedItemizedFields"},{"$ref":"#/components/schemas/SpecificRunConnections"}],"nullable":true,"type":"object"},"ContainerOverridable":{"description":"Container overrideable fields. In the context of assets,these are environment asset fields that can be overriden in the submit workload request.","properties":{"command":{"description":"A command to the server as the entry point of the container running the workspace.","type":"string","minLength":1,"nullable":true},"args":{"description":"Arguments to the command that the container running the workspace executes.","type":"string","minLength":1,"nullable":true}},"nullable":true,"type":"object"},"CommonSecurityOverridable":{"description":"Security overrideable fields. In the context of assets,these are environment asset fields that can be overriden in the submit workload request.","properties":{"runAsUid":{"description":"The user id to run the entrypoint of the container which executes the workspace. Default to the value specified in the environment asset `runAsUid` field (optional). Use only when the source uid/gid of the environment asset is not `fromTheImage`, and `overrideUidGidInWorkspace` is enabled.","type":"integer","format":"int64","nullable":true},"runAsGid":{"description":"The group id to run the entrypoint of the container which executes the workspace. Default to the value specified in the environment asset `runAsGid` field (optional). Use only when the source uid/gid of the environment asset is not `fromTheImage`, and `overrideUidGidInWorkspace` is enabled.","type":"integer","format":"int64","nullable":true},"supplementalGroups":{"description":"Comma separated list of groups that the user running the container belongs to, in addition to the group indicated by runAsGid. Use only when the source uid/gid of the environment asset is not `fromTheImage`, and `overrideUidGidInWorkspace` is enabled. Using an empty string implies reverting the supplementary groups of the image.","type":"string","nullable":true}},"nullable":true,"type":"object"},"EnvironmentVariablesField":{"properties":{"environmentVariables":{"$ref":"#/components/schemas/EnvironmentVariables2"}},"nullable":true,"type":"object"},"EnvironmentVariables2":{"description":"Set of environment variables to populate into the container running the workspace.","type":"array","items":{"$ref":"#/components/schemas/EnvironmentVariable2"},"nullable":true},"EnvironmentVariable2":{"description":"Details of an environment variable which is populated into the container.","properties":{"name":{"description":"The name of the environment variable. (mandatory)","type":"string","minLength":1,"nullable":true},"value":{"description":"The value of the environment variable. (mutually exclusive with secret)","type":"string","nullable":true},"secret":{"$ref":"#/components/schemas/EnvironmentVariableSecret"},"exclude":{"description":"Use 'true' in case the environment variable is defined in defaults of the policy, and you wish to exclude it from the workload.","type":"boolean","nullable":true}},"nullable":true,"type":"object"},"EnvironmentVariableSecret":{"description":"Details of the secret and key use to populated the environment variable. (mutually exclusive with value)","properties":{"name":{"description":"The name of the secret resource. (mandatory)","type":"string","minLength":1,"nullable":true},"key":{"description":"The key in the secret resource. (mandatory)","type":"string","minLength":1,"nullable":true}},"nullable":true,"type":"object"},"ResourcesFlatFields":{"description":"Resource parameters.","properties":{"nodeType":{"description":"Nodes (machines), or a group of nodes on which the workload will run. To use this feature, your Administrator will need to label nodes. For more information, see [Group Nodes](https://docs.run.ai/v2.19/admin/researcher-setup/limit-to-node-group). When using this flag with with Project-based affinity, it refines the list of allowable node groups set in the Project. For more information, see [Projects](https://docs.run.ai/admin/admin-ui-setup/project-setup).","type":"string","minLength":1,"nullable":true},"nodePools":{"description":"A prioritized list of node pools for the scheduler to run the workspace on. The scheduler will always try to use the first node pool before moving to the next one if the first is not available.","type":"array","items":{"type":"string"},"nullable":true},"podAffinity":{"$ref":"#/components/schemas/PodAffinity"}},"nullable":true,"type":"object"},"PodAffinity":{"description":"Pod affinity scheduling rules (e.g. co-locate this workload in the same node, zone, etc. as some other workloads).","type":"object","properties":{"type":{"$ref":"#/components/schemas/PodAffinityType"},"key":{"description":"The label key to use. (mandatory)","type":"string","nullable":true}},"nullable":true},"PodAffinityType":{"description":"The affinity type, required or preferred. (mandatory)","type":"string","enum":["Required","Preferred"],"nullable":true},"AdvancedFlatFields":{"properties":{"terminateAfterPreemption":{"description":"Indicates if the job should be terminated by the system after it has been preempted.","type":"boolean","nullable":true},"autoDeletionTimeAfterCompletionSeconds":{"description":"Specifies the duration after which a finished workload (completed or failed) will be automatically deleted. The default is 30 days.","format":"int64","type":"integer","nullable":true},"backoffLimit":{"description":"Specifies the number of retries before marking a workload as failed (not applicable to Inference workloads). The default value is 6.","format":"int64","type":"integer","nullable":true}},"nullable":true,"type":"object"},"AdvancedItemizedFields":{"allOf":[{"$ref":"#/components/schemas/AnnotationsField"},{"$ref":"#/components/schemas/LabelsField"},{"$ref":"#/components/schemas/TolerationsField"}],"nullable":true,"type":"object"},"AnnotationsField":{"properties":{"annotations":{"$ref":"#/components/schemas/Annotations"}},"nullable":true,"type":"object"},"Annotations":{"description":"Set of annotations to populate into the container running the workspace.","type":"array","items":{"$ref":"#/components/schemas/Annotation"},"nullable":true},"Annotation":{"description":"Annotation details to be populated into the container.","properties":{"name":{"description":"The name of the annotation (mandatory)","type":"string","minLength":1,"maxLength":63,"nullable":true},"value":{"description":"The value of the annotation.","type":"string","nullable":true},"exclude":{"description":"Use 'true' in case the annotation is defined in defaults of the policy, and you wish to exclude it from the workload.","type":"boolean","default":false,"nullable":true}},"nullable":true,"type":"object"},"LabelsField":{"properties":{"labels":{"$ref":"#/components/schemas/Labels"}},"nullable":true,"type":"object"},"Labels":{"description":"Set of labels to populate into the container running the workspace.","type":"array","items":{"$ref":"#/components/schemas/Label"},"nullable":true},"Label":{"description":"Label details to be populated into the container.","properties":{"name":{"description":"The name of the label (mandatory)","type":"string","minLength":1,"maxLength":63,"nullable":true},"value":{"description":"The value of the label.","type":"string","nullable":true},"exclude":{"description":"Use 'true' in case the label is defined in defaults of the policy, and you wish to exclude it from the workload.","type":"boolean","nullable":true}},"nullable":true,"type":"object"},"TolerationsField":{"properties":{"tolerations":{"$ref":"#/components/schemas/Tolerations"}},"nullable":true,"type":"object"},"Tolerations":{"description":"Set of tolerations to apply to the workload.","type":"array","items":{"$ref":"#/components/schemas/Toleration"},"nullable":true},"Toleration":{"description":"Toleration details.","properties":{"name":{"description":"The name of the toleration.","type":"string","minLength":1,"nullable":true},"operator":{"$ref":"#/components/schemas/TolerationOperator"},"key":{"description":"The taint key that the toleration applies to. (mandatory)","type":"string","nullable":true},"value":{"description":"The taint value the toleration matches to. Mandatory if operator is Exists, forbidden otherwise.","type":"string","nullable":true},"effect":{"$ref":"#/components/schemas/TolerationEffect"},"seconds":{"description":"The period of time the toleration tolerates the taint. Valid only if effect is NoExecute. taint.","type":"integer","minimum":1,"nullable":true},"exclude":{"description":"Use 'true' in case the label is defined in defaults of the policy, and you wish to exclude it from the workload.","type":"boolean","nullable":true}},"nullable":true,"type":"object"},"TolerationOperator":{"description":"A key's relationship to the value. Equal uses key and value. Exists is equivalent to wildcard for value, so that a workload can tolerate all taints of a particular category. (mandatory)","type":"string","enum":["Equal","Exists"],"nullable":true},"TolerationEffect":{"description":"The taint effect to match. (mandatory)","type":"string","enum":["NoSchedule","NoExecute","PreferNoSchedule","Any"],"nullable":true},"SpecificRunConnections":{"properties":{"connections":{"type":"array","items":{"$ref":"#/components/schemas/SpecificRunConnectionInfo"},"nullable":true}},"nullable":true,"type":"object"},"SpecificRunConnectionInfo":{"required":["connectionName"],"properties":{"name":{"type":"string","minLength":1,"description":"Unique identifier of the connection. Will be used to correlate between the information given here and the information provided for the connection in the environment asset."},"nodePort":{"description":"Port number of the host that will be connected with the container port. Required if and only if isCustomPort is set to true in the environment asset.","type":"integer","format":"int32","minimum":0,"maximum":65535,"nullable":true},"externalUrl":{"description":"URL to associated with the container port. Required if and only if isCustomExternalUrl is set to true in the environment asset.","type":"string","minLength":1,"nullable":true},"authorizedUsers":{"description":"Specifies the emails of those users that are allowed to access the connection. Note that authorizedUsers and authorizedGroups are mutually exclusive.","type":"array","items":{"type":"string"},"nullable":true},"authorizedGroups":{"description":"Specifies the names of those groups that are allowed to access the connection. Note that authorizedUsers and authorizedGroups are mutually exclusive.","type":"array","items":{"type":"string"},"nullable":true}}},"AllowOverQuota":{"properties":{"allowOverQuota":{"description":"Whether to allow the workload to exceed the quota of the project.","type":"boolean","nullable":true}}},"SpecificRunAutoScaling":{"properties":{"autoScaling":{"allOf":[{"$ref":"#/components/schemas/AutoScalingCommonFields"},{"$ref":"#/components/schemas/SpecificRunMetricFields"}],"nullable":true,"type":"object"}},"nullable":true,"type":"object"},"AutoScalingCommonFields":{"description":"Auto scaling common fields","properties":{"minReplicas":{"description":"The minimum number of replicas for autoscaling. Defaults to 1. Use 0 to allow scale-to-zero","type":"integer","format":"int32","minimum":0,"nullable":true},"maxReplicas":{"description":"The maximum number of replicas for autoscaling. Defaults to minReplicas, or to 1 if minReplicas is set to 0","type":"integer","format":"int32","minimum":1,"nullable":true},"scaleToZeroRetentionSeconds":{"description":"The minimum amount of time (in seconds) that the last replica will remain active after a scale-to-zero decision. Defaults to 0. Available only if minReplicas is set to 0","type":"integer","format":"int32","minimum":0,"maximum":3600,"nullable":true}},"nullable":true,"type":"object"},"SpecificRunMetricFields":{"properties":{"thresholdMetric":{"$ref":"#/components/schemas/AutoScalingMetric"},"thresholdValue":{"description":"The threshold value to use with the specified metric for autoscaling","type":"integer","format":"int32","nullable":true}},"type":"object","nullable":true},"AutoScalingMetric":{"description":"The metric to use for autoscaling. Mandatory if minReplicas < maxReplicas, except for the special case where minReplicas is set to 0 and maxReplicas is set to 1, as in this case autoscaling decisions are made according to network activity rather than metrics. Only the 'throughput' and 'concurrency' metrics support scale-to-zero","type":"string","enum":["throughput","concurrency","latency"],"nullable":true},"WorkloadTemplate":{"required":["meta","spec"],"properties":{"meta":{"$ref":"#/components/schemas/AssetMeta"},"spec":{"$ref":"#/components/schemas/SpecificRunInfoFields"}}},"AssetMeta":{"allOf":[{"$ref":"#/components/schemas/AssetUpdatableFields"},{"$ref":"#/components/schemas/AssetCreationFields"},{"$ref":"#/components/schemas/AssetReadOnlyFields"}]},"AssetReadOnlyFields":{"required":["id","kind","createdBy","createdAt","updatedBy","updatedAt"],"properties":{"id":{"$ref":"#/components/schemas/AssetId"},"kind":{"$ref":"#/components/schemas/AssetKind"},"tenantId":{"description":"The id of the tenant.","type":"integer","format":"int32","nullable":true},"createdBy":{"description":"The user who created the asset.","type":"string","minLength":1},"createdAt":{"description":"The time at which the asset were created","type":"string","minLength":1,"format":"date-time"},"updatedBy":{"description":"The user who updated the asset.","type":"string","minLength":1},"updatedAt":{"description":"The time at which the asset has been updated","type":"string","minLength":1,"format":"date-time"},"projectName":{"description":"The name of the project that the asset is associated with, for project scoped assets.","type":"string","minLength":1,"nullable":true}},"type":"object"},"SpecificRunInfoFields":{"description":"Information about the set of assets which comprises a workspace, training or template, and an optional set of specific run parameters.","required":["assets"],"properties":{"assets":{"$ref":"#/components/schemas/AssetsRef"},"specificEnv":{"$ref":"#/components/schemas/SpecificRunParams"},"distributed":{"$ref":"#/components/schemas/InfoDistributed"}}},"AssetsRef":{"description":"Reference information about a set of assets. used to describe - assets comprising a workspace - assets comprising a workspace template - assets that use other assets (e.g. s3 asset which uses access key).","required":["environment"],"properties":{"environment":{"description":"environment asset.","allOf":[{"$ref":"#/components/schemas/EnvironmentAssetRef"}]},"compute":{"$ref":"#/components/schemas/AssetsRefCompute"},"datasources":{"type":"array","items":{"$ref":"#/components/schemas/DatasourceRef"}},"workloadVolumes":{"type":"array","items":{"type":"string"}}}},"EnvironmentAssetRef":{"description":"Reference information about environment asset.","required":["id","name"],"properties":{"id":{"$ref":"#/components/schemas/AssetId"},"name":{"$ref":"#/components/schemas/AssetName"},"toolTypes":{"description":"the type of tools as defined in the connections of the environment asset.","type":"array","nullable":true,"items":{"$ref":"#/components/schemas/ToolType"}}}},"ToolType":{"description":"Super set of Internal and External tool types.","type":"string","minLength":1,"enum":["jupyter-notebook","pycharm","visual-studio-code","tensorboard","rstudio","mlflow","custom","wandb","matlab","comet","chatbot-ui"]},"AssetsRefCompute":{"allOf":[{"$ref":"#/components/schemas/AssetRef"}],"nullable":true,"type":"object"},"AssetRef":{"description":"Reference information about an asset.","required":["id","name"],"properties":{"id":{"$ref":"#/components/schemas/AssetId"},"name":{"$ref":"#/components/schemas/AssetName"}}},"DatasourceRef":{"description":"Reference information about a datasource asset.","required":["id","name","kind"],"properties":{"id":{"$ref":"#/components/schemas/AssetId"},"name":{"$ref":"#/components/schemas/AssetName"},"kind":{"$ref":"#/components/schemas/AssetKind"},"overrides":{"$ref":"#/components/schemas/DataSourceOverrides"}}},"InfoDistributed":{"description":"Parameters which apply to distributed training.\n","allOf":[{"properties":{"numWorkers":{"type":"integer"},"noMaster":{"type":"boolean","nullable":true},"distFramework":{"$ref":"#/components/schemas/DistributedFramework"},"master":{"$ref":"#/components/schemas/InfoDistMaster"}}}],"nullable":true,"type":"object"},"DistributedFramework":{"description":"The distributed training framework used in the workload.","type":"string","enum":["MPI","PyTorch","TF","XGBoost"],"nullable":true},"InfoDistMaster":{"description":"Parameters which apply to the master in a distributed training.\n","nullable":true,"type":"object","properties":{"assets":{"$ref":"#/components/schemas/AssetsRefOptional"},"specificEnv":{"$ref":"#/components/schemas/SpecificRunParams"}}},"AssetsRefOptional":{"allOf":[{"$ref":"#/components/schemas/AssetsRef"}],"type":"object","nullable":true},"Error":{"required":["code","message"],"properties":{"code":{"type":"integer","minimum":100,"maximum":599},"message":{"type":"string"},"details":{"type":"string"}}}},"responses":{"400BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409Conflict":{"description":"The specified resource already exists","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503ServiceUnavailable":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/v1/asset/workload-template":{"post":{"summary":"Create a template.","description":"Use to create a template.","operationId":"create_template","deprecated":true,"tags":["Template"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkloadTemplateCreationRequest"}}}},"responses":{"202":{"description":"Request accepted successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkloadTemplate"}}}},"400":{"$ref":"#/components/responses/400BadRequest"},"401":{"$ref":"#/components/responses/401Unauthorized"},"403":{"$ref":"#/components/responses/403Forbidden"},"409":{"$ref":"#/components/responses/409Conflict"},"503":{"$ref":"#/components/responses/503ServiceUnavailable"}}}}}}
```

## Get a template.

> Retrieve the details of a template by id.

```json
{"openapi":"3.0.3","info":{"title":"Runai API","version":"2.19"},"tags":[{"name":"Template","description":"Templates are a pre-set configuration used to quickly configure and submit workloads using existing assets."}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"schemas":{"WorkloadTemplate":{"required":["meta","spec"],"properties":{"meta":{"$ref":"#/components/schemas/AssetMeta"},"spec":{"$ref":"#/components/schemas/SpecificRunInfoFields"}}},"AssetMeta":{"allOf":[{"$ref":"#/components/schemas/AssetUpdatableFields"},{"$ref":"#/components/schemas/AssetCreationFields"},{"$ref":"#/components/schemas/AssetReadOnlyFields"}]},"AssetUpdatableFields":{"required":["name"],"properties":{"name":{"$ref":"#/components/schemas/AssetName"},"description":{"$ref":"#/components/schemas/AssetDescription"}}},"AssetName":{"description":"The name of the asset.","type":"string","minLength":1},"AssetDescription":{"description":"The description of the asset.","type":"string","minLength":1,"maxLength":250,"nullable":true},"AssetCreationFields":{"type":"object","required":["scope"],"properties":{"scope":{"$ref":"#/components/schemas/Scope"},"clusterId":{"$ref":"#/components/schemas/ClusterIdOptional"},"departmentId":{"description":"The id of the department. Must be specified for department scoped assets.","type":"string","nullable":true,"minLength":1},"projectId":{"description":"The id of the project. Must be specified for project scoped assets.","type":"integer","format":"int32","nullable":true},"autoDelete":{"description":"The asset will be deleted automatically. This is intended for internal use.","type":"boolean","nullable":true,"default":false},"workloadSupportedTypes":{"$ref":"#/components/schemas/WorkloadSupportedTypes"}}},"Scope":{"description":"The scope in which an asset can be used. The highest scope, system, is intended for internal purposes only.","type":"string","minLength":1,"enum":["system","tenant","cluster","department","project"]},"ClusterIdOptional":{"description":"The id of the cluster.","type":"string","format":"uuid","minLength":1,"nullable":true},"WorkloadSupportedTypes":{"properties":{"inference":{"description":"Is inference a supported workload type.","type":"boolean","nullable":true},"workspace":{"description":"Is workspace a supported workload type.","type":"boolean","nullable":true},"training":{"description":"Is training a supported workload type.","type":"boolean","nullable":true},"distributed":{"description":"Is distributed a supported workload type.","type":"boolean","nullable":true},"distFramework":{"description":"The distributed training framework used in the workload.","type":"string","enum":["MPI","PyTorch","TF","XGBoost"],"nullable":true}},"nullable":true,"type":"object"},"AssetReadOnlyFields":{"required":["id","kind","createdBy","createdAt","updatedBy","updatedAt"],"properties":{"id":{"$ref":"#/components/schemas/AssetId"},"kind":{"$ref":"#/components/schemas/AssetKind"},"tenantId":{"description":"The id of the tenant.","type":"integer","format":"int32","nullable":true},"createdBy":{"description":"The user who created the asset.","type":"string","minLength":1},"createdAt":{"description":"The time at which the asset were created","type":"string","minLength":1,"format":"date-time"},"updatedBy":{"description":"The user who updated the asset.","type":"string","minLength":1},"updatedAt":{"description":"The time at which the asset has been updated","type":"string","minLength":1,"format":"date-time"},"projectName":{"description":"The name of the project that the asset is associated with, for project scoped assets.","type":"string","minLength":1,"nullable":true}},"type":"object"},"AssetId":{"description":"Unique identifier of the asset.","type":"string","format":"uuid","minLength":1},"AssetKind":{"description":"The kind of the asset.","type":"string","minLength":1,"enum":["compute","environment","accessKey","dockerRegistry","password","genericSecret","registry","s3","git","nfs","pvc","hostPath","workload-template","model","config-map","secret-volume"]},"SpecificRunInfoFields":{"description":"Information about the set of assets which comprises a workspace, training or template, and an optional set of specific run parameters.","required":["assets"],"properties":{"assets":{"$ref":"#/components/schemas/AssetsRef"},"specificEnv":{"$ref":"#/components/schemas/SpecificRunParams"},"distributed":{"$ref":"#/components/schemas/InfoDistributed"}}},"AssetsRef":{"description":"Reference information about a set of assets. used to describe - assets comprising a workspace - assets comprising a workspace template - assets that use other assets (e.g. s3 asset which uses access key).","required":["environment"],"properties":{"environment":{"description":"environment asset.","allOf":[{"$ref":"#/components/schemas/EnvironmentAssetRef"}]},"compute":{"$ref":"#/components/schemas/AssetsRefCompute"},"datasources":{"type":"array","items":{"$ref":"#/components/schemas/DatasourceRef"}},"workloadVolumes":{"type":"array","items":{"type":"string"}}}},"EnvironmentAssetRef":{"description":"Reference information about environment asset.","required":["id","name"],"properties":{"id":{"$ref":"#/components/schemas/AssetId"},"name":{"$ref":"#/components/schemas/AssetName"},"toolTypes":{"description":"the type of tools as defined in the connections of the environment asset.","type":"array","nullable":true,"items":{"$ref":"#/components/schemas/ToolType"}}}},"ToolType":{"description":"Super set of Internal and External tool types.","type":"string","minLength":1,"enum":["jupyter-notebook","pycharm","visual-studio-code","tensorboard","rstudio","mlflow","custom","wandb","matlab","comet","chatbot-ui"]},"AssetsRefCompute":{"allOf":[{"$ref":"#/components/schemas/AssetRef"}],"nullable":true,"type":"object"},"AssetRef":{"description":"Reference information about an asset.","required":["id","name"],"properties":{"id":{"$ref":"#/components/schemas/AssetId"},"name":{"$ref":"#/components/schemas/AssetName"}}},"DatasourceRef":{"description":"Reference information about a datasource asset.","required":["id","name","kind"],"properties":{"id":{"$ref":"#/components/schemas/AssetId"},"name":{"$ref":"#/components/schemas/AssetName"},"kind":{"$ref":"#/components/schemas/AssetKind"},"overrides":{"$ref":"#/components/schemas/DataSourceOverrides"}}},"DataSourceOverrides":{"description":"specific fields to override in the data source.","type":"object","nullable":true,"properties":{"containerPath":{"type":"string","minLength":1,"nullable":true}}},"SpecificRunParams":{"description":"Parameters which apply to a specific workload. They complement the information gathered from the assets comprising the workload.\n","allOf":[{"$ref":"#/components/schemas/SpecificRunParamsCommon"},{"$ref":"#/components/schemas/AllowOverQuota"},{"$ref":"#/components/schemas/SpecificRunAutoScaling"}],"nullable":true,"type":"object"},"SpecificRunParamsCommon":{"allOf":[{"$ref":"#/components/schemas/ContainerOverridable"},{"$ref":"#/components/schemas/CommonSecurityOverridable"},{"$ref":"#/components/schemas/EnvironmentVariablesField"},{"$ref":"#/components/schemas/ResourcesFlatFields"},{"$ref":"#/components/schemas/AdvancedFlatFields"},{"$ref":"#/components/schemas/AdvancedItemizedFields"},{"$ref":"#/components/schemas/SpecificRunConnections"}],"nullable":true,"type":"object"},"ContainerOverridable":{"description":"Container overrideable fields. In the context of assets,these are environment asset fields that can be overriden in the submit workload request.","properties":{"command":{"description":"A command to the server as the entry point of the container running the workspace.","type":"string","minLength":1,"nullable":true},"args":{"description":"Arguments to the command that the container running the workspace executes.","type":"string","minLength":1,"nullable":true}},"nullable":true,"type":"object"},"CommonSecurityOverridable":{"description":"Security overrideable fields. In the context of assets,these are environment asset fields that can be overriden in the submit workload request.","properties":{"runAsUid":{"description":"The user id to run the entrypoint of the container which executes the workspace. Default to the value specified in the environment asset `runAsUid` field (optional). Use only when the source uid/gid of the environment asset is not `fromTheImage`, and `overrideUidGidInWorkspace` is enabled.","type":"integer","format":"int64","nullable":true},"runAsGid":{"description":"The group id to run the entrypoint of the container which executes the workspace. Default to the value specified in the environment asset `runAsGid` field (optional). Use only when the source uid/gid of the environment asset is not `fromTheImage`, and `overrideUidGidInWorkspace` is enabled.","type":"integer","format":"int64","nullable":true},"supplementalGroups":{"description":"Comma separated list of groups that the user running the container belongs to, in addition to the group indicated by runAsGid. Use only when the source uid/gid of the environment asset is not `fromTheImage`, and `overrideUidGidInWorkspace` is enabled. Using an empty string implies reverting the supplementary groups of the image.","type":"string","nullable":true}},"nullable":true,"type":"object"},"EnvironmentVariablesField":{"properties":{"environmentVariables":{"$ref":"#/components/schemas/EnvironmentVariables2"}},"nullable":true,"type":"object"},"EnvironmentVariables2":{"description":"Set of environment variables to populate into the container running the workspace.","type":"array","items":{"$ref":"#/components/schemas/EnvironmentVariable2"},"nullable":true},"EnvironmentVariable2":{"description":"Details of an environment variable which is populated into the container.","properties":{"name":{"description":"The name of the environment variable. (mandatory)","type":"string","minLength":1,"nullable":true},"value":{"description":"The value of the environment variable. (mutually exclusive with secret)","type":"string","nullable":true},"secret":{"$ref":"#/components/schemas/EnvironmentVariableSecret"},"exclude":{"description":"Use 'true' in case the environment variable is defined in defaults of the policy, and you wish to exclude it from the workload.","type":"boolean","nullable":true}},"nullable":true,"type":"object"},"EnvironmentVariableSecret":{"description":"Details of the secret and key use to populated the environment variable. (mutually exclusive with value)","properties":{"name":{"description":"The name of the secret resource. (mandatory)","type":"string","minLength":1,"nullable":true},"key":{"description":"The key in the secret resource. (mandatory)","type":"string","minLength":1,"nullable":true}},"nullable":true,"type":"object"},"ResourcesFlatFields":{"description":"Resource parameters.","properties":{"nodeType":{"description":"Nodes (machines), or a group of nodes on which the workload will run. To use this feature, your Administrator will need to label nodes. For more information, see [Group Nodes](https://docs.run.ai/v2.19/admin/researcher-setup/limit-to-node-group). When using this flag with with Project-based affinity, it refines the list of allowable node groups set in the Project. For more information, see [Projects](https://docs.run.ai/admin/admin-ui-setup/project-setup).","type":"string","minLength":1,"nullable":true},"nodePools":{"description":"A prioritized list of node pools for the scheduler to run the workspace on. The scheduler will always try to use the first node pool before moving to the next one if the first is not available.","type":"array","items":{"type":"string"},"nullable":true},"podAffinity":{"$ref":"#/components/schemas/PodAffinity"}},"nullable":true,"type":"object"},"PodAffinity":{"description":"Pod affinity scheduling rules (e.g. co-locate this workload in the same node, zone, etc. as some other workloads).","type":"object","properties":{"type":{"$ref":"#/components/schemas/PodAffinityType"},"key":{"description":"The label key to use. (mandatory)","type":"string","nullable":true}},"nullable":true},"PodAffinityType":{"description":"The affinity type, required or preferred. (mandatory)","type":"string","enum":["Required","Preferred"],"nullable":true},"AdvancedFlatFields":{"properties":{"terminateAfterPreemption":{"description":"Indicates if the job should be terminated by the system after it has been preempted.","type":"boolean","nullable":true},"autoDeletionTimeAfterCompletionSeconds":{"description":"Specifies the duration after which a finished workload (completed or failed) will be automatically deleted. The default is 30 days.","format":"int64","type":"integer","nullable":true},"backoffLimit":{"description":"Specifies the number of retries before marking a workload as failed (not applicable to Inference workloads). The default value is 6.","format":"int64","type":"integer","nullable":true}},"nullable":true,"type":"object"},"AdvancedItemizedFields":{"allOf":[{"$ref":"#/components/schemas/AnnotationsField"},{"$ref":"#/components/schemas/LabelsField"},{"$ref":"#/components/schemas/TolerationsField"}],"nullable":true,"type":"object"},"AnnotationsField":{"properties":{"annotations":{"$ref":"#/components/schemas/Annotations"}},"nullable":true,"type":"object"},"Annotations":{"description":"Set of annotations to populate into the container running the workspace.","type":"array","items":{"$ref":"#/components/schemas/Annotation"},"nullable":true},"Annotation":{"description":"Annotation details to be populated into the container.","properties":{"name":{"description":"The name of the annotation (mandatory)","type":"string","minLength":1,"maxLength":63,"nullable":true},"value":{"description":"The value of the annotation.","type":"string","nullable":true},"exclude":{"description":"Use 'true' in case the annotation is defined in defaults of the policy, and you wish to exclude it from the workload.","type":"boolean","default":false,"nullable":true}},"nullable":true,"type":"object"},"LabelsField":{"properties":{"labels":{"$ref":"#/components/schemas/Labels"}},"nullable":true,"type":"object"},"Labels":{"description":"Set of labels to populate into the container running the workspace.","type":"array","items":{"$ref":"#/components/schemas/Label"},"nullable":true},"Label":{"description":"Label details to be populated into the container.","properties":{"name":{"description":"The name of the label (mandatory)","type":"string","minLength":1,"maxLength":63,"nullable":true},"value":{"description":"The value of the label.","type":"string","nullable":true},"exclude":{"description":"Use 'true' in case the label is defined in defaults of the policy, and you wish to exclude it from the workload.","type":"boolean","nullable":true}},"nullable":true,"type":"object"},"TolerationsField":{"properties":{"tolerations":{"$ref":"#/components/schemas/Tolerations"}},"nullable":true,"type":"object"},"Tolerations":{"description":"Set of tolerations to apply to the workload.","type":"array","items":{"$ref":"#/components/schemas/Toleration"},"nullable":true},"Toleration":{"description":"Toleration details.","properties":{"name":{"description":"The name of the toleration.","type":"string","minLength":1,"nullable":true},"operator":{"$ref":"#/components/schemas/TolerationOperator"},"key":{"description":"The taint key that the toleration applies to. (mandatory)","type":"string","nullable":true},"value":{"description":"The taint value the toleration matches to. Mandatory if operator is Exists, forbidden otherwise.","type":"string","nullable":true},"effect":{"$ref":"#/components/schemas/TolerationEffect"},"seconds":{"description":"The period of time the toleration tolerates the taint. Valid only if effect is NoExecute. taint.","type":"integer","minimum":1,"nullable":true},"exclude":{"description":"Use 'true' in case the label is defined in defaults of the policy, and you wish to exclude it from the workload.","type":"boolean","nullable":true}},"nullable":true,"type":"object"},"TolerationOperator":{"description":"A key's relationship to the value. Equal uses key and value. Exists is equivalent to wildcard for value, so that a workload can tolerate all taints of a particular category. (mandatory)","type":"string","enum":["Equal","Exists"],"nullable":true},"TolerationEffect":{"description":"The taint effect to match. (mandatory)","type":"string","enum":["NoSchedule","NoExecute","PreferNoSchedule","Any"],"nullable":true},"SpecificRunConnections":{"properties":{"connections":{"type":"array","items":{"$ref":"#/components/schemas/SpecificRunConnectionInfo"},"nullable":true}},"nullable":true,"type":"object"},"SpecificRunConnectionInfo":{"required":["connectionName"],"properties":{"name":{"type":"string","minLength":1,"description":"Unique identifier of the connection. Will be used to correlate between the information given here and the information provided for the connection in the environment asset."},"nodePort":{"description":"Port number of the host that will be connected with the container port. Required if and only if isCustomPort is set to true in the environment asset.","type":"integer","format":"int32","minimum":0,"maximum":65535,"nullable":true},"externalUrl":{"description":"URL to associated with the container port. Required if and only if isCustomExternalUrl is set to true in the environment asset.","type":"string","minLength":1,"nullable":true},"authorizedUsers":{"description":"Specifies the emails of those users that are allowed to access the connection. Note that authorizedUsers and authorizedGroups are mutually exclusive.","type":"array","items":{"type":"string"},"nullable":true},"authorizedGroups":{"description":"Specifies the names of those groups that are allowed to access the connection. Note that authorizedUsers and authorizedGroups are mutually exclusive.","type":"array","items":{"type":"string"},"nullable":true}}},"AllowOverQuota":{"properties":{"allowOverQuota":{"description":"Whether to allow the workload to exceed the quota of the project.","type":"boolean","nullable":true}}},"SpecificRunAutoScaling":{"properties":{"autoScaling":{"allOf":[{"$ref":"#/components/schemas/AutoScalingCommonFields"},{"$ref":"#/components/schemas/SpecificRunMetricFields"}],"nullable":true,"type":"object"}},"nullable":true,"type":"object"},"AutoScalingCommonFields":{"description":"Auto scaling common fields","properties":{"minReplicas":{"description":"The minimum number of replicas for autoscaling. Defaults to 1. Use 0 to allow scale-to-zero","type":"integer","format":"int32","minimum":0,"nullable":true},"maxReplicas":{"description":"The maximum number of replicas for autoscaling. Defaults to minReplicas, or to 1 if minReplicas is set to 0","type":"integer","format":"int32","minimum":1,"nullable":true},"scaleToZeroRetentionSeconds":{"description":"The minimum amount of time (in seconds) that the last replica will remain active after a scale-to-zero decision. Defaults to 0. Available only if minReplicas is set to 0","type":"integer","format":"int32","minimum":0,"maximum":3600,"nullable":true}},"nullable":true,"type":"object"},"SpecificRunMetricFields":{"properties":{"thresholdMetric":{"$ref":"#/components/schemas/AutoScalingMetric"},"thresholdValue":{"description":"The threshold value to use with the specified metric for autoscaling","type":"integer","format":"int32","nullable":true}},"type":"object","nullable":true},"AutoScalingMetric":{"description":"The metric to use for autoscaling. Mandatory if minReplicas < maxReplicas, except for the special case where minReplicas is set to 0 and maxReplicas is set to 1, as in this case autoscaling decisions are made according to network activity rather than metrics. Only the 'throughput' and 'concurrency' metrics support scale-to-zero","type":"string","enum":["throughput","concurrency","latency"],"nullable":true},"InfoDistributed":{"description":"Parameters which apply to distributed training.\n","allOf":[{"properties":{"numWorkers":{"type":"integer"},"noMaster":{"type":"boolean","nullable":true},"distFramework":{"$ref":"#/components/schemas/DistributedFramework"},"master":{"$ref":"#/components/schemas/InfoDistMaster"}}}],"nullable":true,"type":"object"},"DistributedFramework":{"description":"The distributed training framework used in the workload.","type":"string","enum":["MPI","PyTorch","TF","XGBoost"],"nullable":true},"InfoDistMaster":{"description":"Parameters which apply to the master in a distributed training.\n","nullable":true,"type":"object","properties":{"assets":{"$ref":"#/components/schemas/AssetsRefOptional"},"specificEnv":{"$ref":"#/components/schemas/SpecificRunParams"}}},"AssetsRefOptional":{"allOf":[{"$ref":"#/components/schemas/AssetsRef"}],"type":"object","nullable":true},"Error":{"required":["code","message"],"properties":{"code":{"type":"integer","minimum":100,"maximum":599},"message":{"type":"string"},"details":{"type":"string"}}}},"responses":{"401Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404NotFound":{"description":"The specified resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503ServiceUnavailable":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/v1/asset/workload-template/{AssetId}":{"get":{"summary":"Get a template.","description":"Retrieve the details of a template by id.","operationId":"get_template_by_id","deprecated":true,"tags":["Template"],"responses":{"200":{"description":"Request completed successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkloadTemplate"}}}},"401":{"$ref":"#/components/responses/401Unauthorized"},"403":{"$ref":"#/components/responses/403Forbidden"},"404":{"$ref":"#/components/responses/404NotFound"},"503":{"$ref":"#/components/responses/503ServiceUnavailable"}}}}}}
```

## Update a template.

> Use to update the details of a template by id.

```json
{"openapi":"3.0.3","info":{"title":"Runai API","version":"2.19"},"tags":[{"name":"Template","description":"Templates are a pre-set configuration used to quickly configure and submit workloads using existing assets."}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"schemas":{"WorkloadTemplateUpdateRequest":{"required":["meta","spec"],"properties":{"meta":{"$ref":"#/components/schemas/AssetUpdateRequest"},"spec":{"$ref":"#/components/schemas/SpecificRunCreationFields"}}},"AssetUpdateRequest":{"allOf":[{"$ref":"#/components/schemas/AssetUpdatableFields"}]},"AssetUpdatableFields":{"required":["name"],"properties":{"name":{"$ref":"#/components/schemas/AssetName"},"description":{"$ref":"#/components/schemas/AssetDescription"}}},"AssetName":{"description":"The name of the asset.","type":"string","minLength":1},"AssetDescription":{"description":"The description of the asset.","type":"string","minLength":1,"maxLength":250,"nullable":true},"SpecificRunCreationFields":{"description":"The information needed for creating az template - a set of assets and an optional set of specific environment parameters.","required":["assets"],"properties":{"assets":{"$ref":"#/components/schemas/AssetsIds"},"specificEnv":{"$ref":"#/components/schemas/SpecificRunParams"}}},"AssetsIds":{"description":"Set of assets comprising a workspace or a workspace template.","required":["environment"],"properties":{"environment":{"$ref":"#/components/schemas/AssetId"},"compute":{"nullable":true,"type":"string","allOf":[{"$ref":"#/components/schemas/AssetId"}]},"datasources":{"type":"array","items":{"$ref":"#/components/schemas/AssetIdAndKind"}},"workloadVolumes":{"type":"array","items":{"type":"string"}}}},"AssetId":{"description":"Unique identifier of the asset.","type":"string","format":"uuid","minLength":1},"AssetIdAndKind":{"description":"Asset id and its kind.","required":["id","kind"],"properties":{"id":{"$ref":"#/components/schemas/AssetId"},"kind":{"$ref":"#/components/schemas/AssetKind"},"overrides":{"$ref":"#/components/schemas/DataSourceOverrides"}}},"AssetKind":{"description":"The kind of the asset.","type":"string","minLength":1,"enum":["compute","environment","accessKey","dockerRegistry","password","genericSecret","registry","s3","git","nfs","pvc","hostPath","workload-template","model","config-map","secret-volume"]},"DataSourceOverrides":{"description":"specific fields to override in the data source.","type":"object","nullable":true,"properties":{"containerPath":{"type":"string","minLength":1,"nullable":true}}},"SpecificRunParams":{"description":"Parameters which apply to a specific workload. They complement the information gathered from the assets comprising the workload.\n","allOf":[{"$ref":"#/components/schemas/SpecificRunParamsCommon"},{"$ref":"#/components/schemas/AllowOverQuota"},{"$ref":"#/components/schemas/SpecificRunAutoScaling"}],"nullable":true,"type":"object"},"SpecificRunParamsCommon":{"allOf":[{"$ref":"#/components/schemas/ContainerOverridable"},{"$ref":"#/components/schemas/CommonSecurityOverridable"},{"$ref":"#/components/schemas/EnvironmentVariablesField"},{"$ref":"#/components/schemas/ResourcesFlatFields"},{"$ref":"#/components/schemas/AdvancedFlatFields"},{"$ref":"#/components/schemas/AdvancedItemizedFields"},{"$ref":"#/components/schemas/SpecificRunConnections"}],"nullable":true,"type":"object"},"ContainerOverridable":{"description":"Container overrideable fields. In the context of assets,these are environment asset fields that can be overriden in the submit workload request.","properties":{"command":{"description":"A command to the server as the entry point of the container running the workspace.","type":"string","minLength":1,"nullable":true},"args":{"description":"Arguments to the command that the container running the workspace executes.","type":"string","minLength":1,"nullable":true}},"nullable":true,"type":"object"},"CommonSecurityOverridable":{"description":"Security overrideable fields. In the context of assets,these are environment asset fields that can be overriden in the submit workload request.","properties":{"runAsUid":{"description":"The user id to run the entrypoint of the container which executes the workspace. Default to the value specified in the environment asset `runAsUid` field (optional). Use only when the source uid/gid of the environment asset is not `fromTheImage`, and `overrideUidGidInWorkspace` is enabled.","type":"integer","format":"int64","nullable":true},"runAsGid":{"description":"The group id to run the entrypoint of the container which executes the workspace. Default to the value specified in the environment asset `runAsGid` field (optional). Use only when the source uid/gid of the environment asset is not `fromTheImage`, and `overrideUidGidInWorkspace` is enabled.","type":"integer","format":"int64","nullable":true},"supplementalGroups":{"description":"Comma separated list of groups that the user running the container belongs to, in addition to the group indicated by runAsGid. Use only when the source uid/gid of the environment asset is not `fromTheImage`, and `overrideUidGidInWorkspace` is enabled. Using an empty string implies reverting the supplementary groups of the image.","type":"string","nullable":true}},"nullable":true,"type":"object"},"EnvironmentVariablesField":{"properties":{"environmentVariables":{"$ref":"#/components/schemas/EnvironmentVariables2"}},"nullable":true,"type":"object"},"EnvironmentVariables2":{"description":"Set of environment variables to populate into the container running the workspace.","type":"array","items":{"$ref":"#/components/schemas/EnvironmentVariable2"},"nullable":true},"EnvironmentVariable2":{"description":"Details of an environment variable which is populated into the container.","properties":{"name":{"description":"The name of the environment variable. (mandatory)","type":"string","minLength":1,"nullable":true},"value":{"description":"The value of the environment variable. (mutually exclusive with secret)","type":"string","nullable":true},"secret":{"$ref":"#/components/schemas/EnvironmentVariableSecret"},"exclude":{"description":"Use 'true' in case the environment variable is defined in defaults of the policy, and you wish to exclude it from the workload.","type":"boolean","nullable":true}},"nullable":true,"type":"object"},"EnvironmentVariableSecret":{"description":"Details of the secret and key use to populated the environment variable. (mutually exclusive with value)","properties":{"name":{"description":"The name of the secret resource. (mandatory)","type":"string","minLength":1,"nullable":true},"key":{"description":"The key in the secret resource. (mandatory)","type":"string","minLength":1,"nullable":true}},"nullable":true,"type":"object"},"ResourcesFlatFields":{"description":"Resource parameters.","properties":{"nodeType":{"description":"Nodes (machines), or a group of nodes on which the workload will run. To use this feature, your Administrator will need to label nodes. For more information, see [Group Nodes](https://docs.run.ai/v2.19/admin/researcher-setup/limit-to-node-group). When using this flag with with Project-based affinity, it refines the list of allowable node groups set in the Project. For more information, see [Projects](https://docs.run.ai/admin/admin-ui-setup/project-setup).","type":"string","minLength":1,"nullable":true},"nodePools":{"description":"A prioritized list of node pools for the scheduler to run the workspace on. The scheduler will always try to use the first node pool before moving to the next one if the first is not available.","type":"array","items":{"type":"string"},"nullable":true},"podAffinity":{"$ref":"#/components/schemas/PodAffinity"}},"nullable":true,"type":"object"},"PodAffinity":{"description":"Pod affinity scheduling rules (e.g. co-locate this workload in the same node, zone, etc. as some other workloads).","type":"object","properties":{"type":{"$ref":"#/components/schemas/PodAffinityType"},"key":{"description":"The label key to use. (mandatory)","type":"string","nullable":true}},"nullable":true},"PodAffinityType":{"description":"The affinity type, required or preferred. (mandatory)","type":"string","enum":["Required","Preferred"],"nullable":true},"AdvancedFlatFields":{"properties":{"terminateAfterPreemption":{"description":"Indicates if the job should be terminated by the system after it has been preempted.","type":"boolean","nullable":true},"autoDeletionTimeAfterCompletionSeconds":{"description":"Specifies the duration after which a finished workload (completed or failed) will be automatically deleted. The default is 30 days.","format":"int64","type":"integer","nullable":true},"backoffLimit":{"description":"Specifies the number of retries before marking a workload as failed (not applicable to Inference workloads). The default value is 6.","format":"int64","type":"integer","nullable":true}},"nullable":true,"type":"object"},"AdvancedItemizedFields":{"allOf":[{"$ref":"#/components/schemas/AnnotationsField"},{"$ref":"#/components/schemas/LabelsField"},{"$ref":"#/components/schemas/TolerationsField"}],"nullable":true,"type":"object"},"AnnotationsField":{"properties":{"annotations":{"$ref":"#/components/schemas/Annotations"}},"nullable":true,"type":"object"},"Annotations":{"description":"Set of annotations to populate into the container running the workspace.","type":"array","items":{"$ref":"#/components/schemas/Annotation"},"nullable":true},"Annotation":{"description":"Annotation details to be populated into the container.","properties":{"name":{"description":"The name of the annotation (mandatory)","type":"string","minLength":1,"maxLength":63,"nullable":true},"value":{"description":"The value of the annotation.","type":"string","nullable":true},"exclude":{"description":"Use 'true' in case the annotation is defined in defaults of the policy, and you wish to exclude it from the workload.","type":"boolean","default":false,"nullable":true}},"nullable":true,"type":"object"},"LabelsField":{"properties":{"labels":{"$ref":"#/components/schemas/Labels"}},"nullable":true,"type":"object"},"Labels":{"description":"Set of labels to populate into the container running the workspace.","type":"array","items":{"$ref":"#/components/schemas/Label"},"nullable":true},"Label":{"description":"Label details to be populated into the container.","properties":{"name":{"description":"The name of the label (mandatory)","type":"string","minLength":1,"maxLength":63,"nullable":true},"value":{"description":"The value of the label.","type":"string","nullable":true},"exclude":{"description":"Use 'true' in case the label is defined in defaults of the policy, and you wish to exclude it from the workload.","type":"boolean","nullable":true}},"nullable":true,"type":"object"},"TolerationsField":{"properties":{"tolerations":{"$ref":"#/components/schemas/Tolerations"}},"nullable":true,"type":"object"},"Tolerations":{"description":"Set of tolerations to apply to the workload.","type":"array","items":{"$ref":"#/components/schemas/Toleration"},"nullable":true},"Toleration":{"description":"Toleration details.","properties":{"name":{"description":"The name of the toleration.","type":"string","minLength":1,"nullable":true},"operator":{"$ref":"#/components/schemas/TolerationOperator"},"key":{"description":"The taint key that the toleration applies to. (mandatory)","type":"string","nullable":true},"value":{"description":"The taint value the toleration matches to. Mandatory if operator is Exists, forbidden otherwise.","type":"string","nullable":true},"effect":{"$ref":"#/components/schemas/TolerationEffect"},"seconds":{"description":"The period of time the toleration tolerates the taint. Valid only if effect is NoExecute. taint.","type":"integer","minimum":1,"nullable":true},"exclude":{"description":"Use 'true' in case the label is defined in defaults of the policy, and you wish to exclude it from the workload.","type":"boolean","nullable":true}},"nullable":true,"type":"object"},"TolerationOperator":{"description":"A key's relationship to the value. Equal uses key and value. Exists is equivalent to wildcard for value, so that a workload can tolerate all taints of a particular category. (mandatory)","type":"string","enum":["Equal","Exists"],"nullable":true},"TolerationEffect":{"description":"The taint effect to match. (mandatory)","type":"string","enum":["NoSchedule","NoExecute","PreferNoSchedule","Any"],"nullable":true},"SpecificRunConnections":{"properties":{"connections":{"type":"array","items":{"$ref":"#/components/schemas/SpecificRunConnectionInfo"},"nullable":true}},"nullable":true,"type":"object"},"SpecificRunConnectionInfo":{"required":["connectionName"],"properties":{"name":{"type":"string","minLength":1,"description":"Unique identifier of the connection. Will be used to correlate between the information given here and the information provided for the connection in the environment asset."},"nodePort":{"description":"Port number of the host that will be connected with the container port. Required if and only if isCustomPort is set to true in the environment asset.","type":"integer","format":"int32","minimum":0,"maximum":65535,"nullable":true},"externalUrl":{"description":"URL to associated with the container port. Required if and only if isCustomExternalUrl is set to true in the environment asset.","type":"string","minLength":1,"nullable":true},"authorizedUsers":{"description":"Specifies the emails of those users that are allowed to access the connection. Note that authorizedUsers and authorizedGroups are mutually exclusive.","type":"array","items":{"type":"string"},"nullable":true},"authorizedGroups":{"description":"Specifies the names of those groups that are allowed to access the connection. Note that authorizedUsers and authorizedGroups are mutually exclusive.","type":"array","items":{"type":"string"},"nullable":true}}},"AllowOverQuota":{"properties":{"allowOverQuota":{"description":"Whether to allow the workload to exceed the quota of the project.","type":"boolean","nullable":true}}},"SpecificRunAutoScaling":{"properties":{"autoScaling":{"allOf":[{"$ref":"#/components/schemas/AutoScalingCommonFields"},{"$ref":"#/components/schemas/SpecificRunMetricFields"}],"nullable":true,"type":"object"}},"nullable":true,"type":"object"},"AutoScalingCommonFields":{"description":"Auto scaling common fields","properties":{"minReplicas":{"description":"The minimum number of replicas for autoscaling. Defaults to 1. Use 0 to allow scale-to-zero","type":"integer","format":"int32","minimum":0,"nullable":true},"maxReplicas":{"description":"The maximum number of replicas for autoscaling. Defaults to minReplicas, or to 1 if minReplicas is set to 0","type":"integer","format":"int32","minimum":1,"nullable":true},"scaleToZeroRetentionSeconds":{"description":"The minimum amount of time (in seconds) that the last replica will remain active after a scale-to-zero decision. Defaults to 0. Available only if minReplicas is set to 0","type":"integer","format":"int32","minimum":0,"maximum":3600,"nullable":true}},"nullable":true,"type":"object"},"SpecificRunMetricFields":{"properties":{"thresholdMetric":{"$ref":"#/components/schemas/AutoScalingMetric"},"thresholdValue":{"description":"The threshold value to use with the specified metric for autoscaling","type":"integer","format":"int32","nullable":true}},"type":"object","nullable":true},"AutoScalingMetric":{"description":"The metric to use for autoscaling. Mandatory if minReplicas < maxReplicas, except for the special case where minReplicas is set to 0 and maxReplicas is set to 1, as in this case autoscaling decisions are made according to network activity rather than metrics. Only the 'throughput' and 'concurrency' metrics support scale-to-zero","type":"string","enum":["throughput","concurrency","latency"],"nullable":true},"WorkloadTemplate":{"required":["meta","spec"],"properties":{"meta":{"$ref":"#/components/schemas/AssetMeta"},"spec":{"$ref":"#/components/schemas/SpecificRunInfoFields"}}},"AssetMeta":{"allOf":[{"$ref":"#/components/schemas/AssetUpdatableFields"},{"$ref":"#/components/schemas/AssetCreationFields"},{"$ref":"#/components/schemas/AssetReadOnlyFields"}]},"AssetCreationFields":{"type":"object","required":["scope"],"properties":{"scope":{"$ref":"#/components/schemas/Scope"},"clusterId":{"$ref":"#/components/schemas/ClusterIdOptional"},"departmentId":{"description":"The id of the department. Must be specified for department scoped assets.","type":"string","nullable":true,"minLength":1},"projectId":{"description":"The id of the project. Must be specified for project scoped assets.","type":"integer","format":"int32","nullable":true},"autoDelete":{"description":"The asset will be deleted automatically. This is intended for internal use.","type":"boolean","nullable":true,"default":false},"workloadSupportedTypes":{"$ref":"#/components/schemas/WorkloadSupportedTypes"}}},"Scope":{"description":"The scope in which an asset can be used. The highest scope, system, is intended for internal purposes only.","type":"string","minLength":1,"enum":["system","tenant","cluster","department","project"]},"ClusterIdOptional":{"description":"The id of the cluster.","type":"string","format":"uuid","minLength":1,"nullable":true},"WorkloadSupportedTypes":{"properties":{"inference":{"description":"Is inference a supported workload type.","type":"boolean","nullable":true},"workspace":{"description":"Is workspace a supported workload type.","type":"boolean","nullable":true},"training":{"description":"Is training a supported workload type.","type":"boolean","nullable":true},"distributed":{"description":"Is distributed a supported workload type.","type":"boolean","nullable":true},"distFramework":{"description":"The distributed training framework used in the workload.","type":"string","enum":["MPI","PyTorch","TF","XGBoost"],"nullable":true}},"nullable":true,"type":"object"},"AssetReadOnlyFields":{"required":["id","kind","createdBy","createdAt","updatedBy","updatedAt"],"properties":{"id":{"$ref":"#/components/schemas/AssetId"},"kind":{"$ref":"#/components/schemas/AssetKind"},"tenantId":{"description":"The id of the tenant.","type":"integer","format":"int32","nullable":true},"createdBy":{"description":"The user who created the asset.","type":"string","minLength":1},"createdAt":{"description":"The time at which the asset were created","type":"string","minLength":1,"format":"date-time"},"updatedBy":{"description":"The user who updated the asset.","type":"string","minLength":1},"updatedAt":{"description":"The time at which the asset has been updated","type":"string","minLength":1,"format":"date-time"},"projectName":{"description":"The name of the project that the asset is associated with, for project scoped assets.","type":"string","minLength":1,"nullable":true}},"type":"object"},"SpecificRunInfoFields":{"description":"Information about the set of assets which comprises a workspace, training or template, and an optional set of specific run parameters.","required":["assets"],"properties":{"assets":{"$ref":"#/components/schemas/AssetsRef"},"specificEnv":{"$ref":"#/components/schemas/SpecificRunParams"},"distributed":{"$ref":"#/components/schemas/InfoDistributed"}}},"AssetsRef":{"description":"Reference information about a set of assets. used to describe - assets comprising a workspace - assets comprising a workspace template - assets that use other assets (e.g. s3 asset which uses access key).","required":["environment"],"properties":{"environment":{"description":"environment asset.","allOf":[{"$ref":"#/components/schemas/EnvironmentAssetRef"}]},"compute":{"$ref":"#/components/schemas/AssetsRefCompute"},"datasources":{"type":"array","items":{"$ref":"#/components/schemas/DatasourceRef"}},"workloadVolumes":{"type":"array","items":{"type":"string"}}}},"EnvironmentAssetRef":{"description":"Reference information about environment asset.","required":["id","name"],"properties":{"id":{"$ref":"#/components/schemas/AssetId"},"name":{"$ref":"#/components/schemas/AssetName"},"toolTypes":{"description":"the type of tools as defined in the connections of the environment asset.","type":"array","nullable":true,"items":{"$ref":"#/components/schemas/ToolType"}}}},"ToolType":{"description":"Super set of Internal and External tool types.","type":"string","minLength":1,"enum":["jupyter-notebook","pycharm","visual-studio-code","tensorboard","rstudio","mlflow","custom","wandb","matlab","comet","chatbot-ui"]},"AssetsRefCompute":{"allOf":[{"$ref":"#/components/schemas/AssetRef"}],"nullable":true,"type":"object"},"AssetRef":{"description":"Reference information about an asset.","required":["id","name"],"properties":{"id":{"$ref":"#/components/schemas/AssetId"},"name":{"$ref":"#/components/schemas/AssetName"}}},"DatasourceRef":{"description":"Reference information about a datasource asset.","required":["id","name","kind"],"properties":{"id":{"$ref":"#/components/schemas/AssetId"},"name":{"$ref":"#/components/schemas/AssetName"},"kind":{"$ref":"#/components/schemas/AssetKind"},"overrides":{"$ref":"#/components/schemas/DataSourceOverrides"}}},"InfoDistributed":{"description":"Parameters which apply to distributed training.\n","allOf":[{"properties":{"numWorkers":{"type":"integer"},"noMaster":{"type":"boolean","nullable":true},"distFramework":{"$ref":"#/components/schemas/DistributedFramework"},"master":{"$ref":"#/components/schemas/InfoDistMaster"}}}],"nullable":true,"type":"object"},"DistributedFramework":{"description":"The distributed training framework used in the workload.","type":"string","enum":["MPI","PyTorch","TF","XGBoost"],"nullable":true},"InfoDistMaster":{"description":"Parameters which apply to the master in a distributed training.\n","nullable":true,"type":"object","properties":{"assets":{"$ref":"#/components/schemas/AssetsRefOptional"},"specificEnv":{"$ref":"#/components/schemas/SpecificRunParams"}}},"AssetsRefOptional":{"allOf":[{"$ref":"#/components/schemas/AssetsRef"}],"type":"object","nullable":true},"Error":{"required":["code","message"],"properties":{"code":{"type":"integer","minimum":100,"maximum":599},"message":{"type":"string"},"details":{"type":"string"}}}},"responses":{"400BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409Conflict":{"description":"The specified resource already exists","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503ServiceUnavailable":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/v1/asset/workload-template/{AssetId}":{"put":{"summary":"Update a template.","description":"Use to update the details of a template by id.","operationId":"update_template","deprecated":true,"tags":["Template"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkloadTemplateUpdateRequest"}}}},"responses":{"202":{"description":"Request accepted successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkloadTemplate"}}}},"400":{"$ref":"#/components/responses/400BadRequest"},"401":{"$ref":"#/components/responses/401Unauthorized"},"403":{"$ref":"#/components/responses/403Forbidden"},"409":{"$ref":"#/components/responses/409Conflict"},"503":{"$ref":"#/components/responses/503ServiceUnavailable"}}}}}}
```

## Delete a template.

> Use to delete a template by id.

```json
{"openapi":"3.0.3","info":{"title":"Runai API","version":"2.19"},"tags":[{"name":"Template","description":"Templates are a pre-set configuration used to quickly configure and submit workloads using existing assets."}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"responses":{"202Accepted":{"description":"Accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpResponse"}}}},"401Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404NotFound":{"description":"The specified resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503ServiceUnavailable":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"HttpResponse":{"required":["code","message"],"properties":{"code":{"type":"integer","minimum":100,"maximum":599},"message":{"type":"string"}}},"Error":{"required":["code","message"],"properties":{"code":{"type":"integer","minimum":100,"maximum":599},"message":{"type":"string"},"details":{"type":"string"}}}}},"paths":{"/api/v1/asset/workload-template/{AssetId}":{"delete":{"summary":"Delete a template.","description":"Use to delete a template by id.","operationId":"delete_template_by_id","deprecated":true,"tags":["Template"],"responses":{"202":{"$ref":"#/components/responses/202Accepted"},"401":{"$ref":"#/components/responses/401Unauthorized"},"403":{"$ref":"#/components/responses/403Forbidden"},"404":{"$ref":"#/components/responses/404NotFound"},"503":{"$ref":"#/components/responses/503ServiceUnavailable"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://run-ai-docs.nvidia.com/api/2.19/workload-assets/template.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
