---
sidebar:
  hidden: true
title: roboto.domain.devices.operations
---
## Module Contents

### CreateDeviceRequest

```python
class roboto.domain.devices.operations.CreateDeviceRequest(/, **data: Any)
```

`from roboto import CreateDeviceRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/devices/operations.py#L55-L108)

Bases: `pydantic.BaseModel`

Request body for [`create()`](/docs/reference/python-sdk/roboto/domain/devices/device#roboto.domain.devices.device.Device.create).

Building one with a `device_id` that `validate_device_id` refuses raises `pydantic.ValidationError`.

**Parameters**

- **data** (`Any`)

**Attributes**

- **CreateDeviceRequest.custom_fields** (`dict[str, Any] | None`) = `None`: Initial values for the device's custom fields, keyed by field name. `None` sets none.

  Each name must be a [`CustomField`](/docs/reference/python-sdk/roboto/domain/custom_fields/custom_field#roboto.domain.custom_fields.custom_field.CustomField) defined for [`Device`](/docs/reference/python-sdk/roboto/domain/custom_fields/record#roboto.domain.custom_fields.record.TargetEntityType.Device) in the organization the device is created in, with status [`Ready`](/docs/reference/python-sdk/roboto/domain/custom_fields/record#roboto.domain.custom_fields.record.CustomFieldStatus.Ready), and each value must match that field's declared type. Otherwise the request fails with [`RobotoIllegalArgumentException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoIllegalArgumentException).

- **CreateDeviceRequest.device_id** (`str`): ID of the device, chosen by the caller and unique within the device's organization.

  `validate_device_id` lists the IDs Roboto refuses.

- **CreateDeviceRequest.device_type_id** (`str | None`) = `None`: ID of the device type to assign to the device, beginning with `dt_`. `None` leaves the device without one.

  The device type must be in the organization the device is created in; any other raises `RobotoInvalidRequestException`.

- **CreateDeviceRequest.metadata** (`dict[str, Any]`) = `None`: Key-value metadata to set on the device.

- **CreateDeviceRequest.org_id** (`str | None`) = `None`: Organization to create the device in.

  Roboto ignores it and uses the organization the request acts in instead. [`create()`](/docs/reference/python-sdk/roboto/domain/devices/device#roboto.domain.devices.device.Device.create) sets both from its `caller_org_id`, so they agree.

- **CreateDeviceRequest.tags** (`list[str]`) = `None`: Tags to set on the device. Defaults to none.

### INVALID_DEVICE_ID_MESSAGE

```python
roboto.domain.devices.operations.INVALID_DEVICE_ID_MESSAGE = 'A device ID must not be empty, `.` or `..`, and must not contain control characters or any of...
```

`from roboto.domain.devices import INVALID_DEVICE_ID_MESSAGE`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/devices/operations.py#L16-L19)

Error message for a device ID that `validate_device_id` refuses.

### InferDevicesRequest

```python
class roboto.domain.devices.operations.InferDevicesRequest(/, **data: Any)
```

`from roboto.domain.devices.operations import InferDevicesRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/devices/operations.py#L140-L150)

Bases: `pydantic.BaseModel`

Request body for `POST /v1/devices/infer`.

The response lists the devices a session created from these files would be attached to: every device set as `device_id` on one of the files or on its dataset. The request creates and changes nothing.

**Parameters**

- **data** (`Any`)

**Attributes**

- **InferDevicesRequest.file_ids** (`list[str]`): IDs of the files to infer devices from. A file outside the request's organization adds no devices.
- **InferDevicesRequest.model_config**: Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

### InferDevicesResponse

```python
class roboto.domain.devices.operations.InferDevicesResponse(/, **data: Any)
```

`from roboto.domain.devices.operations import InferDevicesResponse`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/devices/operations.py#L153-L159)

Bases: `pydantic.BaseModel`

Response body of `POST /v1/devices/infer`.

**Parameters**

- **data** (`Any`)

**Attributes**

- **InferDevicesResponse.device_ids** (`list[str]`): IDs of the inferred devices, each listed once, in no particular order.
- **InferDevicesResponse.model_config**: Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

### UpdateDeviceRequest

```python
class roboto.domain.devices.operations.UpdateDeviceRequest(/, **data: Any)
```

`from roboto.domain.devices import UpdateDeviceRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/devices/operations.py#L111-L137)

Bases: `pydantic.BaseModel`

Request body for [`update()`](/docs/reference/python-sdk/roboto/domain/devices/device#roboto.domain.devices.device.Device.update).

A field left at its default (`NotSet` or `None`) is unchanged.

**Parameters**

- **data** (`Any`)

**Attributes**

- **UpdateDeviceRequest.custom_fields_changeset** (`roboto.updates.CustomFieldChangeset | None`) = `None`: Changes to the device's custom-field values.

  Each field name the changeset references must be a custom field defined for [`Device`](/docs/reference/python-sdk/roboto/domain/custom_fields/record#roboto.domain.custom_fields.record.TargetEntityType.Device) in the device's organization, with status [`Ready`](/docs/reference/python-sdk/roboto/domain/custom_fields/record#roboto.domain.custom_fields.record.CustomFieldStatus.Ready), and each `set_fields` value must match that field's declared type. Otherwise the request fails with [`RobotoIllegalArgumentException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoIllegalArgumentException). See [`CustomFieldChangeset`](/docs/reference/python-sdk/roboto/updates#roboto.updates.CustomFieldChangeset).

- **UpdateDeviceRequest.device_type_id** (`str | roboto.sentinels.NotSetType | None`): ID of the device type to assign to the device, beginning with `dt_`. `None` removes the device's type.

  The device type must be in the device's organization; any other raises `RobotoInvalidRequestException`.

- **UpdateDeviceRequest.metadata_changeset** (`roboto.updates.MetadataChangeset | None`) = `None`: Changes to the device's tags and metadata.

- **UpdateDeviceRequest.model_config**: Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

### validate_device_id()

```python
def roboto.domain.devices.operations.validate_device_id(device_id: str) -> str
```

`from roboto.domain.devices import validate_device_id`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/devices/operations.py#L23-L52)

Reject a device ID that a new device may not have.

A device ID must not be empty, `.` or `..`, and must not contain a control character (such as a tab or a newline) or any of `:`, `@`, `/`, `?`, `#` and `%`. Any other ID is allowed, including one with spaces, other punctuation or non-ASCII letters.

**Parameters**

- **device_id** (`str`): Device ID to check.

**Returns**

- `str`: `device_id`, unchanged.

**Raises**

- `pydantic_core.PydanticCustomError`: `device_id` is not allowed. Its message is `INVALID_DEVICE_ID_MESSAGE`.
