# Retrieve list of GPUs in a VM

This topic explains how to retrieve a list of all Graphics Processing Unit (GPU) cards that are currently attached to a specific server within a Virtual Data Center (VDC). This API request is useful for auditing the resources of a server or verifying a successful GPU attachment.

## Endpoint

Use the following endpoint for templates: `https://api.ionos.com/cloudapi/v6/datacenters/{datacenterId}/servers/{serverId}/gpus?depth=3`

## Request

{% hint style="info" %}
**Note:** The following request contains sample values. Remember to replace them with the relevant information.
{% endhint %}

```bash
curl --location \
--request GET 'https://api.ionos.com/cloudapi/v6/datacenters/{datacenterId}/servers/{serverId}/gpus' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJraWQiO' \
--header 'Content-Type: application/json'
```

{% tabs %}
{% tab title="Header Parameters" %}
To make authenticated requests to the API, the following fields are mandatory in the request header:

| **Name**        | **Type** | **Description**             |
| --------------- | -------- | --------------------------- |
| `Authorization` | string   | The bearer token.           |
| `Content-Type`  | string   | Must be `application/json`. |
| {% endtab %}    |          |                             |

{% tab title="Path Parameters" %}
To make authenticated requests to the API, the following fields are mandatory in the request header:

| **Name**       | **Type** | **Description**                                    |
| -------------- | -------- | -------------------------------------------------- |
| `v6`           | string   | The API version.                                   |
| `datacenterId` | string   | The ID of the Data Center where the VM is located. |
| `serverId`     | string   | The ID of the server, that is, the Cloud GPU VM.   |
| {% endtab %}   |          |                                                    |

{% tab title="Query Parameters" %}
You can refine your request by adding the optional query parameter `depth`.

| **Name**      | **Type** | **Description**                              |
| ------------- | -------- | -------------------------------------------- |
| `depth`       | integer  | Template detail depth. Default value is `0`. |
| {% endtab %}  |          |                                              |
| {% endtabs %} |          |                                              |

## Response

A successful request returns a **200** status code and a JSON collection containing a list of GPU resources attached to the specified server.

```json
		{
			"id": "f58b1946-c83f-4e70-adcb-2377a232047e",
			"type": "gpu",
			"href": "https://api.ionos.com/cloudapi/v6/datacenters/adc847be-f4f9-4ccc-83f3-5a320d68de39/servers/569738de-a605-40c5-8611-ccc625096a2c/gpus/f58b1946-c83f-4e70-adcb-2377a232047e",
			"metadata": {
		        "etag": "45480eb3fbfc31f1d916c1eaa4abdcc3",
                "createdDate": "2015-12-04T14:34:09.809Z",
                "createdBy": "john.doe@example.com",
                "createdByUserId": "7ebaf38d-1234-5c8b-dc1c-c68089f684a0",
		        "lastModifiedDate": "2015-12-04T14:34:09.809Z",
                "lastModifiedBy": "john.doe@example.com",
                "lastModifiedByUserId": "7ebaf38d-1234-5c8b-dc1c-c68089f684a0",
   	            "state": "AVAILABLE"
			},
			"properties": {
				"name": "GPU NVIDIA Corporation GH100 [H200 NVL] 1",
				"vendor": "NVIDIA Corporation",
				"type": "passthrough",
				"model": "GH100 [H200 NVL]"
			}
     }  

```


---

# 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.ionos.com/cloud/compute-services/compute-engine/cloud-gpu-vm/api-how-tos/retrieve-cloud-gpu-vm.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.
