> ## Documentation Index
> Fetch the complete documentation index at: https://docs.internal.nscale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Upsert a device condition

> Upsert one device condition, keyed by (device, type). The declared source must own the condition type. Source-observed conditions require observed_at and ignore older observations.



## OpenAPI

````yaml /openapi/fleet-manager-openapi.yaml post /api/v1/device-conditions/
openapi: 3.0.3
info:
  title: Fleet Manager API
  version: 1.0.0
  description: API for the Nscale Fleet Manager
servers: []
security: []
paths:
  /api/v1/device-conditions/:
    post:
      tags:
        - Device Conditions
      summary: Upsert a device condition
      description: >-
        Upsert one device condition, keyed by (device, type). The declared
        source must own the condition type. Source-observed conditions require
        observed_at and ignore older observations.
      operationId: api_v1_device_conditions_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeviceConditionUpsert'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/DeviceConditionUpsert'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/DeviceConditionUpsert'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceCondition'
          description: >-
            Returned when an existing (device, type) condition row was updated,
            left unchanged by an idempotent re-report, or ignored because the
            submitted observed_at is older than the stored row.
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceCondition'
          description: Returned when the (device, type) condition row was created.
        '400':
          description: Validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication credentials were not provided or are invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: You do not have permission to perform this action.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - oauth2:
            - device-condition:create
        - cookieAuth: []
