Skip to content

workspaces

CreateWorkspaceRequest

Bases: TypedDict

Class representation of a Nylas create workspace request.

Attributes:

Name Type Description
name str

The descriptive workspace name. Required.

domain NotRequired[str]

The top-level email domain to group grants by.

auto_group NotRequired[bool]

When true, new grants whose email domain matches domain are auto-assigned. Defaults server-side to true when a domain is provided, false otherwise.

policy_id NotRequired[str]

Inbox policy to attach to the workspace (UUID).

rule_ids NotRequired[List[str]]

Inbox rules to attach to the workspace (list of UUIDs).

Source code in nylas/models/workspaces.py
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
class CreateWorkspaceRequest(TypedDict):
    """
    Class representation of a Nylas create workspace request.

    Attributes:
        name: The descriptive workspace name. Required.
        domain: The top-level email domain to group grants by.
        auto_group: When true, new grants whose email domain matches `domain` are
            auto-assigned. Defaults server-side to true when a domain is provided,
            false otherwise.
        policy_id: Inbox policy to attach to the workspace (UUID).
        rule_ids: Inbox rules to attach to the workspace (list of UUIDs).
    """

    name: str
    domain: NotRequired[str]
    auto_group: NotRequired[bool]
    policy_id: NotRequired[str]
    rule_ids: NotRequired[List[str]]

UpdateWorkspaceRequest

Bases: TypedDict

Class representation of a Nylas update workspace request.

At least one field must be present. The workspace's domain is immutable; sending a changed domain is rejected by the API.

Attributes:

Name Type Description
name NotRequired[str]

A new non-empty workspace name.

domain NotRequired[str]

The workspace domain. Validated but immutable; changing it is rejected.

auto_group NotRequired[bool]

Whether to auto-group matching grants. Cannot be set to true on a workspace with an empty domain.

policy_id NotRequired[Optional[str]]

Inbox policy to attach (UUID). Send None to clear, omit to preserve.

rule_ids NotRequired[Optional[List[str]]]

Inbox rules to attach (list of UUIDs). Send a list (including []) to overwrite, omit to preserve.

Source code in nylas/models/workspaces.py
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
class UpdateWorkspaceRequest(TypedDict):
    """
    Class representation of a Nylas update workspace request.

    At least one field must be present. The workspace's domain is immutable; sending
    a changed domain is rejected by the API.

    Attributes:
        name: A new non-empty workspace name.
        domain: The workspace domain. Validated but immutable; changing it is rejected.
        auto_group: Whether to auto-group matching grants. Cannot be set to true on a
            workspace with an empty domain.
        policy_id: Inbox policy to attach (UUID). Send `None` to clear, omit to preserve.
        rule_ids: Inbox rules to attach (list of UUIDs). Send a list (including `[]`)
            to overwrite, omit to preserve.
    """

    name: NotRequired[str]
    domain: NotRequired[str]
    auto_group: NotRequired[bool]
    policy_id: NotRequired[Optional[str]]
    rule_ids: NotRequired[Optional[List[str]]]

Workspace dataclass

Class representing a Nylas workspace.

A workspace groups grants in a Nylas application by email domain. Grants can be auto-grouped (by matching email domain) or manually assigned/removed.

Attributes:

Name Type Description
workspace_id str

Globally unique workspace identifier (UUID).

application_id str

The owning Nylas application UUID.

name str

Descriptive workspace name.

domain str

Top-level email domain. May be an empty string when the workspace was created with auto_group=false and no domain.

auto_group bool

When true, new grants whose email domain matches domain are automatically assigned to the workspace.

default Optional[bool]

When true, this is the application's default workspace.

created_at int

Creation timestamp, represented as a Unix timestamp in seconds.

updated_at int

Last-update timestamp, represented as a Unix timestamp in seconds.

policy_id Optional[str]

Inbox policy attached to the workspace (UUID).

rule_ids Optional[List[str]]

Inbox rules attached to the workspace (list of UUIDs).

