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

### CreateCustomFieldRequest

```python
class roboto.domain.custom_fields.operations.CreateCustomFieldRequest(/, **data: Any)
```

`from roboto.domain.custom_fields import CreateCustomFieldRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/custom_fields/operations.py#L118-L182)

Bases: `pydantic.BaseModel`

Request body for `POST /v1/custom-fields`.

Defines a new custom field for an entity type in the caller's organization. Normally constructed by [`create()`](/reference/python-sdk/roboto/domain/custom_fields/custom_field#roboto.domain.custom_fields.custom_field.CustomField.create) rather than instantiated directly.

**Parameters**

- **data** (`Any`)

**Attributes**

- **CreateCustomFieldRequest.description** (`FieldDescription | None`) = `None`: Long-form description of the field's meaning.

  Surrounding whitespace is removed. Text that is empty once stripped counts as unset.

- **CreateCustomFieldRequest.display_name** (`FieldDisplayName | None`) = `None`: Human-readable label shown in the UI.

  Surrounding whitespace is removed. Text that is empty once stripped counts as unset.

- **CreateCustomFieldRequest.entity_type** (`roboto.domain.custom_fields.record.TargetEntityType`): Roboto entity type the field extends.

- **CreateCustomFieldRequest.field_name** (`Annotated[str, pydantic.StringConstraints(pattern=f'^{CUSTOM_FIELD_NAME_PATTERN}$')]`): Name of the field. Fixed at creation time.

  Must match `^[a-z][a-z0-9_]{0,62}$` (lowercase ASCII, max 63 chars) and is unique within `(org_id, entity_type)`.

- **CreateCustomFieldRequest.field_type** (`roboto.domain.custom_fields.record.CustomFieldType`): Value type of the field.

  Determines which operators are supported in search and sort.

- **CreateCustomFieldRequest.metadata_path** (`str | None`) = `None`: Reserved for promoting an existing metadata key into a custom field.

  Not yet supported; leave as `None`. Supplying a value is rejected.

- **CreateCustomFieldRequest.options** (`ValidatedCustomFieldOptions | None`) = `None`: Type-specific configuration.

  Required for [`CustomFieldType.Enum`](/reference/python-sdk/roboto/domain/custom_fields/record#roboto.domain.custom_fields.record.CustomFieldType.Enum) fields (to declare the allowed values).

  Enum values are tidied before they are stored: each is normalized to Unicode NFC, surrounding whitespace is removed, internal runs of whitespace become a single space, and values that repeat after that are deduplicated. A field may declare at most 250 distinct values, each at most 256 characters long as supplied, not counting surrounding whitespace.

  A value is rejected if it is blank, or if it contains a control character, a double quote, or a backslash: a value carrying one of those cannot be relied on to work in search.

#### CreateCustomFieldRequest.check_options_match_field_type()

```python
def check_options_match_field_type() -> CreateCustomFieldRequest
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/custom_fields/operations.py#L180-L182)

**Returns**

- `CreateCustomFieldRequest`

### FieldDescription

```python
type roboto.domain.custom_fields.operations.FieldDescription = Annotated[str, pydantic.StringConstraints(max_length=256)]
```

`from roboto.domain.custom_fields.operations import FieldDescription`

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

Long-form description of a custom field. Up to 256 characters.

### FieldDisplayName

```python
type roboto.domain.custom_fields.operations.FieldDisplayName = Annotated[str, pydantic.StringConstraints(max_length=128)]
```

`from roboto.domain.custom_fields.operations import FieldDisplayName`

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

Human-readable label for a custom field. Up to 128 characters.

### ListCustomFieldsRequest

```python
class roboto.domain.custom_fields.operations.ListCustomFieldsRequest(/, **data: Any)
```

