Updated on 2025-09-16 GMT+08:00

Listing Template Versions

Function

This API is used to filter and query the launch template versions based on the request conditions. You can filter templates by image_id and flavor_id.

URI

GET /v3/{project_id}/launch-template-versions

For details, see Table 1.
Table 1 Path parameters

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

For details about how to obtain the project ID, see Obtaining a Project ID.

Table 2 Request parameters

Parameter

Mandatory

Type

Description

limit

No

Integer

Specifies the maximum number of templates that can be returned. A maximum of 100 templates can be returned.

marker

No

String

Specifies the template ID to which the marker corresponds. The query will start from the next ID.

This parameter must be used together with the parameter limit.

launch_template_id

No

String

Specifies the template ID.

image_id

No

String

Specifies the image ID of the template.

flavor_id

No

String

Specifies the flavor ID of the template.

version

No

Array of Integers

Specifies the template version.

Request

None

Response

Table 3 describes the response parameters.

Table 3 Response parameters

Parameter

Type

Description

launch_template_versions

Array of Objects

Specifies the template version. For details, see Table 4.

page_info

Object

Specifies the page information. For details, see Table 18.

Table 4 launch_template_version field description

Parameter

Type

Description

template_data

Object

Specifies the request for creating an ECS. For details, see Table 5.

version_number

Integer

Specifies the template version.

version_id

String

Specifies the template version ID.

version_description

String

Specifies the template version description.

created_at

String

Specifies the time when the template version was created.

launch_template_id

String

Specifies the template ID.

Table 5 template_data field description

Parameter

Type

Description

flavor_id

String

Specifies the flavor ID of the ECS created based on the template.

name

String

Specifies the template name.

description

String

Specifies the template description.

availability_zone_id

String

Specifies the AZ of the template.

enterprise_project_id

String

Specifies the enterprise project ID of the template.

auto_recovery

Boolean

Enables auto-recovery.

os_profile

Object

Specifies the OS attributes. For details, see Table 6.

security_group_ids

Array of strings

Specifies the security group ID list. This parameter applies to all network interfaces.

network_interfaces

Array of Objects

Specifies the network interfaces. For details, see Table 7.

block_device_mappings

Array of Objects

Specifies the BDM mounting information, which is subject to the flavor restrictions. For details, see Table 9.

market_options

Object

Specifies the billing information. For details, see Table 11.

internet_access

Object

Specifies the public network access. For details, see Table 13.

metadata

String

Specifies the metadata.

tag_options

Object

Specifies VM tags. Currently, only VMs can be tagged. In the future, associated resources such as volumes can be tagged, too. For details, see Table 16.

Table 6 os_profile field description

Parameter

Type

Description

key_name

String

Specifies the key name.

user_data

String

Specifies the custom user data to be injected into the instance during instance creation. Text and text files can be injected.

iam_agency_name

String

Specifies the agency name.

enable_monitoring_service

Boolean

Enables HSS.

Table 7 network_interfaces field description

Parameter

Type

Description

virsubnet_id

String

Specifies the subnet ID.

attachment

Object

Specifies the network interface details. For details, see Table 8.

Table 8 attachment field description

Parameter

Type

Description

device_index

Integer

Specifies the loading sequence. The value 0 indicates the primary network interface.

Table 9 block_device_mappings field description

Parameter

Type

Description

source_id

String

Specifies the data source type of the ECS volume.

source_type

String

Specifies the source type of the volume device.

encrypted

Boolean

Encrypted or not.

cmk_id

String

Specifies the key ID.

volume_type

String

Specifies the volume type.

volume_size

Integer

Specifies the volume size.

attachment

Object

Specifies the disk interface. For details, see Table 10.

Table 10 attachment field description

Parameter

Type

Description

boot_index

Integer

Specifies the loading sequence. The value 0 indicates the system disk.

Table 11 market_options field description

Parameter

Type

Description

market_type

String

Specifies the billing mode.

spot_options

Object

Specifies spot instance parameters. For details, see Table 12.

Table 12 spot_options field description

Parameter

Type

Description

spot_price

Number

