---
sidebar:
  label: roboto.principal
  order: 18
title: roboto.principal
---
## Module Contents

### RobotoPrincipal

```python
class roboto.principal.RobotoPrincipal(/, **data: Any)
```

`from roboto.principal import RobotoPrincipal`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/principal.py#L33-L141)

Bases: `pydantic.BaseModel`

Represents a principal (user, organization, device, etc.) in the Roboto platform.

**Parameters**

- **data** (`Any`)

**Attributes**

- **RobotoPrincipal.id** (`str`): Fully qualified principal ID.

  For resources which have universally unique IDs (e.g. users, orgs, invocations, datasets, files, etc.) this will just be the resource ID.

  For resources which have org-unique IDs (e.g. devices, actions), this will be the resource ID + "@" + the org ID, e.g. a device `sn001` in org `og_67890` will have a fully qualified ID of `sn001@og_67890`.

- **RobotoPrincipal.ptype** (`RobotoPrincipalType`): The type of principal (user or organization).

#### RobotoPrincipal.for_device()

```python
@classmethod
def for_device(device_id: str, org_id: str) -> RobotoPrincipal
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/principal.py#L57-L67)

Create a principal representing a device.

**Parameters**

- **device_id** (`str`): Unique identifier for the device.
- **org_id** (`str`): Organization ID that owns the device.

**Returns**

- `RobotoPrincipal`: A RobotoPrincipal instance configured for the specified device.

#### RobotoPrincipal.for_integration()

```python
@classmethod
def for_integration(integration_id: str) -> RobotoPrincipal
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/principal.py#L70-L79)

Create a principal representing a third-party integration.

**Parameters**

- **integration_id** (`str`): Unique identifier for the integration.

**Returns**

- `RobotoPrincipal`: A RobotoPrincipal instance configured for the specified integration.

#### RobotoPrincipal.for_invocation()

```python
@classmethod
def for_invocation(invocation_id: str) -> RobotoPrincipal
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/principal.py#L82-L91)

Create a principal representing an invocation.

**Parameters**

- **invocation_id** (`str`): Unique identifier for the invocation.

**Returns**

- `RobotoPrincipal`: A RobotoPrincipal instance configured for the specified invocation.

#### RobotoPrincipal.for_org()

```python
@classmethod
def for_org(org_id: str) -> RobotoPrincipal
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/principal.py#L94-L103)

Create a principal representing an organization.

**Parameters**

- **org_id** (`str`): Unique identifier for the organization.

**Returns**

- `RobotoPrincipal`: A RobotoPrincipal instance configured for the specified organization.

#### RobotoPrincipal.for_user()

```python
@classmethod
def for_user(user_id: str) -> RobotoPrincipal
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/principal.py#L106-L115)

Create a principal representing a user.

**Parameters**

- **user_id** (`str`): Unique identifier for the user.

**Returns**

- `RobotoPrincipal`: A RobotoPrincipal instance configured for the specified user.

#### RobotoPrincipal.from_string()

```python
@classmethod
def from_string(serialized_principal: str) -> RobotoPrincipal
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/principal.py#L118-L133)

Create a principal from a serialized string representation.

**Parameters**

- **serialized_principal** (`str`): String in format "ptype:id".

**Returns**

- `RobotoPrincipal`: A RobotoPrincipal instance parsed from the string.

**Raises**

- `ValueError`: If the serialized principal is not in the correct format.

#### RobotoPrincipal.validate_id()

```python
def validate_id(value: str) -> str
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/principal.py#L50-L54)

**Parameters**

- **value** (`str`)

**Returns**

- `str`

### RobotoPrincipalType

```python
class roboto.principal.RobotoPrincipalType
```

`from roboto.principal import RobotoPrincipalType`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/principal.py#L14-L30)

Bases: `roboto.compat.StrEnum`

Types of principals supported by the Roboto platform.

**Attributes**

- **RobotoPrincipalType.Device** = `'device'`: See [`roboto.domain.devices.Device`](/reference/python-sdk/roboto/domain/devices/device#roboto.domain.devices.device.Device).
- **RobotoPrincipalType.Integration** = `'integration'`: A third-party integration which has been granted limited access to the Roboto platform.
- **RobotoPrincipalType.Invocation** = `'invocation'`: See [`roboto.domain.actions.Invocation`](/reference/python-sdk/roboto/domain/actions/invocation#roboto.domain.actions.invocation.Invocation).
- **RobotoPrincipalType.Org** = `'org'`: See [`roboto.domain.orgs.Org`](/reference/python-sdk/roboto/domain/orgs/org#roboto.domain.orgs.org.Org).
- **RobotoPrincipalType.User** = `'user'`: See [`roboto.domain.users.User`](/reference/python-sdk/roboto/domain/users/user#roboto.domain.users.user.User).
