---
title: AdminApi
summary: Python SDK: the Admin operations, 3 methods, each with its parameters, result and a complete example.
order: 21
languages: [python]
sdk-package: Python SDK · bimworks
link-terms: true
---

# AdminApi

[[page:reference/sdk/python|Python SDK]] · `bimworks` · class · 3 methods

The administration of an organization: its accounts and features

Construct it with the client of [[page:reference/sdk/python#connect|the connect step]]: `bimworks.AdminApi(client)`. Each method is one operation of the [[page:api|API part]], where it runs on its page.

<table class="dense">
<thead><tr><th>Method</th><th>Operation</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>[[page:reference/sdk/python/adminapi#listaccountuserfeatures|list_account_user_features]]</code></td><td>[[openapi:ListAccountUserFeatures]]</td><td>The user features of an account</td></tr>
<tr><td><code>[[page:reference/sdk/python/adminapi#listaccounts|list_accounts]]</code></td><td>[[openapi:ListAccounts]]</td><td>List the accounts of the organization</td></tr>
<tr><td><code>[[page:reference/sdk/python/adminapi#listorganizations|list_organizations]]</code></td><td>[[openapi:ListOrganizations]]</td><td>The caller's organization</td></tr>
</tbody>
</table>

## `list_account_user_features` {#listaccountuserfeatures}

```python
def list_account_user_features(self, list_account_user_features_request: Optional[ListAccountUserFeaturesRequest] = None) -> List[UserFeatureState]
```

The user features of an account. Every user feature with whether the account has it: what the account may do in BIM.works. The caller's own account when `account_uuid` is absent; another account's needs SuperAdmin.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:ListAccountUserFeatures]] · <code>POST /openapi/admin/ListAccountUserFeatures</code></td></tr>
<tr><th>Scope</th><td>[[scope:account:read]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>list_account_user_features_request</code></td><td><code>[[page:reference/sdk/python/models#ListAccountUserFeaturesRequest|ListAccountUserFeaturesRequest]]</code><span class="opt">optional</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:ListAccountUserFeatures]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>List[[[page:reference/sdk/python/models#UserFeatureState|UserFeatureState]]]</code> — The features, by name

### Example

```python
import json

import bimworks

# 1. Connect to BIM.works and log in with your API token
client = bimworks.ApiClient(bimworks.Configuration(host="BIM_WORKS_ADDRESS/openapi"))
auth = bimworks.AuthApi(client).login_with_api_token(
    bimworks.LoginWithApiTokenRequest(token="BIM_WORKS_API_TOKEN"))
client.configuration.access_token = auth.actual_instance.var_base64

# 2. The request
request = bimworks.ListAccountUserFeaturesRequest.from_json(r"""
{
  "account_uuid": "00000000-0000-0000-0000-000000000000"
}
""")

# 3. The call
result = bimworks.AdminApi(client).list_account_user_features(request)

# 4. The result
print(json.dumps(client.sanitize_for_serialization(result), indent=2))
```

## `list_accounts` {#listaccounts}

```python
def list_accounts(self, list_accounts_request: Optional[ListAccountsRequest] = None) -> List[AccountEntry]
```

List the accounts of the organization. The accounts of the caller's organization, newest first, each with its user and how it signs in. With `include_invites` the open invites follow the accounts. Removed accounts are left out unless `show_deleted`. Only a super admin or the organization's creator lists them, with a session or an API token; for any other member the answer is 403 NON_AUTHORIZED_TASK.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:ListAccounts]] · <code>POST /openapi/admin/ListAccounts</code></td></tr>
<tr><th>Scope</th><td>[[scope:admin:read]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>list_accounts_request</code></td><td><code>[[page:reference/sdk/python/models#ListAccountsRequest|ListAccountsRequest]]</code><span class="opt">optional</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:ListAccounts]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>List[[[page:reference/sdk/python/models#AccountEntry|AccountEntry]]]</code> — The accounts, then the invites

### Example

```python
import json

import bimworks

# 1. Connect to BIM.works and log in with your API token
client = bimworks.ApiClient(bimworks.Configuration(host="BIM_WORKS_ADDRESS/openapi"))
auth = bimworks.AuthApi(client).login_with_api_token(
    bimworks.LoginWithApiTokenRequest(token="BIM_WORKS_API_TOKEN"))
client.configuration.access_token = auth.actual_instance.var_base64

# 2. The request
request = bimworks.ListAccountsRequest.from_json(r"""
{
  "include_invites": false,
  "show_deleted": false
}
""")

# 3. The call
result = bimworks.AdminApi(client).list_accounts(request)

# 4. The result
print(json.dumps(client.sanitize_for_serialization(result), indent=2))
```

## `list_organizations` {#listorganizations}

```python
def list_organizations(self) -> List[Organization]
```

The caller's organization. The organization of the caller's account (an empty list when it has none).

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:ListOrganizations]] · <code>POST /openapi/admin/ListOrganizations</code></td></tr>
<tr><th>Scope</th><td>[[scope:admin:read]]</td></tr>
</tbody>
</table>

### Parameters

None: the operation takes no request.

### Returns

<code>List[[[page:reference/sdk/python/models#Organization|Organization]]]</code> — The organization

### Example

```python
import json

import bimworks

# 1. Connect to BIM.works and log in with your API token
client = bimworks.ApiClient(bimworks.Configuration(host="BIM_WORKS_ADDRESS/openapi"))
auth = bimworks.AuthApi(client).login_with_api_token(
    bimworks.LoginWithApiTokenRequest(token="BIM_WORKS_API_TOKEN"))
client.configuration.access_token = auth.actual_instance.var_base64

# 2. The request
# (ListOrganizations takes no request)

# 3. The call
result = bimworks.AdminApi(client).list_organizations()

# 4. The result
print(json.dumps(client.sanitize_for_serialization(result), indent=2))
```
