---
title: User
description: Represents a user owner of teamspaces and studios.
canonical: 'https://lightning.ai/docs/sdk/stable/api/user'
---
# User {#user}

### `class lightning_sdk.User(name=None)` {#lightning_sdk.User}

Bases: [`Owner`](/docs/sdk/2026.11.04/api/owner.md#lightning_sdk.owner.Owner "lightning_sdk.owner.Owner")

Represents a user owner of teamspaces and studios.

Parameters:

*   **name** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")\[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")\]) – the name of the user
    
*   **name** ([_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") _|_ _None_)
    

Note

Arguments will be automatically inferred from environment variables if possible, unless explicitly specified

#### `create_teamspace(name)` {#lightning_sdk.User.create_teamspace}

Create a new teamspace owned by this user.

Can only be called for the currently authenticated user.

Parameters:

*   **name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")) – The name for the new teamspace.
    
*   **name** ([_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)"))
    

Returns:

The newly created teamspace.

Return type:

[Teamspace](/docs/sdk/2026.11.04/api/teamspace.md#lightning_sdk.Teamspace "lightning_sdk.Teamspace")

Raises:

[**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError "(in Python v3.15)") – If called for a user other than the authenticated user.

#### `delete_secret(key)` {#lightning_sdk.User.delete_secret}

Delete an encrypted secret for the user.

Parameters:

*   **key** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")) – Secret name. Must contain only alphanumeric characters and underscores, and must not start with a digit.
    
*   **key** ([_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)"))
    

Raises:

[**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError "(in Python v3.15)") – If the key contains invalid characters or does not exist.

Return type:

[`None`](https://docs.python.org/3/builtins/constants.html#None "(in Python v3.15)")

#### `set_secret(key, value)` {#lightning_sdk.User.set_secret}

Set an encrypted secret for the user.

Parameters:

*   **key** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")) – Secret name. Must contain only alphanumeric characters and underscores, and must not start with a digit.
    
*   **value** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")) – The secret value to store (encrypted at rest).
    
*   **key** ([_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)"))
    
*   **value** ([_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)"))
    

Raises:

[**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError "(in Python v3.15)") – If the key contains invalid characters.

Return type:

[`None`](https://docs.python.org/3/builtins/constants.html#None "(in Python v3.15)")

#### `property id: str` {#lightning_sdk.User.id}

The user’s ID.

#### `property name: str` {#lightning_sdk.User.name}

The user’s name.

#### `property organizations: List[Organization]` {#lightning_sdk.User.organizations}

All organizations the user belongs to.

Can only be retrieved for the currently authenticated user.

Returns:

The organizations this user is a member of.

Return type:

[list](https://docs.python.org/3/builtins/stdtypes.html#list "(in Python v3.15)")\[[Organization](/docs/sdk/2026.11.04/api/organization.md#lightning_sdk.Organization "lightning_sdk.Organization")\]

Raises:

[**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError "(in Python v3.15)") – If called for a user other than the authenticated user.

#### `property secrets: Dict[str, str]` {#lightning_sdk.User.secrets}

All (encrypted) secrets for the user.

Note

Once created, the secret values are encrypted and cannot be viewed here anymore.

---

**Navigation**

- Parent: [API Reference](/docs/sdk/2026.11.04/api.md)