Specifies the highest price per hour you are willing to pay for a spot ECS.

block_duration_minutes

Integer

Specifies the predefined duration of the spot ECS.

instance_interruption_behavior

String

Specifies the spot ECS interruption policy, which can only be set to immediate currently.

Table 13 internet_access field description

Parameter

Type

Description

publicip

Object

Specifies the public network access. For details, see Table 14.

Table 14 publicip field description

Parameter

Type

Description

publicip_type

String

Specifies the EIP type.

charging_mode

String

Specifies the EIP billing mode.

bandwidth

Object

Specifies the EIP bandwidth. For details, see Table 15.

Table 15 bandwidth field description

Parameter

Type

Description

share_type

String

Specifies the bandwidth type.

size

Integer

Specifies the bandwidth size.

charge_mode

String

Specifies the billing mode.

id

String

Specifies the bandwidth ID. You can use an existing shared bandwidth when applying for an EIP for the bandwidth of type WHOLE.

Table 16 tag_options field description

Parameter

Type

Description

tags

Array of Objects

Specifies tags. For details, see Table 17.

Table 17 tags field description

Parameter

Type

Description

key

String

Specifies the tag key.

value

String

Specifies the tag value.

Table 18 page_info parameters

Parameter

Type

Description

next_marker

String

Specifies the start index ID of the next page.

previous_marker

String

Specifies the start index ID of the previous page.

Example Request

List template versions.

GET https://{endpoint}/v3/{project_id}/launch-template-versions

Example Response

{
  "launch_template_versions": [
    {
      "template_data": {
        "flavor_id": "c1.2xlarge.2",
        "name": "new-server",
        "description": "test server",
        "availability_zone_id": "az1.dc1",
        "enterprise_project_id": "e6b99563-xxxx-xxxx-xxxx-1820d4fd2a67",
        "auto_recovery": false,
        "os_profile": {
          "key_name": "new-key",
          "user_data": "XXXXXXXXXXXXXXXX",
          "iam_agency_name": "new-agency",
          "enable_monitoring_service": false
        },
        "security_group_ids": [
          "e6b99563-xxxx-xxxx-xxxx-1820d4fd2a67"
        ],
        "network_interfaces": [
          {
            "virsubnet_id": "e6b99563-xxxx-xxxx-xxxx-1820d4fd2a67",
            "attachment": {
              "device_index": 0
            }
          }
        ],
        "block_device_mappings": [
          {
            "source_id": "e6b99563-xxxx-xxxx-xxxx-1820d4fd2a67",
            "source_type": "image",
            "encrypted": false,
            "cmk_id": "e6b99563-xxxx-xxxx-xxxx-1820d4fd2a67",
            "volume_type": "SATA",
            "volume_size": 40,
            "attachment": {
              "boot_index": 0
            }
          }
        ],
        "market_options": {
          "market_type": "postpaid",
          "spot_options": {
            "spot_price": 3.5,
            "block_duration_minutes": 60,
            "instance_interruption_behavior": "immediate"
          }
        },
        "internet_access": {
          "publicip": {
            "publicip_type": "5_bgp",
            "charging_mode": "postPaid",
            "bandwidth": {
              "share_type": "PER",
              "size": 2,
              "charge_mode": "traffic",
              "id": "e6b99563-xxxx-xxxx-xxxx-1820d4fd2a67"
            }
          }
        },
        "metadata": {
          "additionalProp1": "string",
          "additionalProp2": "string",
          "additionalProp3": "string"
        },
        "tag_options": [
          {
            "tags": [
              {
                "key": "tag-key",
                "value": "tag-value"
              }
            ]
          }
        ]
      },
      "version_number": 2,
      "version_id": "e6b99563-xxxx-xxxx-xxxx-1820d4fd2a67",
      "version_description": "this template version is used for XXXXXX",
      "created_at": "XXXXX-XX-XX",
      "launch_template_id": "e6b99563-xxxx-xxxx-xxxx-1820d4fd2a67"
    }
  ],
  "page_info": {
    "next_marker": "string"
  }
}

Error Codes

See Error Codes.