# Update a device

**PATCH** `/devices/{device_id}`

## Parameters

### `device_id` (_path_, required)

Device id

- **Type:** `string`
- **Example:** `"42"`
- **Constraints:** pattern `^[1-9]\d*$`

## Request body

**application/json**

_Schema ref:_ `#/components/schemas/PatchDeviceBody` (PatchDeviceBody)

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1
    },
    "user_id": {
      "type": "integer",
      "nullable": true,
      "minimum": 0,
      "exclusiveMinimum": true
    },
    "brand": {
      "type": "string",
      "nullable": true
    },
    "serial_number": {
      "type": "string",
      "nullable": true
    },
    "is_rented": {
      "type": "boolean"
    },
    "client_purchase_price": {
      "type": "string",
      "nullable": true
    },
    "client_purchase_date": {
      "type": "string",
      "nullable": true
    },
    "client_warranty_endDate": {
      "type": "string",
      "nullable": true
    },
    "client_rental_price": {
      "type": "string",
      "nullable": true
    },
    "client_rental_startDate": {
      "type": "string",
      "nullable": true
    },
    "client_rental_endDate": {
      "type": "string",
      "nullable": true
    },
    "client_contract_number": {
      "type": "string",
      "nullable": true
    },
    "client_invoice_number": {
      "type": "string",
      "nullable": true
    },
    "screen_size": {
      "type": "string",
      "nullable": true
    },
    "graphic": {
      "type": "string",
      "nullable": true
    },
    "processor": {
      "type": "string",
      "nullable": true
    },
    "ram": {
      "type": "string",
      "nullable": true
    },
    "storage": {
      "type": "string",
      "nullable": true
    },
    "model_year": {
      "type": "string",
      "nullable": true
    },
    "connectivity": {
      "type": "string",
      "nullable": true
    },
    "keyboard_layout": {
      "type": "string",
      "nullable": true,
      "enum": [
        "FRENCH_AZERTY",
        "SPANISH_QWERTY",
        "ITALIAN_QWERTY",
        "INTERNATIONAL_ENGLISH_QWERTY",
        "GERMAN_QWERTZ",
        "PORTUGUESE_QWERTY",
        "ENGLISH_QWERTY",
        "SWISS_QWERTZ",
        "AMERICAN_ENGLISH_QWERTY",
        "CANADIAN_ENGLISH_QWERTY",
        "DUTCH_QWERTY"
      ],
      "description": "Set or change layout using the same keys as cart/order; null clears.",
      "example": "FRENCH_AZERTY"
    },
    "resolution": {
      "type": "string",
      "nullable": true
    },
    "comment": {
      "type": "string",
      "nullable": true
    },
    "has_microphone": {
      "type": "boolean",
      "nullable": true
    },
    "has_webcam": {
      "type": "boolean",
      "nullable": true
    },
    "noise_cancellation": {
      "type": "boolean",
      "nullable": true
    },
    "compliance": {
      "anyOf": [
        {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        {
          "type": "string"
        },
        {
          "nullable": true
        }
      ],
      "description": "Compliance labels"
    },
    "connection_type": {
      "type": "array",
      "nullable": true,
      "items": {
        "type": "string"
      },
      "description": "Connection type labels; single string or array (stored as array)."
    },
    "has_stool": {
      "type": "boolean",
      "nullable": true
    },
    "has_video_package": {
      "type": "boolean",
      "nullable": true
    },
    "has_screen": {
      "type": "boolean",
      "nullable": true
    },
    "has_premium_tablet": {
      "type": "boolean",
      "nullable": true
    },
    "color": {
      "type": "string",
      "nullable": true
    },
    "seats_number": {
      "type": "string",
      "nullable": true
    },
    "assembly": {
      "type": "string",
      "nullable": true
    },
    "os_platform": {
      "type": "string",
      "nullable": true
    }
  }
}
```

## Responses

### 200

Updated device

**application/json**

_Schema ref:_ `#/components/schemas/GetDeviceResponse` (GetDeviceResponse)

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer"
        },
        "name": {
          "type": "string",
          "nullable": true
        },
        "serial_number": {
          "type": "string",
          "nullable": true
        },
        "rent": {
          "type": "string",
          "nullable": true
        },
        "tracking_number": {
          "type": "string",
          "nullable": true
        },
        "client_status": {
          "type": "string",
          "enum": [
            "ARCHIVED",
            "PENDING_VALIDATION",
            "IN_PREPARATION",
            "DELIVERED",
            "SHIPPED",
            "AVAILABLE",
            "IN_SERVICE",
            "IN_MAINTENANCE",
            "OUT_OF_SERVICE"
          ],
          "description": "Device progress key for display and filtering"
        },
        "type": {
          "type": "string",
          "nullable": true
        },
        "category": {
          "type": "string",
          "nullable": true
        },
        "source": {
          "type": "string",
          "nullable": true
        },
        "comment": {
          "type": "string",
          "nullable": true,
          "description": "Free-form device comment"
        },
        "characteristics": {
          "type": "object",
          "properties": {
            "screen_size": {
              "type": "string",
              "nullable": true
            },
            "graphic": {
              "type": "string",
              "nullable": true
            },
            "processor": {
              "type": "string",
              "nullable": true
            },
            "ram": {
              "type": "string",
              "nullable": true
            },
            "storage": {
              "type": "string",
              "nullable": true
            },
            "model_year": {
              "type": "string",
              "nullable": true
            },
            "connectivity": {
              "type": "string",
              "nullable": true
            },
            "keyboard_layout": {
              "type": "string",
              "nullable": true,
              "enum": [
                "FRENCH_AZERTY",
                "SPANISH_QWERTY",
                "ITALIAN_QWERTY",
                "INTERNATIONAL_ENGLISH_QWERTY",
                "GERMAN_QWERTZ",
                "PORTUGUESE_QWERTY",
                "ENGLISH_QWERTY",
                "SWISS_QWERTZ",
                "AMERICAN_ENGLISH_QWERTY",
                "CANADIAN_ENGLISH_QWERTY",
                "DUTCH_QWERTY"
              ],
              "description": "Keyboard layout for delivery pricing (maps to Fleet keyboard_layouts.type)",
              "example": "FRENCH_AZERTY"
            },
            "resolution": {
              "type": "string",
              "nullable": true
            },
            "has_microphone": {
              "type": "boolean",
              "nullable": true
            },
            "has_webcam": {
              "type": "boolean",
              "nullable": true
            },
            "noise_cancellation": {
              "type": "boolean",
              "nullable": true
            },
            "compliance": {
              "type": "array",
              "nullable": true,
              "items": {
                "type": "string"
              }
            },
            "connection_type": {
              "type": "array",
              "nullable": true,
              "items": {
                "type": "string"
              }
            },
            "has_stool": {
              "type": "boolean",
              "nullable": true
            },
            "has_video_package": {
              "type": "boolean",
              "nullable": true
            },
            "has_screen": {
              "type": "boolean",
              "nullable": true
            },
            "has_premium_tablet": {
              "type": "boolean",
              "nullable": true
            },
            "color": {
              "type": "string",
              "nullable": true
            },
            "seats_number": {
              "type": "string",
              "nullable": true
            },
            "assembly": {
              "type": "string",
              "nullable": true
            },
            "os_platform": {
              "type": "string",
              "nullable": true
            }
          },
          "required": [
            "screen_size",
            "graphic",
            "processor",
            "ram",
            "storage",
            "model_year",
            "connectivity",
            "keyboard_layout",
            "resolution",
            "has_microphone",
            "has_webcam",
            "noise_cancellation",
            "compliance",
            "connection_type",
            "has_stool",
            "has_video_package",
            "has_screen",
            "has_premium_tablet",
            "color",
            "seats_number",
            "assembly",
            "os_platform"
          ]
        },
        "mdm": {
          "type": "object",
          "nullable": true,
          "properties": {
            "id": {
              "type": "integer"
            },
            "status": {
              "type": "string",
              "enum": [
                "DRAFT",
                "SUBSCRIBED",
                "DOWNLOADED",
                "IDENTIFIED",
                "ENROLLMENT_IN_PROGRESS",
                "ENROLLED",
                "UNENROLLED",
                "DEVICE_WIPE_PENDING"
              ],
              "description": "Raw MDM enrollment status from `devices_mdm`. `DRAFT` rows are omitted by the device relation; other values match DB enum."
            },
            "local_name": {
              "type": "string",
              "nullable": true
            },
            "is_locked": {
              "type": "boolean",
              "nullable": true
            },
            "lock_date": {
              "type": "string",
              "nullable": true
            },
            "firewall_enabled": {
              "type": "boolean",
              "nullable": true
            },
            "os_updates_enabled": {
              "type": "boolean",
              "nullable": true
            },
            "is_encrypted": {
              "type": "boolean",
              "nullable": true
            },
            "screenlock_enabled": {
              "type": "boolean",
              "nullable": true
            },
            "is_compromised": {
              "type": "boolean",
              "nullable": true
            },
            "os_updates_available": {
              "type": "boolean",
              "nullable": true
            },
            "disk_encryption_profile_installed": {
              "type": "boolean",
              "nullable": true
            },
            "enrollment_date": {
              "type": "string",
              "nullable": true
            },
            "unenrollment_date": {
              "type": "string",
              "nullable": true
            },
            "download_date": {
              "type": "string",
              "nullable": true
            },
            "last_seen_date": {
              "type": "string",
              "nullable": true
            },
            "last_sync_date": {
              "type": "string",
              "nullable": true
            }
          },
          "required": [
            "id",
            "status",
            "local_name",
            "is_locked",
            "lock_date",
            "firewall_enabled",
            "os_updates_enabled",
            "is_encrypted",
            "screenlock_enabled",
            "is_compromised",
            "os_updates_available",
            "disk_encryption_profile_installed",
            "enrollment_date",
            "unenrollment_date",
            "download_date",
            "last_seen_date",
            "last_sync_date"
          ],
          "description": "MDM enrollment row when present (non-deleted, non-DRAFT); null otherwise"
        }
      },
      "required": [
        "id",
        "name",
        "serial_number",
        "rent",
        "tracking_number",
        "client_status",
        "type",
        "category",
        "source",
        "comment",
        "characteristics",
        "mdm"
      ]
    }
  },
  "required": [
    "data"
  ]
}
```

### 400

Validation or business rule error

**application/json**

_Schema ref:_ `#/components/schemas/PatchDeviceBadRequestResponse` (PatchDeviceBadRequestResponse)

