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

# AdminApi

[[page:reference/sdk/dotnet|.NET SDK]] · `BIMworks.Sdk.Api` · class · 3 methods

The administration of an organization: its accounts and features

Construct it with the client of [[page:reference/sdk/dotnet#connect|the connect step]]: `client.GetRequiredService<IAdminApi>()`. 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/dotnet/adminapi#listaccountuserfeatures|ListAccountUserFeaturesAsync]]</code></td><td>[[openapi:ListAccountUserFeatures]]</td><td>The user features of an account</td></tr>
<tr><td><code>[[page:reference/sdk/dotnet/adminapi#listaccounts|ListAccountsAsync]]</code></td><td>[[openapi:ListAccounts]]</td><td>List the accounts of the organization</td></tr>
<tr><td><code>[[page:reference/sdk/dotnet/adminapi#listorganizations|ListOrganizationsAsync]]</code></td><td>[[openapi:ListOrganizations]]</td><td>The caller's organization</td></tr>
</tbody>
</table>

## `ListAccountUserFeaturesAsync` {#listaccountuserfeatures}

```csharp
Task<IListAccountUserFeaturesApiResponse> ListAccountUserFeaturesAsync(Option<ListAccountUserFeaturesRequest> listAccountUserFeaturesRequest = default, CancellationToken cancellationToken = default)
```

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>listAccountUserFeaturesRequest</code></td><td><code>[[page:reference/sdk/dotnet/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&lt;[[page:reference/sdk/dotnet/models#UserFeatureState|UserFeatureState]]&gt;</code> — The features, by name

### Example

```csharp
using System.Text.Json;
using BIMworks.Sdk.Api;
using BIMworks.Sdk.Client;
using BIMworks.Sdk.Extensions;
using BIMworks.Sdk.Model;
using Microsoft.Extensions.DependencyInjection;

// 1. Connect to BIM.works and log in with your API token
IServiceProvider Connect(string bearer)
{
    var services = new ServiceCollection();
    services.AddApi(options =>
    {
        options.AddTokens(new BearerToken(bearer));
        options.AddApiHttpClients(http =>
        {
            http.BaseAddress = new Uri("BIM_WORKS_ADDRESS" + "/openapi");
            http.Timeout = Timeout.InfiniteTimeSpan;
        });
    });
    return services.BuildServiceProvider();
}
var login = await Connect("").GetRequiredService<IAuthApi>().LoginWithApiTokenAsync(new LoginWithApiTokenRequest("BIM_WORKS_API_TOKEN"));
var auth = login.Ok()?.Auth ?? throw new HttpRequestException(login.RawContent, null, login.StatusCode);
var client = Connect(auth.Base64);
var json = client.GetRequiredService<JsonSerializerOptionsProvider>().Options;

// 2. The request
var request = JsonSerializer.Deserialize<ListAccountUserFeaturesRequest>("""
    {
      "account_uuid": "00000000-0000-0000-0000-000000000000"
    }
    """, json);

// 3. The call
var response = await client.GetRequiredService<IAdminApi>().ListAccountUserFeaturesAsync(request);

// 4. The result
var result = response.Ok() ?? throw new HttpRequestException(response.RawContent, null, response.StatusCode);
Console.WriteLine(JsonSerializer.Serialize(result, json));
```

## `ListAccountsAsync` {#listaccounts}

```csharp
Task<IListAccountsApiResponse> ListAccountsAsync(Option<ListAccountsRequest> listAccountsRequest = default, CancellationToken cancellationToken = default)
```

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>listAccountsRequest</code></td><td><code>[[page:reference/sdk/dotnet/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&lt;[[page:reference/sdk/dotnet/models#AccountEntry|AccountEntry]]&gt;</code> — The accounts, then the invites

### Example

```csharp
using System.Text.Json;
using BIMworks.Sdk.Api;
using BIMworks.Sdk.Client;
using BIMworks.Sdk.Extensions;
using BIMworks.Sdk.Model;
using Microsoft.Extensions.DependencyInjection;

// 1. Connect to BIM.works and log in with your API token
IServiceProvider Connect(string bearer)
{
    var services = new ServiceCollection();
    services.AddApi(options =>
    {
        options.AddTokens(new BearerToken(bearer));
        options.AddApiHttpClients(http =>
        {
            http.BaseAddress = new Uri("BIM_WORKS_ADDRESS" + "/openapi");
            http.Timeout = Timeout.InfiniteTimeSpan;
        });
    });
    return services.BuildServiceProvider();
}
var login = await Connect("").GetRequiredService<IAuthApi>().LoginWithApiTokenAsync(new LoginWithApiTokenRequest("BIM_WORKS_API_TOKEN"));
var auth = login.Ok()?.Auth ?? throw new HttpRequestException(login.RawContent, null, login.StatusCode);
var client = Connect(auth.Base64);
var json = client.GetRequiredService<JsonSerializerOptionsProvider>().Options;

// 2. The request
var request = JsonSerializer.Deserialize<ListAccountsRequest>("""
    {
      "include_invites": false,
      "show_deleted": false
    }
    """, json);

// 3. The call
var response = await client.GetRequiredService<IAdminApi>().ListAccountsAsync(request);

// 4. The result
var result = response.Ok() ?? throw new HttpRequestException(response.RawContent, null, response.StatusCode);
Console.WriteLine(JsonSerializer.Serialize(result, json));
```

## `ListOrganizationsAsync` {#listorganizations}

```csharp
Task<IListOrganizationsApiResponse> ListOrganizationsAsync(CancellationToken cancellationToken = default)
```

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&lt;[[page:reference/sdk/dotnet/models#Organization|Organization]]&gt;</code> — The organization

### Example

```csharp
using System.Text.Json;
using BIMworks.Sdk.Api;
using BIMworks.Sdk.Client;
using BIMworks.Sdk.Extensions;
using BIMworks.Sdk.Model;
using Microsoft.Extensions.DependencyInjection;

// 1. Connect to BIM.works and log in with your API token
IServiceProvider Connect(string bearer)
{
    var services = new ServiceCollection();
    services.AddApi(options =>
    {
        options.AddTokens(new BearerToken(bearer));
        options.AddApiHttpClients(http =>
        {
            http.BaseAddress = new Uri("BIM_WORKS_ADDRESS" + "/openapi");
            http.Timeout = Timeout.InfiniteTimeSpan;
        });
    });
    return services.BuildServiceProvider();
}
var login = await Connect("").GetRequiredService<IAuthApi>().LoginWithApiTokenAsync(new LoginWithApiTokenRequest("BIM_WORKS_API_TOKEN"));
var auth = login.Ok()?.Auth ?? throw new HttpRequestException(login.RawContent, null, login.StatusCode);
var client = Connect(auth.Base64);
var json = client.GetRequiredService<JsonSerializerOptionsProvider>().Options;

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

// 3. The call
var response = await client.GetRequiredService<IAdminApi>().ListOrganizationsAsync();

// 4. The result
var result = response.Ok() ?? throw new HttpRequestException(response.RawContent, null, response.StatusCode);
Console.WriteLine(JsonSerializer.Serialize(result, json));
```
