> For the complete documentation index, see [llms.txt](https://docs.higiocloud.vn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.higiocloud.vn/hi-gio-user-guide-vn/compute/4.-hi-gio-api/api-bat-tat-nguon-vm.md).

# API bật/tắt nguồn VM

## <mark style="color:green;">**Tổng quan**</mark>

Trong tài liệu này, bạn sẽ tìm thấy thông tin chi tiết về cách chuẩn bị thông tin, lấy trạng thái của VM, và thay đổi trạng thái của VM.

## <mark style="color:green;">Quy trình</mark>

{% stepper %}
{% step %}
**Bước 1**: Chuẩn bị thông tin

Đăng nhập vào IAM portal -> vCD portal: thu thập thông tin

* **{{vcd\_url}}**<br>

  <figure><img src="https://content.gitbook.com/content/dOZ82gj0wvhbAUlxBHpj/blobs/Wp5uGFUkRFcxUiEDe6sg/image.png" alt=""><figcaption></figcaption></figure>
* **{{vm-uuid}}:** select VM -> take a look vm uuid on url<br>

  <figure><img src="https://content.gitbook.com/content/dOZ82gj0wvhbAUlxBHpj/blobs/X80VoZ5G3NePAMMo1CXm/image.png" alt=""><figcaption></figcaption></figure>
* **{{Bearer Token}}:** Vui lòng tham khảo tài liệu “[API đăng nhập bằng Token](https://docs.higiocloud.vn/hi-gio-user-guide-vn/compute/4.-hi-gio-api/api-dang-nhap-bang-token.md)”
  {% endstep %}

{% step %}
**Bước 2:** Lấy trạng thái của VM

* GET https\://{{vcd\_url}}/api/vApp/{{vm\_uuid}}
* Authorization: {{Bearer Token }}
* Headers:

\- ‘Accept’: \*/\*;version=37.2<br>

<figure><img src="https://content.gitbook.com/content/dOZ82gj0wvhbAUlxBHpj/blobs/D4RlA2UyJWSeBPnTYTqt/image.png" alt=""><figcaption></figcaption></figure>

* SEND request.

Kiểm tra trạng thái VM trên dòng thứ 3 của Response Body. Nếu Link rel="power:powerOff", VM đang bật; nếu không, VM đang tắt.<br>

<figure><img src="https://content.gitbook.com/content/dOZ82gj0wvhbAUlxBHpj/blobs/dmVLs2UGhCbrxBJvIlkX/image.png" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Bước 3:** Thay đổi trạng thái của VM

* POST https\://{{vcd\_url}}/api/vApp/{{vm\_uuid}}/power/action/{{powerOn/powerOff}}
* Authorization: {{Bearer Token}}
* Headers:

\- ‘Accept’: \*/\*;version=37.2<br>

<figure><img src="https://content.gitbook.com/content/dOZ82gj0wvhbAUlxBHpj/blobs/xPz2VMsZjA1qFNPJCyyr/image.png" alt=""><figcaption></figcaption></figure>

* SEND request.
  {% endstep %}

{% step %}
**Bước 4**: Xác minh

* **Lấy thông tin trạng thái của VM**

GET https\://{{vcd\_url}}/api/vApp/{{vm-uuid}}

* **Kiểm tra trên vCD portal**

Đăng nhập IAM -> vCD portal -> chọn VM
{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.higiocloud.vn/hi-gio-user-guide-vn/compute/4.-hi-gio-api/api-bat-tat-nguon-vm.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
