Update the configuration of a specific template. The templateID stays unchanged, version increments after each successful update, and a new build is submitted.
Prerequisites
Configure the endpoint and authentication first. See API overview and authentication.
Endpoint
PUT /templates/{templateCode}
Update the configuration of a specific template. This operation is an Alibaba Cloud Model Studio extension and is not declared fully compatible with E2B Update Template v2. templateID stays unchanged before and after the update, and version increments after each successful update. createdAt is the time the template was first created, and updatedAt is the time of this update. A successful update means a new build has been submitted; whether you can create instances depends on the build status.
Path parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
templateCode | Yes | string | Unique template code, that is, the templateID returned by the create template operation. |
Request body
| Field | Required | Type | Description |
|---|---|---|---|
name | No | string | Template name. The existing name is kept when omitted. |
cpuCount | No | integer | Number of vCPUs. Must be passed together with memoryMB. The existing specification is kept when omitted. |
memoryMB | No | integer | Memory size in MB. Must be passed together with cpuCount. The existing specification is kept when omitted. |
fromImage | No | string | Base image. The existing image is kept when omitted. |
imageName | No | string | Image display name. The existing display name is kept when omitted. |
mntConfig | No | array<object> | File mount configuration. File IDs are re-validated when passed. Sub-fields: originFileName (string, optional, original file name), originFileId (string, required, ID of a file that exists in the current workspace), mountPath (string, required, mount path inside the instance). |
networkConfig | No | object | Network rules, same as in create template. Sub-fields: allowOut (array<string>, egress allowlist, supports IPv4, IPv6, CIDR, and domain names), denyOut (array<string>, egress denylist, supports IPv4, IPv6, and CIDR only — domain names are not supported). |
envConfig | No | object | Replaces the environment variables with the key-value pairs passed in this request. Values are strings. |
autoPauseTime | No | integer | Auto-pause time on expiry, in seconds. Valid range: [300,604800]. |
maxRunningTimeout | No | integer | Maximum running time in seconds. Valid range: [300,604800]. |
description | No | string | Template description. |
Request example
BASE_URL is https://{workspace_id}.cn-beijing.maas.aliyuncs.com/api/v1/agentstudio/sandbox, and BAILIAN_API_KEY is your Alibaba Cloud Model Studio API key.
Response example
Returns 200 with the updated template object. buildStatus may be building, which means a new build has been submitted.
Response fields
| Field | Type | Description |
|---|---|---|
templateID | string | Template ID, unchanged before and after the update. |
templateName | string | Template name. |
cpuCount | integer | Number of vCPUs. |
memoryMB | integer | Memory size in MB. |
buildID | string | Build ID of the new version, used to query the build status. |
buildStatus | string | Build status, which may be building. |
version | integer | Template version number, incremented after each successful update. |
createdAt | string | Time the template was first created, in date-time format. |
updatedAt | string | Time of this update, in date-time format. |