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

# Retrieve all Tasks for a Tray

GET https://nico-rest-api.nico.svc.cluster.local/v2/org/{org}/nico/tray/{id}/task

List Tasks targeting the specified Tray.

Tasks are site-scoped; `siteId` must be the Site that owns the Tray. Org must have an Infrastructure Provider entity. User must have authorization role with `PROVIDER_ADMIN` suffix.

Filters compose with AND: setting `activeOnly=true` restricts the result to tasks that are still in a non-terminal state (`Pending`, `Running`, `Waiting`). Results are paginated; the `X-Pagination` response header reports the total count over the post-filter set.

By default the `report` field is omitted from each task in the response. Set `includeReport=true` to include it; this is opt-in because report bodies can be several KB and pulling them across the list path persists the full payload in each caller-side workflow record. Single-task `GET /rack/task/{id}` and `POST /rack/task/{id}/cancel` always include the report.

Reference: https://docs.nvidia.com/infra-controller/infra-controller/rest-api-reference/api-reference/tray/get-tray-tasks

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: NVIDIA Infra Controller REST API
  version: 1.0.0
paths:
  /v2/org/{org}/nico/tray/{id}/task:
    get:
      operationId: get-tray-tasks
      summary: Retrieve all Tasks for a Tray
      description: >-
        List Tasks targeting the specified Tray.


        Tasks are site-scoped; `siteId` must be the Site that owns the Tray. Org
        must have an Infrastructure Provider entity. User must have
        authorization role with `PROVIDER_ADMIN` suffix.


        Filters compose with AND: setting `activeOnly=true` restricts the result
        to tasks that are still in a non-terminal state (`Pending`, `Running`,
        `Waiting`). Results are paginated; the `X-Pagination` response header
        reports the total count over the post-filter set.


        By default the `report` field is omitted from each task in the response.
        Set `includeReport=true` to include it; this is opt-in because report
        bodies can be several KB and pulling them across the list path persists
        the full payload in each caller-side workflow record. Single-task `GET
        /rack/task/{id}` and `POST /rack/task/{id}/cancel` always include the
        report.
      tags:
        - subpackage_tray
      parameters:
        - name: org
          in: path
          description: Name of the Org
          required: true
          schema:
            type: string
        - name: id
          in: path
          description: UUID of the Tray
          required: true
          schema:
            type: string
            format: uuid
        - name: siteId
          in: query
          description: ID of the Site that owns the Tray.
          required: true
          schema:
            type: string
            format: uuid
        - name: activeOnly
          in: query
          description: Restrict results to non-terminal Tasks.
          required: false
          schema:
            type: boolean
            default: false
        - name: includeReport
          in: query
          description: Include the per-task execution report on each returned task.
          required: false
          schema:
            type: boolean
            default: false
        - name: pageNumber
          in: query
          description: Page number for pagination query
          required: false
          schema:
            type: integer
            default: 1
        - name: pageSize
          in: query
          description: Page size for pagination query
          required: false
          schema:
            type: integer
        - name: Authorization
          in: header
          description: >-
            ```

            export JWT_BEARER_TOKEN="<jwt-bearer-token>"


            # Example org name: "acme-inc

            export ORG_NAME=<org-name>


            # Use the JWT bearer token in your API request auth header:

            curl -v -X GET -H "Content-Type: application/json" -H
            "Authorization: Bearer $JWT_BEARER_TOKEN"
            https://nico-rest-api.nico.svc.cluster.local/v2/org/$ORG_NAME/nico/user/current

            ```
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Task'
        '400':
          description: Error response when request data cannot be validated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NICoAPIError'
        '403':
          description: >-
            Error response when user is not authorized to call an endpoint or
            retrieve/modify objects
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NICoAPIError'
        '404':
          description: Error response when requested object is not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NICoAPIError'
servers:
  - url: https://nico-rest-api.nico.svc.cluster.local
    description: Kubernetes Cluster
