> This page is for Self-Hosted, version v3.0 (default).
> For other versions, use one of these documentation indexes:
> - v3.0 (default): https://docs.nvidia.com/run-ai/self-hosted/v3.0/llms.txt
> - v2.26: https://docs.nvidia.com/run-ai/self-hosted/v2.26/llms.txt
> - v2.25: https://docs.nvidia.com/run-ai/self-hosted/v2.25/llms.txt
> - v2.24: https://docs.nvidia.com/run-ai/self-hosted/v2.24/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/run-ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/run-ai/_mcp/server.

# Get pod metrics data.

GET http://localhost:8080/api/v1/workloads/{workloadId}/pods/{podId}/metrics

Retrieve pod's metrics data for use in analysis applications.

Reference: https://docs.nvidia.com/run-ai/self-hosted/reference/rest-api/endpoints/workloads/pods/get-workload-pod-metrics

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication

## Request

### Path parameters

- `workloadId` (string, required) — The Universally Unique Identifier (UUID) of the workload.
- `podId` (string, required) — The requested pod id.

### Query parameters

- `metricType` (list of enum, required) — Specify which metric data to request. Advanced GPU metrics are only supported if the 'Advanced GPU Metrics' feature flag in the settings is enabled.
  - Allowed values: `GPU_UTILIZATION_PER_GPU`, `GPU_UTILIZATION`, `GPU_MEMORY_USAGE_BYTES_PER_GPU`, `GPU_MEMORY_USAGE_BYTES`, `CPU_USAGE_CORES`, `CPU_MEMORY_USAGE_BYTES`, `GPU_GRAPHICS_ENGINE_ACTIVITY_PER_GPU`, `GPU_SM_ACTIVITY_PER_GPU`, `GPU_SM_OCCUPANCY_PER_GPU`, `GPU_TENSOR_ACTIVITY_PER_GPU`, `GPU_FP64_ENGINE_ACTIVITY_PER_GPU`, `GPU_FP32_ENGINE_ACTIVITY_PER_GPU`, `GPU_FP16_ENGINE_ACTIVITY_PER_GPU`, `GPU_MEMORY_BANDWIDTH_UTILIZATION_PER_GPU`, `GPU_NVLINK_TRANSMITTED_BANDWIDTH_PER_GPU`, `GPU_NVLINK_RECEIVED_BANDWIDTH_PER_GPU`, `GPU_PCIE_TRANSMITTED_BANDWIDTH_PER_GPU`, `GPU_PCIE_RECEIVED_BANDWIDTH_PER_GPU`, `GPU_SWAP_MEMORY_BYTES_PER_GPU`, `NIM_NUM_REQUESTS_RUNNING`, `NIM_NUM_REQUESTS_WAITING`, `NIM_NUM_REQUEST_MAX`, `NIM_REQUEST_SUCCESS_TOTAL`, `NIM_REQUEST_FAILURE_TOTAL`, `NIM_GPU_CACHE_USAGE_PERC`, `NIM_TIME_TO_FIRST_TOKEN_SECONDS`, `NIM_E2E_REQUEST_LATENCY_SECONDS`, `NIM_TIME_TO_FIRST_TOKEN_SECONDS_PERCENTILES`, `NIM_E2E_REQUEST_LATENCY_SECONDS_PERCENTILES`, `VLLM_NUM_REQUESTS_RUNNING`, `VLLM_NUM_REQUESTS_WAITING`, `VLLM_REQUEST_SUCCESS`, `VLLM_REQUEST_SUCCESS_RATE`, `VLLM_KV_CACHE_USAGE_PERC`, `VLLM_PROMPT_TOKENS_PER_SECOND`, `VLLM_GENERATION_TOKENS_PER_SECOND`, `VLLM_TIME_TO_FIRST_TOKEN_SECONDS`, `VLLM_E2E_REQUEST_LATENCY_SECONDS`, `VLLM_TIME_TO_FIRST_TOKEN_SECONDS_PERCENTILES`, `VLLM_E2E_REQUEST_LATENCY_SECONDS_PERCENTILES`, `VLLM_REQUEST_QUEUE_TIME_SECONDS_PERCENTILES`, `VLLM_REQUEST_PREFILL_TIME_SECONDS_PERCENTILES`, `VLLM_REQUEST_DECODE_TIME_SECONDS_PERCENTILES`, `VLLM_INTER_TOKEN_LATENCY_SECONDS_PERCENTILES`, `NVLINK_BANDWIDTH_TOTAL`, `NVLINK_BANDWIDTH_TOTAL_PER_GPU`
- `start` (datetime, required) — Start date of time range to fetch data in ISO 8601 timestamp format.
- `end` (datetime, required) — End date of time range to fetch data in ISO 8601 timestamp format.
- `numberOfSamples` (integer, optional, default: 20) — The number of samples to take in the specified time range.