`from roboto.domain.custom_fields import ListCustomFieldsRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/custom_fields/operations.py#L186-L201)

Bases: `pydantic.BaseModel`

Request body for `POST /v1/custom-fields/query`.

Pages through the custom fields visible to the caller, optionally filtered by entity type and status. Normally constructed by [`list()`](/reference/python-sdk/roboto/domain/custom_fields/custom_field#roboto.domain.custom_fields.custom_field.CustomField.list) rather than directly.

**Parameters**

- **data** (`Any`)

**Attributes**

- **ListCustomFieldsRequest.entity_type** (`roboto.domain.custom_fields.record.TargetEntityType | None`) = `None`: If provided, restrict results to fields targeting this entity type.
- **ListCustomFieldsRequest.page_token** (`str | None`) = `None`: Opaque token returned by a prior page; omit on the first request.
- **ListCustomFieldsRequest.statuses** (`list[roboto.domain.custom_fields.record.CustomFieldStatus]`) = `None`: Statuses to include in the results. Must contain at least one status.

### UpdateCustomFieldRequest

```python
class roboto.domain.custom_fields.operations.UpdateCustomFieldRequest(/, **data: Any)
```

`from roboto.domain.custom_fields import UpdateCustomFieldRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/custom_fields/operations.py#L205-L248)

Bases: `pydantic.BaseModel`

Request body for `POST /v1/custom-fields/{field_id}`.

Carries mutable metadata changes for an existing custom field. Each request attribute defaults to [`NotSet`](/reference/python-sdk/roboto/sentinels#roboto.sentinels.NotSet), which leaves the corresponding attribute unchanged; pass `None` explicitly to clear an attribute.

**Parameters**

- **data** (`Any`)

**Attributes**

- **UpdateCustomFieldRequest.description** (`FieldDescription | None | roboto.sentinels.NotSetType`): New description for the field, or `None` to clear it.

  Leave as [`NotSet`](/reference/python-sdk/roboto/sentinels#roboto.sentinels.NotSet) to leave unchanged. Surrounding whitespace is removed, and text that is empty once stripped clears the attribute.

- **UpdateCustomFieldRequest.display_name** (`FieldDisplayName | None | roboto.sentinels.NotSetType`): New display name for the field, or `None` to clear it.

  Leave as [`NotSet`](/reference/python-sdk/roboto/sentinels#roboto.sentinels.NotSet) to leave unchanged. Surrounding whitespace is removed, and text that is empty once stripped clears the attribute.

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

- **UpdateCustomFieldRequest.options** (`ValidatedCustomFieldOptions | roboto.sentinels.NotSetType`): Replacement type-specific configuration for the field.

  Leave as [`NotSet`](/reference/python-sdk/roboto/sentinels#roboto.sentinels.NotSet) to leave unchanged. Must be for the field's `field_type`. For an enum field, the new `enum_values` must include every existing value: values can be added but not removed. Values are tidied and capped exactly as they are at creation. A value that repeats an earlier one in `enum_values`, once tidied, is discarded rather than rejected, so re-sending a value the field already has changes nothing and raises nothing.

### ValidatedCustomFieldOptions

```python
type roboto.domain.custom_fields.operations.ValidatedCustomFieldOptions = Annotated[CustomFieldOptions, pydantic.AfterValidator(_validate_field_options)]
```

`from roboto.domain.custom_fields.operations import ValidatedCustomFieldOptions`

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

Custom field options as supplied when a field is defined or updated - tidied and checked.

### check_options_match_field_type()

```python
def roboto.domain.custom_fields.operations.check_options_match_field_type(
    field_type: roboto.domain.custom_fields.record.CustomFieldType,
    options: Optional[roboto.domain.custom_fields.record.CustomFieldOptions],
) -> None
```

`from roboto.domain.custom_fields.operations import check_options_match_field_type`

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

Raise `ValueError` if `options` are missing for, or don't belong to, a field of `field_type`.

**Parameters**

- **field_type** (`roboto.domain.custom_fields.record.CustomFieldType`)
- **options** (`Optional[roboto.domain.custom_fields.record.CustomFieldOptions]`)

**Returns**

- `None`