components:
  schemas:
    TaskStatus:
      type: string
      enum:
        - Unknown
        - Pending
        - Waiting
        - Running
        - Succeeded
        - Failed
        - Terminated
      description: Current state of the task.
      title: TaskStatus
    TaskReportV1Version:
      type: string
      enum:
        - '1'
      description: Schema version of this report. Always `1` for `TaskReportV1`.
      title: TaskReportV1Version
    TaskReportV1Status:
      type: string
      enum:
        - pending
        - running
        - completed
        - failed
        - skipped
      description: >
        Per-stage and per-step execution status.


        - `pending`   — workflow has not yet reached this stage/step.

        - `running`   — execution is in progress.

        - `completed` — execution finished successfully.

        - `failed`    — execution finished with an error; see `error`.

        - `skipped`   — the rule lists this component type but the task targets
        no components of that type, so the workflow will not invoke it.
      title: TaskReportV1Status
    TaskReportV1Step:
      type: object
      properties:
        componentType:
          type: string
          description: >-
            Component class this step targets, e.g. `Compute`, `NVLSwitch`,
            `PowerShelf`.
        status:
          $ref: '#/components/schemas/TaskReportV1Status'
        totalComponents:
          type: integer
          description: >
            Count of components of `componentType` this step targets. Surfaced
            here because the task representation does not include the per-type
            component map.
        completedComponents:
          type: integer
          description: >
            Reserved for a future best-effort activity contract that reports
            per-component outcomes. Not written under the current fail-fast
            contract and omitted by the producer.
        failedComponents:
          type: integer
          description: Reserved (see `completedComponents`).
        startedAt:
          type: string
          format: date-time
          description: >-
            Set when the step leaves `pending`. `skipped` steps carry no
            timestamp.
        finishedAt:
          type: string
          format: date-time
          description: Set when the step reaches a terminal state.
        error:
          type: string
          description: Failure summary when `status == failed`. Truncated to 512 bytes.
      required:
        - componentType
        - status
      description: >
        Execution state of one rule sequence step. Pairs 1:1 with the rule's
        ordered steps within the containing stage and shares its index.
      title: TaskReportV1Step
    TaskReportV1Stage:
      type: object
      properties:
        number:
          type: integer
          description: 1-based rule stage number.
        status:
          $ref: '#/components/schemas/TaskReportV1Status'
        steps:
          type: array
          items:
            $ref: '#/components/schemas/TaskReportV1Step'
        startedAt:
          type: string
          format: date-time
          description: Set when the stage leaves `pending`.
        finishedAt:
          type: string
          format: date-time
          description: Set when the stage reaches a terminal state.
        error:
          type: string
          description: Failure summary when `status == failed`. Truncated to 512 bytes.
      required:
        - number
        - status
        - steps
      description: >
        Execution state of one rule stage. `number` is the canonical key for
        joining a stage record back to its rule entry.
      title: TaskReportV1Stage
    TaskReportV1:
      type: object
      properties:
        version:
          $ref: '#/components/schemas/TaskReportV1Version'
          description: Schema version of this report. Always `1` for `TaskReportV1`.
        stages:
          type: array
          items:
            $ref: '#/components/schemas/TaskReportV1Stage'
        error:
          type: string
          description: >
            Top-level failure summary: the message from the first stage that
            fails in this report. Not overwritten by subsequent failures, so it
            remains the canonical task-level error. Truncated to 512 bytes by
            the producer.
      required:
        - version
        - stages
      description: >
        Structured execution report (version 1) for a Flow-scheduled task.

        The document mirrors the structure of the operation rule that drives the
        workflow: each `Stage` corresponds to one rule stage and each `Step`
        within a stage corresponds to one rule sequence step at the same index.


        Clients pick the decoder by the `version` field; future report schemas
        will be exposed as `TaskReportV2` etc. and conveyed via a parallel
        response field, leaving v1 consumers untouched.
      title: TaskReportV1
    Task:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier of the task.
        status:
          $ref: '#/components/schemas/TaskStatus'
          description: Current state of the task.
        description:
          type: string
          description: Human-readable description provided when the task was created.
        message:
          type: string
          description: >-
            Optional status or error message describing the current state or
            result.
        ruleId:
          type:
            - string
            - 'null'
          format: uuid
          description: |-
            Operation Rule that Flow resolved for this task — either because
            the caller pinned one via `ruleId` on the originating request or
            because Flow's default rule resolution picked it. Null if Flow
            has not yet recorded a resolution.
        started:
          type: string
          format: date-time
          description: Timestamp when the task started execution.
        finished:
          type: string
          format: date-time
          description: Timestamp when the task finished (succeeded, failed or terminated).
        created:
          type: string
          format: date-time
          description: Timestamp when the task was created.
        updated:
          type: string
          format: date-time
          description: Timestamp when the task was last updated.
        report:
          $ref: '#/components/schemas/TaskReportV1'
          description: >
            Structured v1 execution report for the task. Populated on
            single-task `GET` and `cancel` responses, and on list responses only
            when `includeReport=true` is set. Omitted when the task has not yet
            produced a report (e.g. still queued) or when the caller did not opt
            in on list endpoints.


            A future schema revision will be exposed as a new `TaskReportV2`
            schema referenced from a parallel response field; v1 consumers are
            not disturbed by that bump.
      description: >-
        A task representing an asynchronous, site-scoped operation against rack,
        tray, or other site infrastructure.
      title: Task
    NiCoApiErrorSource:
      type: string
      enum:
        - nico
      description: Source of the error.
      title: NiCoApiErrorSource
    NiCoApiErrorData:
      type: object
      properties: {}
      description: Additional data about the error
      title: NiCoApiErrorData
    NICoAPIError:
      type: object
      properties:
        source:
          $ref: '#/components/schemas/NiCoApiErrorSource'
          description: Source of the error.
        message:
          type: string
          description: Message describing the error
        data:
          oneOf:
            - $ref: '#/components/schemas/NiCoApiErrorData'
            - type: 'null'
          description: Additional data about the error
      description: Describes the error response from NVIDIA Infra Controller REST API
      title: NICoAPIError
  securitySchemes:
    JWTBearerToken:
      type: http
      scheme: bearer
      description: >-
        ```

        export JWT_BEARER_TOKEN="<jwt-bearer-token>"


        # Example org name: "acme-inc

        export ORG_NAME=<org-name>


        # Use the JWT bearer token in your API request auth header:

        curl -v -X GET -H "Content-Type: application/json" -H "Authorization:
        Bearer $JWT_BEARER_TOKEN"
        https://nico-rest-api.nico.svc.cluster.local/v2/org/$ORG_NAME/nico/user/current

        ```