## Response

### 200

Executed successfully.

- `measurements` (list of MeasurementResponse, required)
- `histogram` (list of HistogramSeries, optional, nullable)

### 207

Partial success.

- `measurements` (list of MeasurementResponse, required)
- `histogram` (list of HistogramSeries, optional, nullable)

## Errors

### 400 Bad Request Error

Bad request.

- `code` (integer, required)
- `message` (string, required)
- `details` (string, optional)

### 401 Unauthorized Error

Unauthorized

- `code` (integer, required)
- `message` (string, required)
- `details` (string, optional)

### 403 Forbidden Error

Forbidden

- `code` (integer, required)
- `message` (string, required)
- `details` (string, optional)

### 404 Not Found Error

The specified resource was not found

- `code` (integer, required)
- `message` (string, required)
- `details` (string, optional)

### 500 Internal Server Error

unexpected error

- `code` (integer, required)
- `message` (string, required)
- `details` (string, optional)

### 503 Service Unavailable Error

unexpected error

- `code` (integer, required)
- `message` (string, required)
- `details` (string, optional)

## Types

### MeasurementResponse

- `type` (string, required) — specifies what data returned
- `values` (list of MeasurementResponseValuesItems, required, nullable)
- `labels` (map from string to string, optional, nullable) — labels of the metric measurement

### HistogramSeries

- `type` (string, required) — specifies what data returned
- `values` (list of HistogramValue, required)

### MeasurementResponseValuesItems

- `value` (string, required)
- `timestamp` (datetime, required, nullable)

### HistogramValue

- `timestamp` (datetime, required, nullable)
- `data` (map from string to string, required)

## Examples

### Example 1

**Response**