components:
  schemas:
    DeviceConditionUpsert:
      type: object
      description: Write contract for one source observation.
      properties:
        device:
          type: string
          format: uuid
          description: The device this observation belongs to.
        type:
          $ref: '#/components/schemas/DeviceConditionTypeEnum'
        status:
          $ref: '#/components/schemas/DeviceConditionStatusEnum'
        reason:
          type: string
          default: ''
          description: >-
            Opaque, source-owned CamelCase cause code scoped to the condition
            type. Fleet Manager does not interpret it; blank when no cause is
            reported.
          maxLength: 128
        message:
          type: string
          default: ''
          description: Human-readable detail for operators. Optional.
          maxLength: 4096
        source:
          $ref: '#/components/schemas/DeviceConditionSourceEnum'
        observed_at:
          type: string
          format: date-time
          description: When the source made the observation.
      required:
        - device
        - observed_at
        - source
        - status
        - type
    DeviceCondition:
      type: object
      description: 'A device condition: the latest observation about one aspect of a device.'
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        device:
          type: string
          format: uuid
          description: The device this observation belongs to.
        type:
          $ref: '#/components/schemas/DeviceConditionTypeEnum'
        status:
          $ref: '#/components/schemas/DeviceConditionStatusEnum'
        reason:
          type: string
          default: ''
          description: >-
            Opaque, source-owned CamelCase cause code scoped to the condition
            type. Fleet Manager does not interpret it; blank when no cause is
            reported.
          maxLength: 128
        message:
          type: string
          default: ''
          description: Human-readable detail for operators. Optional.
          maxLength: 4096
        source:
          $ref: '#/components/schemas/DeviceConditionSourceEnum'
        condition_of:
          allOf:
            - $ref: '#/components/schemas/DeviceConditionOfEnum'
          readOnly: true
          description: >-
            The derived top-level device status this condition contributes to,
            or none when it is eligibility-only. Stamped by the hub from the
            code-owned type registry, not the reporting source.


            * `operational_status` - Operational status

            * `health_status` - Health status

            * `none` - None
        decisive:
          type: boolean
          readOnly: true
          description: >-
            Whether this condition is decisive in the current derivation of its
            condition_of domain's status from conditions. Maintained by the
            hub-owned derivation on every materialise; independent of
            out-of-band status overrides; always false for condition_of=none;
            never client-set.
        observed_at:
          type: string
          format: date-time
          readOnly: true
          description: When the source made an observation.
        last_transitioned_at:
          type: string
          format: date-time
          readOnly: true
          description: >-
            When 'status' last changed value. The upsert path bumps this only on
            a real status transition, so it survives no-op re-reports of the
            same status and stays the 'when did this actually flip' signal.
        created_at:
          type: string
          format: date-time
          readOnly: true
        updated_at:
          type: string
          format: date-time
          readOnly: true
      required:
        - condition_of
        - created_at
        - decisive
        - device
        - id
        - last_transitioned_at
        - observed_at
        - source
        - status
        - type
        - updated_at
    ErrorResponse:
      type: object
      description: >-
        Uniform error body for every 4xx/5xx response. `detail` is a
        human-readable message, always present, safe to display to end users.
        `code` is the machine-readable identifier. `field_errors` lists
        per-input-field validation messages and is empty for non-field errors
        (auth, permission, not-found, conflict, server).
      required:
        - detail
        - code
        - field_errors
      properties:
        detail:
          type: string
        code:
          $ref: '#/components/schemas/ErrorCodeEnum'
        field_errors:
          type: array
          items:
            $ref: '#/components/schemas/FieldError'
    DeviceConditionTypeEnum:
      enum:
        - ProvisioningHealthy
        - MaintenanceClear
        - Enrolled
        - InValidationPool
        - InstanceAllocated
        - CustomerAllocated
        - CustomerReady
        - SlurmMember
        - SlurmSchedulable
        - TelemetryHealthy
        - SystemHealthy
        - ChassisHealthy
        - ProcessorHealthy
        - MemoryHealthy
        - StorageHealthy
        - DiskHealthy
        - PowerSupplyHealthy
        - GpuHealthy
        - FpgaHealthy
        - CustodyIntent
        - FrontendPortsInCustomerVrf
        - NvLinkGpusInRepairPartition
        - BackendPortsInMaintenanceVrf
      type: string
      description: |-
        * `ProvisioningHealthy` - Provisioning healthy
        * `MaintenanceClear` - Maintenance clear
        * `Enrolled` - Enrolled
        * `InValidationPool` - In validation pool
        * `InstanceAllocated` - Instance allocated
        * `CustomerAllocated` - Customer allocated
        * `CustomerReady` - Customer ready
        * `SlurmMember` - Slurm member
        * `SlurmSchedulable` - Slurm schedulable
        * `TelemetryHealthy` - Telemetry healthy
        * `SystemHealthy` - System healthy
        * `ChassisHealthy` - Chassis healthy
        * `ProcessorHealthy` - Processor healthy
        * `MemoryHealthy` - Memory healthy
        * `StorageHealthy` - Storage healthy
        * `DiskHealthy` - Disk healthy
        * `PowerSupplyHealthy` - Power supply healthy
        * `GpuHealthy` - GPU healthy
        * `FpgaHealthy` - FPGA healthy
        * `CustodyIntent` - Custody intent
        * `FrontendPortsInCustomerVrf` - Front-end ports in customer VRF
        * `NvLinkGpusInRepairPartition` - GPUs in NVLink repair partition
        * `BackendPortsInMaintenanceVrf` - Back-end ports in maintenance VRF
    DeviceConditionStatusEnum:
      enum:
        - 'True'
        - 'False'
        - Unknown
      type: string
      description: |-
        * `True` - True
        * `False` - False
        * `Unknown` - Unknown
    DeviceConditionSourceEnum:
      enum:
        - ironic
        - slurm
        - health-status
        - google-custody
        - nvlink-fabric
        - backend-fabric
      type: string
      description: |-
        * `ironic` - Ironic
        * `slurm` - Slurm
        * `health-status` - Health status
        * `google-custody` - Google custody
        * `nvlink-fabric` - NVLink fabric
        * `backend-fabric` - Back-end fabric
    DeviceConditionOfEnum:
      enum:
        - operational_status
        - health_status
        - none
      type: string
      description: |-
        * `operational_status` - Operational status
        * `health_status` - Health status
        * `none` - None
    ErrorCodeEnum:
      type: string
      description: >-
        Stable machine-readable error identifier. New members may be added
        within this API version; clients must tolerate unknown values.
      enum:
        - error
        - invalid
        - parse_error
        - authentication_failed
        - not_authenticated
        - permission_denied
        - not_found
        - method_not_allowed
        - not_acceptable
        - unsupported_media_type
        - conflict
        - enrollment_infrastructure_reference_pending
        - enrollment_infrastructure_reference_changed
        - unprocessable_entity
        - throttled
        - service_unavailable
    FieldError:
      type: object
      description: One input field's validation messages.
      required:
        - field
        - messages
      properties:
        field:
          type: string
          description: >-
            Dotted path to the offending input field, or to the collection row
            when the whole row is invalid (e.g. `filters.end_date`,
            `memberships.0.role`, `memberships.0`).
        messages:
          type: array
          minItems: 1
          items:
            type: string
  securitySchemes:
    oauth2:
      type: oauth2
      flows: {}
    cookieAuth:
      type: apiKey
      in: cookie
      name: sessionid

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.