---
sidebar:
  hidden: true
title: roboto.domain.orgs.org_invite
---
## Module Contents

### OrgInvite

```python
class roboto.domain.orgs.org_invite.OrgInvite(
    record: roboto.domain.orgs.org_records.OrgInviteRecord,
    roboto_client: Optional[roboto.http.RobotoClient] = None,
)
```

`from roboto.domain.orgs import OrgInvite`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/orgs/org_invite.py#L14-L223)

An invitation to join an organization from one user to another.

Organization invitations allow existing members to invite new users to join their organization. Invitations are created by calling [`Org.invite_user()`](/reference/python-sdk/roboto/domain/orgs/org#roboto.domain.orgs.org.Org.invite_user) and can be accepted or declined by the invited user.

Invitations cannot be created directly through the constructor - they must be created through the organization's invite_user method.

**Parameters**

- **record** (`roboto.domain.orgs.org_records.OrgInviteRecord`)
- **roboto_client** (`Optional[roboto.http.RobotoClient]`)

**Properties**

- **OrgInvite.invite_id** (`str`): Unique identifier for this invitation.

  **Returns**

  - `str`: The invitation's unique ID.

- **OrgInvite.invited_by_user_id** (`str`): User ID of the person who created this invitation.

  **Returns**

  - `str`: The unique identifier of the user who sent the invitation.

- **OrgInvite.invited_user_id** (`str`): User ID of the person who was invited.

  **Returns**

  - `str`: The unique identifier of the invited user.

- **OrgInvite.org_id** (`str`): Organization ID for the organization this invitation is for.

  **Returns**

  - `str`: The unique identifier of the organization.

#### OrgInvite.accept()

```python
def accept() -> None
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/orgs/org_invite.py#L170-L187)

Accept this invitation and join the organization.

The invited user becomes a member of the organization with default user role permissions.

**Raises**

- [`RobotoUnauthorizedException`](/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoUnauthorizedException): The caller is not the invited user.
- [`RobotoInvalidRequestException`](/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoInvalidRequestException): The invitation has already been accepted or declined.

**Returns**

- `None`

**Usage**

Accept an invitation:

```python
from roboto import OrgInvite
invite = OrgInvite.from_id("invite_12345")
invite.accept()  # Join the organization
```

#### OrgInvite.create()

```python
@classmethod
def create(
    invited_user_id: str,
    org_id: str,
    roboto_client: Optional[roboto.http.RobotoClient] = None,
) -> OrgInvite
```

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

Create a new organization invitation.

Creates an invitation for the specified user to join the organization. This method is typically called internally by [`Org.invite_user()`](/reference/python-sdk/roboto/domain/orgs/org#roboto.domain.orgs.org.Org.invite_user).

**Parameters**

- **invited_user_id** (`str`): Unique identifier for the user to invite.
- **org_id** (`str`): Unique identifier for the organization.
- **roboto_client** (`Optional[roboto.http.RobotoClient]`): Optional Roboto client instance. If not provided, uses the default client.

**Returns**

- `OrgInvite`: A new OrgInvite instance representing the created invitation.

**Raises**

- [`RobotoNotFoundException`](/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoNotFoundException): The user or organization does not exist.
- [`RobotoInvalidRequestException`](/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoInvalidRequestException): The user is already a member or has a pending invite.
- [`RobotoUnauthorizedException`](/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoUnauthorizedException): The caller lacks permission to invite users.

**Usage**

Create an invitation (typically done via Org.invite_user):

```python
from roboto import OrgInvite
invite = OrgInvite.create("alice@example.com", "org_12345")
```

#### OrgInvite.decline()

```python
def decline() -> None
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/orgs/org_invite.py#L189-L205)

Decline this invitation and do not join the organization.

The invitation is marked as declined and cannot be accepted later.

**Raises**

- [`RobotoUnauthorizedException`](/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoUnauthorizedException): The caller is not the invited user.
- [`RobotoInvalidRequestException`](/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoInvalidRequestException): The invitation has already been accepted or declined.

**Returns**

- `None`

**Usage**

Decline an invitation:

```python
from roboto import OrgInvite
invite = OrgInvite.from_id("invite_12345")
invite.decline()  # Do not join the organization
```

#### OrgInvite.for_org()

```python
@classmethod
def for_org(
    org_id: str,
    roboto_client: Optional[roboto.http.RobotoClient] = None,
) -> collections.abc.Collection[OrgInvite]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/orgs/org_invite.py#L94-L121)

Retrieve all pending invitations for an organization.

**Parameters**

- **org_id** (`str`): Unique identifier for the organization.
- **roboto_client** (`Optional[roboto.http.RobotoClient]`): Optional Roboto client instance. If not provided, uses the default client.

**Returns**

- `collections.abc.Collection[OrgInvite]`: Collection of OrgInvite instances for pending invitations.

**Raises**

- [`RobotoNotFoundException`](/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoNotFoundException): The organization does not exist.
- [`RobotoUnauthorizedException`](/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoUnauthorizedException): The caller lacks permission to view invitations.

**Usage**

List all invitations for an organization:

```python
from roboto import OrgInvite
invites = OrgInvite.for_org("org_12345")
for invite in invites:
    print(f"Pending invite for: {invite.invited_user_id}")
```

#### OrgInvite.from_id()

```python
@classmethod
def from_id(
    invite_id: str,
    roboto_client: Optional[roboto.http.RobotoClient] = None,
) -> OrgInvite
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/orgs/org_invite.py#L67-L91)

Load an existing invitation by its unique ID.

**Parameters**

- **invite_id** (`str`): Unique identifier for the invitation to retrieve.
- **roboto_client** (`Optional[roboto.http.RobotoClient]`): Optional Roboto client instance. If not provided, uses the default client.

**Returns**

- `OrgInvite`: OrgInvite instance for the specified invitation ID.

**Raises**

- [`RobotoNotFoundException`](/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoNotFoundException): No invitation exists with the specified ID.
- [`RobotoUnauthorizedException`](/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoUnauthorizedException): The caller is not authorized to access this invitation.

**Usage**

Load an invitation by ID:

```python
from roboto import OrgInvite
invite = OrgInvite.from_id("invite_12345")
print(f"Invited user: {invite.invited_user_id}")
```

#### OrgInvite.to_dict()

```python
def to_dict() -> dict[str, Any]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/orgs/org_invite.py#L207-L223)

Convert this invitation to a dictionary representation.

Returns a JSON-serializable dictionary containing all invitation data.

**Returns**

- `dict[str, Any]`: Dictionary representation of the invitation.

**Usage**

Export invitation data:

```python
from roboto import OrgInvite
invite = OrgInvite.from_id("invite_12345")
invite_data = invite.to_dict()
print(f"Invited user: {invite_data.get('user_id')}")
```