```json
{
  "measurements": [
    {
      "type": "ALLOCATED_GPU",
      "values": [
        {
          "value": "85",
          "timestamp": "2024-12-20T14:30:00Z"
        },
        {
          "value": "92",
          "timestamp": "2024-12-20T14:30:30Z"
        },
        {
          "value": "78",
          "timestamp": "2024-12-20T14:37:00Z"
        }
      ],
      "labels": {
        "gpu": "0"
      }
    }
  ],
  "histogram": [
    {
      "type": "NIM_TIME_TO_FIRST_TOKEN_SECONDS",
      "values": [
        {
          "timestamp": "2024-12-20T14:30:00Z",
          "data": {
            "+Inf": "1024",
            "0.001": "45",
            "0.005": "178",
            "0.01": "312",
            "0.05": "624",
            "0.1": "812",
            "0.5": "980",
            "1.0": "1004",
            "2.0": "1015"
          }
        },
        {
          "timestamp": "2024-12-20T14:30:30Z",
          "data": {
            "+Inf": "960",
            "0.001": "32",
            "0.005": "152",
            "0.01": "288",
            "0.05": "576",
            "0.1": "756",
            "0.5": "908",
            "1.0": "932",
            "2.0": "943"
          }
        }
      ]
    },
    {
      "type": "NIM_TIME_TO_FIRST_TOKEN_SECONDS_PERCENTILES",
      "values": [
        {
          "timestamp": "2024-12-20T14:30:00Z",
          "data": {
            "p50": "0.0734",
            "p90": "0.1892",
            "p99": "0.2847"
          }
        },
        {
          "timestamp": "2024-12-20T14:30:30Z",
          "data": {
            "p50": "0.0823",
            "p90": "0.2134",
            "p99": "0.3156"
          }
        }
      ]
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "http://localhost:8080/api/v1/workloads/workloadId/pods/podId/metrics"

querystring = {"end":"2023-06-07T12:09:18.211Z","metricType":"GPU_UTILIZATION_PER_GPU","start":"2023-06-06T12:09:18.211Z"}

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript
const url = 'http://localhost:8080/api/v1/workloads/workloadId/pods/podId/metrics?end=2023-06-07T12%3A09%3A18.211Z&metricType=GPU_UTILIZATION_PER_GPU&start=2023-06-06T12%3A09%3A18.211Z';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "http://localhost:8080/api/v1/workloads/workloadId/pods/podId/metrics?end=2023-06-07T12%3A09%3A18.211Z&metricType=GPU_UTILIZATION_PER_GPU&start=2023-06-06T12%3A09%3A18.211Z"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("http://localhost:8080/api/v1/workloads/workloadId/pods/podId/metrics?end=2023-06-07T12%3A09%3A18.211Z&metricType=GPU_UTILIZATION_PER_GPU&start=2023-06-06T12%3A09%3A18.211Z")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("http://localhost:8080/api/v1/workloads/workloadId/pods/podId/metrics?end=2023-06-07T12%3A09%3A18.211Z&metricType=GPU_UTILIZATION_PER_GPU&start=2023-06-06T12%3A09%3A18.211Z")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'http://localhost:8080/api/v1/workloads/workloadId/pods/podId/metrics?end=2023-06-07T12%3A09%3A18.211Z&metricType=GPU_UTILIZATION_PER_GPU&start=2023-06-06T12%3A09%3A18.211Z', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("http://localhost:8080/api/v1/workloads/workloadId/pods/podId/metrics?end=2023-06-07T12%3A09%3A18.211Z&metricType=GPU_UTILIZATION_PER_GPU&start=2023-06-06T12%3A09%3A18.211Z");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:8080/api/v1/workloads/workloadId/pods/podId/metrics?end=2023-06-07T12%3A09%3A18.211Z&metricType=GPU_UTILIZATION_PER_GPU&start=2023-06-06T12%3A09%3A18.211Z")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Example 2

**Response**

```json
{
  "measurements": [
    {
      "type": "ALLOCATED_GPU",
      "values": [
        {
          "value": "85",
          "timestamp": "2024-12-20T14:30:00Z"
        },
        {
          "value": "92",
          "timestamp": "2024-12-20T14:30:30Z"
        },
        {
          "value": "78",
          "timestamp": "2024-12-20T14:37:00Z"
        }
      ],
      "labels": {
        "gpu": "0"
      }
    }
  ],
  "histogram": [
    {
      "type": "NIM_TIME_TO_FIRST_TOKEN_SECONDS",
      "values": [
        {
          "timestamp": "2024-12-20T14:30:00Z",
          "data": {
            "+Inf": "1024",
            "0.001": "45",
            "0.005": "178",
            "0.01": "312",
            "0.05": "624",
            "0.1": "812",
            "0.5": "980",
            "1.0": "1004",
            "2.0": "1015"
          }
        },
        {
          "timestamp": "2024-12-20T14:30:30Z",
          "data": {
            "+Inf": "960",
            "0.001": "32",
            "0.005": "152",
            "0.01": "288",
            "0.05": "576",
            "0.1": "756",
            "0.5": "908",
            "1.0": "932",
            "2.0": "943"
          }
        }
      ]
    },
    {
      "type": "NIM_TIME_TO_FIRST_TOKEN_SECONDS_PERCENTILES",
      "values": [
        {
          "timestamp": "2024-12-20T14:30:00Z",
          "data": {
            "p50": "0.0734",
            "p90": "0.1892",
            "p99": "0.2847"
          }
        },
        {
          "timestamp": "2024-12-20T14:30:30Z",
          "data": {
            "p50": "0.0823",
            "p90": "0.2134",
            "p99": "0.3156"
          }
        }
      ]
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "http://localhost:8080/api/v1/workloads/workloadId/pods/podId/metrics"

querystring = {"end":"2023-06-07T12:09:18.211Z","metricType":"GPU_UTILIZATION_PER_GPU","start":"2023-06-06T12:09:18.211Z"}

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript
const url = 'http://localhost:8080/api/v1/workloads/workloadId/pods/podId/metrics?end=2023-06-07T12%3A09%3A18.211Z&metricType=GPU_UTILIZATION_PER_GPU&start=2023-06-06T12%3A09%3A18.211Z';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "http://localhost:8080/api/v1/workloads/workloadId/pods/podId/metrics?end=2023-06-07T12%3A09%3A18.211Z&metricType=GPU_UTILIZATION_PER_GPU&start=2023-06-06T12%3A09%3A18.211Z"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("http://localhost:8080/api/v1/workloads/workloadId/pods/podId/metrics?end=2023-06-07T12%3A09%3A18.211Z&metricType=GPU_UTILIZATION_PER_GPU&start=2023-06-06T12%3A09%3A18.211Z")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("http://localhost:8080/api/v1/workloads/workloadId/pods/podId/metrics?end=2023-06-07T12%3A09%3A18.211Z&metricType=GPU_UTILIZATION_PER_GPU&start=2023-06-06T12%3A09%3A18.211Z")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'http://localhost:8080/api/v1/workloads/workloadId/pods/podId/metrics?end=2023-06-07T12%3A09%3A18.211Z&metricType=GPU_UTILIZATION_PER_GPU&start=2023-06-06T12%3A09%3A18.211Z', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("http://localhost:8080/api/v1/workloads/workloadId/pods/podId/metrics?end=2023-06-07T12%3A09%3A18.211Z&metricType=GPU_UTILIZATION_PER_GPU&start=2023-06-06T12%3A09%3A18.211Z");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:8080/api/v1/workloads/workloadId/pods/podId/metrics?end=2023-06-07T12%3A09%3A18.211Z&metricType=GPU_UTILIZATION_PER_GPU&start=2023-06-06T12%3A09%3A18.211Z")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```