Source code in nylas/models/workspaces.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
@dataclass_json
@dataclass
class Workspace:
    """
    Class representing a Nylas workspace.

    A workspace groups grants in a Nylas application by email domain. Grants can
    be auto-grouped (by matching email domain) or manually assigned/removed.

    Attributes:
        workspace_id: Globally unique workspace identifier (UUID).
        application_id: The owning Nylas application UUID.
        name: Descriptive workspace name.
        domain: Top-level email domain. May be an empty string when the workspace was
            created with auto_group=false and no domain.
        auto_group: When true, new grants whose email domain matches `domain` are
            automatically assigned to the workspace.
        default: When true, this is the application's default workspace.
        created_at: Creation timestamp, represented as a Unix timestamp in seconds.
        updated_at: Last-update timestamp, represented as a Unix timestamp in seconds.
        policy_id: Inbox policy attached to the workspace (UUID).
        rule_ids: Inbox rules attached to the workspace (list of UUIDs).
    """

    workspace_id: str
    application_id: str
    name: str
    domain: str
    auto_group: bool
    created_at: int
    updated_at: int
    default: Optional[bool] = None
    policy_id: Optional[str] = None
    rule_ids: Optional[List[str]] = None

WorkspaceAutoGroupRequest

Bases: TypedDict

Class representation of a Nylas workspace auto-group request.

All fields are optional.

Attributes:

Name Type Description
after_created_at NotRequired[int]

Only group grants created at/after this Unix timestamp.

invalid_also NotRequired[bool]

When true, includes invalid grants in the grouping pass. Defaults to false.

specific_domain NotRequired[str]

Only group grants whose email domain matches this domain.

Source code in nylas/models/workspaces.py
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
class WorkspaceAutoGroupRequest(TypedDict):
    """
    Class representation of a Nylas workspace auto-group request.

    All fields are optional.

    Attributes:
        after_created_at: Only group grants created at/after this Unix timestamp.
        invalid_also: When true, includes invalid grants in the grouping pass.
            Defaults to false.
        specific_domain: Only group grants whose email domain matches this domain.
    """

    after_created_at: NotRequired[int]
    invalid_also: NotRequired[bool]
    specific_domain: NotRequired[str]

WorkspaceAutoGroupResponse dataclass

Class representing the response from starting a workspace auto-group job.

Attributes:

Name Type Description
job_id str

The background job ID (UUID).

message str

A human-readable message describing the started job.

Source code in nylas/models/workspaces.py
44
45
46
47
48
49
50
51
52
53
54
55
56
@dataclass_json
@dataclass
class WorkspaceAutoGroupResponse:
    """
    Class representing the response from starting a workspace auto-group job.

    Attributes:
        job_id: The background job ID (UUID).
        message: A human-readable message describing the started job.
    """

    job_id: str
    message: str

WorkspaceManualAssignRequest

Bases: TypedDict

Class representation of a Nylas workspace manual-assign request.

At least one of assign_grants or remove_grants must contain a grant ID.

Attributes:

Name Type Description
assign_grants NotRequired[List[str]]

Grant IDs to assign to the workspace. Max 500 entries.

remove_grants NotRequired[List[str]]

Grant IDs to remove from the workspace. Max 500 entries.

Source code in nylas/models/workspaces.py
145
146
147
148
149
150
151
152
153
154
155
156
157
class WorkspaceManualAssignRequest(TypedDict):
    """
    Class representation of a Nylas workspace manual-assign request.

    At least one of `assign_grants` or `remove_grants` must contain a grant ID.

    Attributes:
        assign_grants: Grant IDs to assign to the workspace. Max 500 entries.
        remove_grants: Grant IDs to remove from the workspace. Max 500 entries.
    """

    assign_grants: NotRequired[List[str]]
    remove_grants: NotRequired[List[str]]

WorkspaceManualAssignResponse dataclass

Class representing the response from manually assigning/removing grants.

Attributes:

Name Type Description
application_id str

The application owning the workspace (UUID).

workspace_id str

The workspace that was updated (UUID).

domain str

The workspace domain (empty string if none).

grants_assigned Optional[List[str]]

Grant IDs that were actually assigned. Serializes as null (deserialized as None) when no assigned grant matched.

grants_removed Optional[List[str]]

Grant IDs that were actually removed. Serializes as null (deserialized as None) when no removed grant matched.

Source code in nylas/models/workspaces.py
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
@dataclass_json
@dataclass
class WorkspaceManualAssignResponse:
    """
    Class representing the response from manually assigning/removing grants.

    Attributes:
        application_id: The application owning the workspace (UUID).
        workspace_id: The workspace that was updated (UUID).
        domain: The workspace domain (empty string if none).
        grants_assigned: Grant IDs that were actually assigned. Serializes as `null`
            (deserialized as None) when no assigned grant matched.
        grants_removed: Grant IDs that were actually removed. Serializes as `null`
            (deserialized as None) when no removed grant matched.
    """

    application_id: str
    workspace_id: str
    domain: str
    grants_assigned: Optional[List[str]] = None
    grants_removed: Optional[List[str]] = None