> 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 full documentation content, see https://docs.nvidia.com/infra-controller/llms-full.txt.

# Retrieve all Machines

GET https://carbide-rest-api.carbide.svc.cluster.local/v2/org/{org}/carbide/machine

Get all Machines for Infrastructure Provider.

Org must have an Infrastructure Provider entity. User must have `FORGE_PROVIDER_ADMIN` authorization role.


Reference: https://docs.nvidia.com/infra-controller/infra-controller/rest-api-reference/api-reference/machine/get-all-machine

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: NCX Infra Controller REST API
  version: 1.0.0
paths:
  /v2/org/{org}/carbide/machine:
    get:
      operationId: get-all-machine
      summary: Retrieve all Machines
      description: >
        Get all Machines for Infrastructure Provider.


        Org must have an Infrastructure Provider entity. User must have
        `FORGE_PROVIDER_ADMIN` authorization role.
      tags:
        - subpackage_machine
      parameters:
        - name: org
          in: path
          required: true
          schema:
            type: string
        - name: siteId
          in: query
          description: Filter Machines by Site ID
          required: false
          schema:
            type: string
        - name: id
          in: query
          description: >-
            Filter Machines by ID.  Can be specified multiple times to filter on
            more than one ID.
          required: false
          schema:
            type: string
        - name: hasInstanceType
          in: query
          description: Filter Machines that have been assigned an Instance Type.
          required: false
          schema:
            type: boolean
        - name: instanceTypeId
          in: query
          description: >-
            Filter Machines by Instance Type ID.  Can be specified multiple
            times to filter on more than one Instance Type ID.
          required: false
          schema:
            type: string
        - name: tenantId
          in: query
          description: >-
            Filter Machines by ID of tenant of assigned instance. Can be
            specified multiple times to filter on more than one Tenant ID.
          required: false
          schema:
            type: string
        - name: hasInstance
          in: query
          description: >-
            Filter Machines that are assigned to an Instance. siteId must be
            specified when using this param.
          required: false
          schema:
            type: boolean
        - name: isMissingOnSite
          in: query
          description: Filter Machines that are missing on Site.
          required: false
          schema:
            type: boolean
        - name: includeMetadata
          in: query
          description: >-
            Include Machine metadata e.g. BMC, DPU, GPU and Interface data. Can
            only be requested by Provider.
          required: false
          schema:
            type: boolean
        - name: status
          in: query
          description: >-
            Filter Machines by Status.  Can be specified multiple times to
            filter on more than one Status.
          required: false
          schema:
            type: string
        - name: capabilityType
          in: query
          description: Filter Machines by Capability Type
          required: false
          schema:
            type: string
        - name: capabilityName
          in: query
          description: >-
            Filter Machines by Capability Name.  Can be specified multiple times
            to filter on more than one Capability Name.
          required: false
          schema:
            type: string
        - name: hwSkuDeviceType
          in: query
          description: >-
            Filter Machines by hardware SKU Device Type. Example values: "gpu",
            "cpu", "storage", "cache"
          required: false
          schema:
            type: string
        - name: query
          in: query
          description: >-
            Provide query to search for matches. Input will be matched against
            Machine ID, vendor, product name, hostname and status
          required: false
          schema:
            type: string
        - name: includeRelation
          in: query
          description: Related entity to expand
          required: false
          schema:
            $ref: >-
              #/components/schemas/V2OrgOrgCarbideMachineGetParametersIncludeRelation
        - 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: orderBy
          in: query
          description: Ordering for pagination query
          required: false
          schema:
            $ref: '#/components/schemas/V2OrgOrgCarbideMachineGetParametersOrderBy'
        - 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://carbide-rest-api.carbide.svc.cluster.local/v2/org/$ORG_NAME/carbide/user/current

            ```
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Machine'
        '403':
          description: >-
            Error response when user is not authorized to call an endpoint or
            retrieve/modify objects
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CarbideAPIError'
servers:
  - url: https://carbide-rest-api.carbide.svc.cluster.local
components:
  schemas:
    V2OrgOrgCarbideMachineGetParametersIncludeRelation:
      type: string
      enum:
        - InfrastructureProvider
        - Site
        - InstanceType
      title: V2OrgOrgCarbideMachineGetParametersIncludeRelation
    V2OrgOrgCarbideMachineGetParametersOrderBy:
      type: string
      enum:
        - STATUS_ASC
        - STATUS_DESC
        - CREATED_ASC
        - CREATED_DESC
        - UPDATED_ASC
        - UPDATED_DESC
        - ID_ASC
        - ID_DESC
      title: V2OrgOrgCarbideMachineGetParametersOrderBy
    MachineCapabilityType:
      type: string
      enum:
        - CPU
        - Memory
        - Storage
        - Network
        - GPU
        - InfiniBand
        - DPU
      description: Type of the Capability
      title: MachineCapabilityType
    MachineCapability:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/MachineCapabilityType'
          description: Type of the Capability
        name:
          type: string
          description: Name of the Capability component
        frequency:
          type:
            - string
            - 'null'
          description: Frequency of the Capability component, if available
        cores:
          type:
            - integer
            - 'null'
          description: Number of Cores in the Capability component, if applicable
        threads:
          type:
            - integer
            - 'null'
          description: Number of Threads in the Capability component, if applicable
        capacity:
          type:
            - string
            - 'null'
          description: Capacity of the Capability component, if applicable
        vendor:
          type:
            - string
            - 'null'
          description: Vendor of the Capability component, if available
        inactiveDevices:
          type: array
          items:
            type: integer
          description: A list of inactive devices
        count:
          type:
            - integer
            - 'null'
          description: Count of the Capability component
        deviceType:
          type:
            - string
            - 'null'
          description: Device Type of the Capability component, if available
      description: Describes capabilities of a Machine
      title: MachineCapability
    MachineInterface:
      type: object
      properties:
        id:
          type: string
          format: uuid
        machineId:
          type: string
        controllerInterfaceId:
          type: string
          format: uuid
        controllerSegmentId:
          type: string
          format: uuid
        attachedDpuMachineID:
          type:
            - string
            - 'null'
        subnetId:
          type:
            - string
            - 'null'
          format: uuid
        hostname:
          type: string
          format: hostname
        isPrimary:
          type: boolean
        macAddress:
          type: string
        ipAddresses:
          type: array
          items:
            type: string
          description: Array of IP addresses
        created:
          type: string
          format: date-time
        updated:
          type: string
          format: date-time
      description: Describes an interface attached to a machine
      title: MachineInterface
    MachineHealthProbeSuccess:
      type: object
      properties:
        id:
          type: string
          description: Health probe identifier
        target:
          type:
            - string
            - 'null'
          description: Specific component targeted by health probe
      description: Describes results of successful Machine health probe
      title: MachineHealthProbeSuccess
    MachineHealthProbeAlert:
      type: object
      properties:
        id:
          type: string
          description: Health probe identifier
        target:
          type:
            - string
            - 'null'
          description: Specific component targeted by health probe
        inAlertSince:
          type:
            - string
            - 'null'
          description: Date/time since the alert has been in effect
        message:
          type: string
          description: Details of the failed health probe result
        tenantMessage:
          type:
            - string
            - 'null'
          description: Information provided by Tenant, if any
        classifications:
          type: array
          items:
            type: string
          description: Classifications for this alert, category or impact
      description: Describes results of a failed Machine health probe
      title: MachineHealthProbeAlert
    MachineHealth:
      type: object
      properties:
        source:
          type: string
          description: Describes how the health report was generated
        observedAt:
          type:
            - string
            - 'null'
          description: Date/time when health report was generated
        successes:
          type: array
          items:
            $ref: '#/components/schemas/MachineHealthProbeSuccess'
          description: Results from successful health probes for the Machine
        alerts:
          type: array
          items:
            $ref: '#/components/schemas/MachineHealthProbeAlert'
          description: Results from failed health probes for the Machine
      description: Describes results of various Machine health probes and alerts
      title: MachineHealth
    MachineDMIData:
      type: object
      properties:
        boardName:
          type: string
        boardSerial:
          type: string
        boardVersion:
          type: string
        biosDate:
          type: string
        biosVersion:
          type: string
        productSerial:
          type: string
        chassisSerial:
          type: string
      description: Describes DMI data of a Machine
      title: MachineDMIData
    MachineBMCInfo:
      type: object
      properties:
        ip:
          type: string
          format: ipv4
        mac:
          type: string
        version:
          type: string
        firmwareRevision:
          type: string
      description: Describes BMC information of a Machine
      title: MachineBMCInfo
    MachineGPUInfo:
      type: object
      properties:
        name:
          type: string
        serial:
          type: string
        driverVersion:
          type: string
        vbiosVersion:
          type: string
        inforomVersion:
          type: string
        totalMemory:
          type: string
        frequency:
          type: string
        pciBusId:
          type: string
      description: Describes information about GPU of a Machine
      title: MachineGPUInfo
    MachineNetworkInterface:
      type: object
      properties:
        macAddress:
          type: string
        vendor:
          type: string
        device:
          type: string
        path:
          type: string
        numaNode:
          type: integer
        description:
          type: string
        slot:
          type: string
      description: Describes information about an Ethernet Interface of a Machine
      title: MachineNetworkInterface
    MachineInfiniBandInterface:
      type: object
      properties:
        guid:
          type: string
        vendor:
          type: string
        device:
          type: string
        path:
          type: string
        numaNode:
          type: integer
        description:
          type: string
        slot:
          type: string
      description: Describes information about an Infiniband Interface of a Machine
      title: MachineInfiniBandInterface
    MachineMetadata:
      type: object
      properties:
        dmiData:
          $ref: '#/components/schemas/MachineDMIData'
        bmcInfo:
          $ref: '#/components/schemas/MachineBMCInfo'
        gpus:
          type: array
          items:
            $ref: '#/components/schemas/MachineGPUInfo'
        networkInterfaces:
          type: array
          items:
            $ref: '#/components/schemas/MachineNetworkInterface'
        infinibandInterfaces:
          type: array
          items:
            $ref: '#/components/schemas/MachineInfiniBandInterface'
      description: Describes metadata for various Machine components
      title: MachineMetadata
    Labels:
      type: object
      additionalProperties:
        type: string
      title: Labels
    MachineStatus:
      type: string
      enum:
        - Initializing
        - Ready
        - Reset
        - Maintenance
        - InUse
        - Error
        - Decommissioned
        - Unknown
      description: Status values for Machine objects
      title: MachineStatus
    StatusDetail:
      type: object
      properties:
        status:
          type: string
        message:
          type: string
        created:
          type: string
          format: date-time
        updated:
          type: string
          format: date-time
      description: Describes the details of a status transition for a resource
      title: StatusDetail
    Machine:
      type: object
      properties:
        id:
          type: string
          description: Unique ID of Machine
        infrastructureProviderId:
          type: string
          format: uuid
          description: ID of the Provider that owns the Machine
        siteId:
          type: string
          format: uuid
          description: ID of the Site the Machine belongs to
        instanceTypeId:
          type:
            - string
            - 'null'
          format: uuid
          description: ID of the Instance Type, if assigned
        instanceId:
          type:
            - string
            - 'null'
          format: uuid
          description: ID of the Instance if this Machine is assigned to one
        tenantId:
          type:
            - string
            - 'null'
          format: uuid
          description: >-
            ID of the Tenant that owns the Instance if the Machine is assigned
            to one
        controllerMachineId:
          type: string
          description: ID of the Machine at Site, now same as the primary ID
        controllerMachineType:
          type: string
          description: Denotes architecture (x86 vs ARM) of the Machine
        hwSkuDeviceType:
          type:
            - string
            - 'null'
          description: >-
            SKU derived device type of the machine, e.g. cpu, gpu, cache,
            storage, etc.
        vendor:
          type: string
          description: Name of the vendor of the Machine
        productName:
          type: string
          description: Product name of the Machine
        serialNumber:
          type: string
          description: Serial number of the Machine, only visible to Provider
        machineCapabilities:
          type: array
          items:
            $ref: '#/components/schemas/MachineCapability'
        machineInterfaces:
          type: array
          items:
            $ref: '#/components/schemas/MachineInterface'
        maintenanceMessage:
          type:
            - string
            - 'null'
          description: >-
            If the Machine is in maintenance mode, this message will typically
            describe the reason and how long it is expected to be in maintenance
        health:
          $ref: '#/components/schemas/MachineHealth'
        metadata:
          $ref: '#/components/schemas/MachineMetadata'
          description: >-
            Only available to Providers. Returned if includeMetadata query param
            is specified. Otherwise attribute is omitted from response.
        labels:
          $ref: '#/components/schemas/Labels'
        status:
          $ref: '#/components/schemas/MachineStatus'
        isUsableByTenant:
          type: boolean
          description: >-
            Indicates whether the machine is usable by or currently in use by a
            tenant.
        statusHistory:
          type: array
          items:
            $ref: '#/components/schemas/StatusDetail'
        created:
          type: string
          format: date-time
        updated:
          type: string
          format: date-time
      description: Machine is the baremetal server that sits in the datacenter
      title: Machine
    CarbideApiErrorSource:
      type: string
      enum:
        - carbide
      description: Source of the error. Only 'carbide' is supported
      title: CarbideApiErrorSource
    CarbideApiErrorData:
      type: object
      properties: {}
      description: Additional data about the error
      title: CarbideApiErrorData
    CarbideAPIError:
      type: object
      properties:
        source:
          $ref: '#/components/schemas/CarbideApiErrorSource'
          description: Source of the error. Only 'carbide' is supported
        message:
          type: string
          description: Message describing the error
        data:
          oneOf:
            - $ref: '#/components/schemas/CarbideApiErrorData'
            - type: 'null'
          description: Additional data about the error
      description: Describes the error response from NCX Infra Controller REST API
      title: CarbideAPIError
  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://carbide-rest-api.carbide.svc.cluster.local/v2/org/$ORG_NAME/carbide/user/current

        ```

```

## SDK Code Examples

```python example-1
import requests

url = "https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/machine"

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

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

print(response.json())
```

```javascript example-1
const url = 'https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/machine';
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 example-1
package main

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

func main() {

	url := "https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/machine"

	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 example-1
require 'uri'
require 'net/http'

url = URI("https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/machine")

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

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

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

```java example-1
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/machine")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/machine', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp example-1
using RestSharp;

var client = new RestClient("https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/machine");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift example-1
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/machine")! 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()
```