Skip to content

AccountUser

List all account users.

GET /account/user

Returns:

Type Description
Dict[str, Any]

Dict[str, Any]: List of account users.

Source code in nukiwebapi/account_user.py
13
14
15
16
17
18
19
20
21
22
def list_account_users(self) -> Dict[str, Any]:
    """
    List all account users.

    GET /account/user

    Returns:
        Dict[str, Any]: List of account users.
    """
    return self.client._request("GET", "/account/user").json()

Create a new account user.

PUT /account/user

Parameters:

Name Type Description Default
email str

Email of the user (mandatory).

required
name str

Name of the user (mandatory).

required
type int

User type, 0 = user, 1 = company.

None
language str

Language code. Allowed: ["en", "de", "es", "fr", "it", "nl", "cs", "sk"]

None

Returns:

Type Description
Dict[str, Any]

Dict[str, Any]: Created account user representation.

Source code in nukiwebapi/account_user.py
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
def create_account_user(
    self,
    email: str,
    name: str,
    type: Optional[int] = None,
    language: Optional[str] = None
) -> Dict[str, Any]:
    """
    Create a new account user.

    PUT /account/user

    Args:
        email (str): Email of the user (mandatory).
        name (str): Name of the user (mandatory).
        type (int, optional): User type, 0 = user, 1 = company.
        language (str, optional): Language code. Allowed: ["en", "de", "es", "fr", "it", "nl", "cs", "sk"]

    Returns:
        Dict[str, Any]: Created account user representation.
    """
    payload = {"email": email, "name": name}

    if type is not None:
        if type not in (0, 1):
            raise ValueError("type must be 0 (user) or 1 (company)")
        payload["type"] = str(type)

    if language is not None:
        if language not in self.ALLOWED_LANGUAGES:
            raise ValueError(f"language must be one of {self.ALLOWED_LANGUAGES}")
        payload["language"] = language

    return self.client._request("PUT", "/account/user", json=payload).json()

Get details of a specific account user.

GET /account/user/{accountUserId}

Parameters:

Name Type Description Default
account_user_id int

ID of the account user to retrieve.

required

Returns:

Type Description
Dict[str, Any]

Dict[str, Any]: Account user representation.

Source code in nukiwebapi/account_user.py
59
60
61
62
63
64
65
66
67
68
69
70
71
def get_account_user(self, account_user_id: int) -> Dict[str, Any]:
    """
    Get details of a specific account user.

    GET /account/user/{accountUserId}

    Args:
        account_user_id (int): ID of the account user to retrieve.

    Returns:
        Dict[str, Any]: Account user representation.
    """
    return self.client._request("GET", f"/account/user/{account_user_id}").json()

Update details of a specific account user.

POST /account/user/{accountUserId}

Parameters:

Name Type Description Default
account_user_id int

ID of the account user to update.

required
email str

New email (mandatory).

required
name str

New name (mandatory).

required
language str

Language code (mandatory). Allowed: ["en", "de", "es", "fr", "it", "nl", "cs", "sk"]

required

Returns:

Type Description
Dict[str, Any]

Dict[str, Any]: Updated account user representation.

Source code in nukiwebapi/account_user.py
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
def update_account_user(
    self,
    account_user_id: int,
    email: str,
    name: str,
    language: str
) -> Dict[str, Any]:
    """
    Update details of a specific account user.

    POST /account/user/{accountUserId}

    Args:
        account_user_id (int): ID of the account user to update.
        email (str): New email (mandatory).
        name (str): New name (mandatory).
        language (str): Language code (mandatory). Allowed: ["en", "de", "es", "fr", "it", "nl", "cs", "sk"]

    Returns:
        Dict[str, Any]: Updated account user representation.
    """
    if language not in self.ALLOWED_LANGUAGES:
        raise ValueError(f"language must be one of {self.ALLOWED_LANGUAGES}")

    payload = {
        "email": email,
        "name": name,
        "language": language
    }

    return self.client._request("POST", f"/account/user/{account_user_id}", json=payload).json()

Delete a specific account user asynchronously.

DELETE /account/user/{accountUserId}

Parameters:

Name Type Description Default
account_user_id int

ID of the account user to delete.

required

Returns:

Type Description
Dict[str, Any]

Dict[str, Any]: API response confirming deletion.

Source code in nukiwebapi/account_user.py
105
106
107
108
109
110
111
112
113
114
115
116
117
def delete_account_user(self, account_user_id: int) -> Dict[str, Any]:
    """
    Delete a specific account user asynchronously.

    DELETE /account/user/{accountUserId}

    Args:
        account_user_id (int): ID of the account user to delete.

    Returns:
        Dict[str, Any]: API response confirming deletion.
    """
    return self.client._request("DELETE", f"/account/user/{account_user_id}")