```json
{
  "anyOf": [
    {
      "type": "object",
      "properties": {
        "error": {
          "type": "string"
        }
      },
      "required": [
        "error"
      ]
    },
    {
      "type": "object",
      "properties": {
        "error": {
          "type": "string",
          "enum": [
            "EMPTY_PATCH_BODY",
            "INVALID_SERIAL_NUMBER",
            "INVALID_USER",
            "KEYBOARD_LAYOUT_REQUIRED"
          ]
        }
      },
      "required": [
        "error"
      ]
    }
  ]
}
```

### 403

Forbidden

**application/json**

_Schema ref:_ `#/components/schemas/DeviceMutationForbiddenErrorResponse` (DeviceMutationForbiddenErrorResponse)

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "enum": [
        "INSUFFICIENT_SCOPE",
        "DEVICE_MUTATION_FORBIDDEN"
      ]
    }
  },
  "required": [
    "error"
  ]
}
```

### 404

Not found

**application/json**

_Schema ref:_ `#/components/schemas/DeviceNotFoundErrorResponse` (DeviceNotFoundErrorResponse)

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "enum": [
        "DEVICE_NOT_FOUND"
      ]
    }
  },
  "required": [
    "error"
  ]
}
```

## Security

```json
[
  {
    "bearerAuth": []
  }
]
```

**bearerAuth:** Bearer token using a Fleet platform API key (flt_sk_…).

---

_Generated from the OpenAPI specification for raw Markdown / tooling use._