```

## Examples



**Request**

```json
{}
```

**Response**

```json
[
  {
    "id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
    "status": "Running",
    "description": "Deploy firmware update to tray components",
    "message": "Updating firmware on 2 of 4 NVLSwitches",
    "ruleId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "started": "2024-04-10T14:00:00Z",
    "finished": null,
    "created": "2024-04-10T13:55:00Z",
    "updated": "2024-04-10T14:05:00Z",
    "report": {
      "version": 1,
      "stages": [
        {
          "number": 1,
          "status": "completed",
          "steps": [
            {
              "componentType": "Compute",
              "status": "completed",
              "totalComponents": 4,
              "startedAt": "2024-04-10T14:00:00Z",
              "finishedAt": "2024-04-10T14:02:00Z"
            }
          ],
          "startedAt": "2024-04-10T14:00:00Z",
          "finishedAt": "2024-04-10T14:02:00Z"
        },
        {
          "number": 2,
          "status": "running",
          "steps": [
            {
              "componentType": "NVLSwitch",
              "status": "running",
              "totalComponents": 4,
              "startedAt": "2024-04-10T14:02:00Z"
            },
            {
              "componentType": "PowerShelf",
              "status": "skipped",
              "totalComponents": 0
            }
          ],
          "startedAt": "2024-04-10T14:02:00Z"
        }
      ]
    }
  }
]
```

**SDK Code**

```python
import requests

url = "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/tray/id/task"

querystring = {"siteId":"siteId"}

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/tray/id/task?siteId=siteId';
const options = {
  method: 'GET',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/tray/id/task?siteId=siteId"

	payload := strings.NewReader("{}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	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("https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/tray/id/task?siteId=siteId")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

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("https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/tray/id/task?siteId=siteId")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/tray/id/task?siteId=siteId', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/tray/id/task?siteId=siteId");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/tray/id/task?siteId=siteId")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```