# API creates VM from Template

## <mark style="color:green;">Overview</mark>

* In this manual, you will find detailed information on how to prepare & create a VM from the template.
* This API creates a VM with the default name (VM name of template), default network "VM Network," and default compute and storage.

## <mark style="color:green;">Procedure</mark>

{% stepper %}
{% step %}
**Step 1: Preparation**

&#x20;Log in to IAM portal -> vCD portal: collect the information

**{{vcd\_url}}**

<figure><img src="/files/NrunUskW6Ker0Q6vn1Ju" alt=""><figcaption></figcaption></figure>

\
\&#xNAN;**{{vdc\_uuid}}:** Login vCD portal -> select VDC-> take a look and note **vdc\_uuid** on the URL

<div align="left"><figure><img src="/files/kWf2bjEbjbZT2hiIzzsk" alt="" width="563"><figcaption></figcaption></figure></div>

**{{network\_uuid}}:** On the vCD portal -> Networking -> Networks -> New

{% hint style="warning" %}
**Note that the network name must be “VM Network”**
{% endhint %}

<figure><img src="/files/Nc9TEjdH9JsFpDYIVmKO" alt=""><figcaption></figcaption></figure>

Select the “VM Network” -> take a look and note the network uuid on the url

<figure><img src="/files/0E2HaNcqI3WdFIkYkEGr" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/mR7tPffZZdzPkn8KV8HW" alt=""><figcaption></figcaption></figure>

&#x20; **{{vappTemplate\_uuid}}:** On the vCD portal -> Content Hub -> Catalogs ->HIGIO Shared Catalogs

<figure><img src="/files/GCdlOjyqIdgfdIyp48pH" alt=""><figcaption></figcaption></figure>

-> vApp Templates -> select the template that you want to create VM -> take a look the vappTemplate\_uuid on the url

<figure><img src="/files/y2toCoyLtkZS6c164c7s" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/yeK45rtS3Y6AUHgEiecG" alt=""><figcaption></figcaption></figure>

&#x20;**{{Bearer Token}}**: Please follow **“**[**Api token login**](/compute/4.-hi-gio-api/api-token-login.md)**”** document
{% endstep %}

{% step %}
**Step 2: Create VM from template**

**Postman:**

POST https\://{{vcd\_url}}/api/vdc

/{{vdc\_uuid}}/action/instantiateVAppTemplate

Authorization: {{Bearer Token }}

Headers:

\- 'Accept: \*/\*;version=37.2

\- ‘Content-type’: application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml; charset=ISO-8859-1

<figure><img src="/files/JM7pTH2c3uO4Vny7lRbJ" alt=""><figcaption></figcaption></figure>

Body: {{select raw, copy, paste and edit the code below}}

```
<?xml version="1.0" encoding="UTF-8"?>

<vcloud:InstantiateVAppTemplateParams

    xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"

    xmlns:vcloud="http://www.vmware.com/vcloud/v1.5"

    deploy="false"

    name="your vapp name"

    powerOn="false">

    <vcloud:Description>VApp Description</vcloud:Description>

    <vcloud:InstantiationParams>

        <vcloud:NetworkConfigSection>

            <ovf:Info>NetInfo</ovf:Info>

            <vcloud:NetworkConfig networkName="VM Network">

                <vcloud:Configuration>

                    <vcloud:ParentNetwork

                        href="https:// {{vcd_url}}/api/network/{{network_uuid}}"

                        name="VM Network"

                        type="application/vnd.vmware.vcloud.network+xml"/>

                    <vcloud:FenceMode>bridged</vcloud:FenceMode>

                </vcloud:Configuration>

            </vcloud:NetworkConfig>

        </vcloud:NetworkConfigSection>

    </vcloud:InstantiationParams>

    <vcloud:Source

        href="https://{{vcd_url}}/api/vAppTemplate/{{vappTemplate_uuid}}"

        name="HIGIO"

        type="application/vnd.vmware.vcloud.vAppTemplate+xml"/>

</vcloud:InstantiateVAppTemplateParams>
```

<figure><img src="/files/S4tcdYHU6Sb0MNtnZ3R9" alt=""><figcaption></figcaption></figure>

**SEND request.**
{% endstep %}

{% step %}

### Step 3: Verify

On the vCD -> Data Center -> select your Virtual Data Center ->vApps -> check your vApp and VM.

{% endstep %}
{% endstepper %}


---

# 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://docs.higiocloud.vn/compute/4.-hi-gio-api/api-creates-vm-from-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.
