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

# AccountApi

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

The signed-in account: registration, password, sessions and settings

Construct it with the client of [[page:reference/sdk/dotnet#connect|the connect step]]: `client.GetRequiredService<IAccountApi>()`. 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/accountapi#changepassword|ChangePasswordAsync]]</code></td><td>[[openapi:ChangePassword]]</td><td>Change the password</td></tr>
<tr><td><code>[[page:reference/sdk/dotnet/accountapi#getsettings|GetSettingsAsync]]</code></td><td>[[openapi:GetSettings]]</td><td>Read the account settings</td></tr>
<tr><td><code>[[page:reference/sdk/dotnet/accountapi#listreferencevalues|ListReferenceValuesAsync]]</code></td><td>[[openapi:ListReferenceValues]]</td><td>The values of the settings form</td></tr>
<tr><td><code>[[page:reference/sdk/dotnet/accountapi#logout|LogoutAsync]]</code></td><td>[[openapi:Logout]]</td><td>Record a sign-out</td></tr>
<tr><td><code>[[page:reference/sdk/dotnet/accountapi#register|RegisterAsync]]</code></td><td>[[openapi:Register]]</td><td>Register an account</td></tr>
<tr><td><code>[[page:reference/sdk/dotnet/accountapi#requestpasswordreset|RequestPasswordResetAsync]]</code></td><td>[[openapi:RequestPasswordReset]]</td><td>Send a password reset e-mail</td></tr>
<tr><td><code>[[page:reference/sdk/dotnet/accountapi#requestvalidationemail|RequestValidationEmailAsync]]</code></td><td>[[openapi:RequestValidationEmail]]</td><td>Send a new validation e-mail</td></tr>
<tr><td><code>[[page:reference/sdk/dotnet/accountapi#savesettings|SaveSettingsAsync]]</code></td><td>[[openapi:SaveSettings]]</td><td>Change the account settings</td></tr>
<tr><td><code>[[page:reference/sdk/dotnet/accountapi#signoutothersessions|SignOutOtherSessionsAsync]]</code></td><td>[[openapi:SignOutOtherSessions]]</td><td>Sign out every other session</td></tr>
<tr><td><code>[[page:reference/sdk/dotnet/accountapi#validateemailaddress|ValidateEmailAddressAsync]]</code></td><td>[[openapi:ValidateEmailAddress]]</td><td>Confirm an e-mail address and set the password</td></tr>
</tbody>
</table>

## `ChangePasswordAsync` {#changepassword}

```csharp
Task<IChangePasswordApiResponse> ChangePasswordAsync(ChangePasswordRequest changePasswordRequest, CancellationToken cancellationToken = default)
```

Change the password. Changes the password of the signed-in account and signs out every other session; this one continues on the session answered here. An account session only: an API token is refused. `current_password` is needed when the account has a password, `code` when it has two-factor authentication. An account without a password (one that signs in with e-mail codes) gets its first one, which needs a session signed in within the last 10 minutes.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:ChangePassword]] · <code>POST /openapi/account/ChangePassword</code></td></tr>
<tr><th>Scope</th><td>[[scope:account:write]]</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>changePasswordRequest</code></td><td><code>[[page:reference/sdk/dotnet/models#ChangePasswordRequest|ChangePasswordRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:ChangePassword]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/dotnet/models#AuthResult|AuthResult]]</code> — The new session

### 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<ChangePasswordRequest>("""
    {
      "current_password": "",
      "password": "",
      "code": 0,
      "response_format": "auth"
    }
    """, json);

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

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

## `GetSettingsAsync` {#getsettings}

```csharp
Task<IGetSettingsApiResponse> GetSettingsAsync(CancellationToken cancellationToken = default)
```

Read the account settings. The settings of the account behind the credential: name, country, language, time zone and the web app preferences. With an API token, those of the account that created it.

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

### Parameters

None: the operation takes no request.

### Returns

<code>[[page:reference/sdk/dotnet/models#AccountSettings|AccountSettings]]</code> — The settings

### 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
// (GetSettings takes no request)

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

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

## `ListReferenceValuesAsync` {#listreferencevalues}

```csharp
Task<IListReferenceValuesApiResponse> ListReferenceValuesAsync(ListReferenceValuesRequest listReferenceValuesRequest, CancellationToken cancellationToken = default)
```

The values of the settings form. The countries (ISO 3166 codes), languages (ISO 639-1 codes) or time zones (tz identifiers) that the settings take, with a name to show. Names are in English.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:ListReferenceValues]] · <code>POST /openapi/account/ListReferenceValues</code></td></tr>
<tr><th>Scope</th><td>any login</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>listReferenceValuesRequest</code></td><td><code>[[page:reference/sdk/dotnet/models#ListReferenceValuesRequest|ListReferenceValuesRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:ListReferenceValues]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>List&lt;[[page:reference/sdk/dotnet/models#ReferenceValue|ReferenceValue]]&gt;</code> — The values

### 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<ListReferenceValuesRequest>("""
    {
      "kind": "countries"
    }
    """, json);

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

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

## `LogoutAsync` {#logout}

```csharp
Task<ILogoutApiResponse> LogoutAsync(CancellationToken cancellationToken = default)
```

Record a sign-out. Records that the session signed out. It revokes nothing: the bearer token stays valid until it expires. To end sessions, use SignOutOtherSessions or ChangePassword.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:Logout]] · <code>POST /openapi/account/Logout</code></td></tr>
<tr><th>Scope</th><td>any login</td></tr>
</tbody>
</table>

### Parameters

None: the operation takes no request.

### Returns

Nothing: the operation answers without a body (Recorded).

### 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
// (Logout takes no request)

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

// 4. The result
// (Logout answers no content: the call returns once it succeeded and throws an HttpRequestException otherwise)
if (!response.IsSuccessStatusCode) throw new HttpRequestException(response.RawContent, null, response.StatusCode);
Console.WriteLine("Done");
```

## `RegisterAsync` {#register}

```csharp
Task<IRegisterApiResponse> RegisterAsync(RegisterRequest registerRequest, CancellationToken cancellationToken = default)
```

Register an account. Creates an account for an e-mail address and sends it the validation e-mail; the account is usable once the address is confirmed with ValidateEmailAddress. Refused (REGISTRATION_NOT_ALLOWED) when the instance does not allow self-registration (security.account_self_registration) or the address asked too often; an address that already has an account is refused with EMAIL_ADDRESS_ALREADY_REGISTERED.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:Register]] · <code>POST /openapi/account/Register</code></td></tr>
<tr><th>Scope</th><td>none: callable before logging in</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>registerRequest</code></td><td><code>[[page:reference/sdk/dotnet/models#RegisterRequest|RegisterRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:Register]]'s request body.</td></tr>
</tbody>
</table>

### Returns

Nothing: the operation answers without a body (The validation e-mail is sent).

### 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 (Register needs no login)
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 client = Connect("");
var json = client.GetRequiredService<JsonSerializerOptionsProvider>().Options;

// 2. The request
var request = JsonSerializer.Deserialize<RegisterRequest>("""
    {
      "username": "",
      "preferred_language": ""
    }
    """, json);

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

// 4. The result
// (Register answers no content: the call returns once it succeeded and throws an HttpRequestException otherwise)
if (!response.IsSuccessStatusCode) throw new HttpRequestException(response.RawContent, null, response.StatusCode);
Console.WriteLine("Done");
```

## `RequestPasswordResetAsync` {#requestpasswordreset}

```csharp
Task<IRequestPasswordResetApiResponse> RequestPasswordResetAsync(RequestPasswordResetRequest requestPasswordResetRequest, CancellationToken cancellationToken = default)
```

Send a password reset e-mail. Sends a link to reset the password. The reset itself is completed in the BIM.works web app. It answers the same whether or not the account exists.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:RequestPasswordReset]] · <code>POST /openapi/account/RequestPasswordReset</code></td></tr>
<tr><th>Scope</th><td>none: callable before logging in</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>requestPasswordResetRequest</code></td><td><code>[[page:reference/sdk/dotnet/models#RequestPasswordResetRequest|RequestPasswordResetRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:RequestPasswordReset]]'s request body.</td></tr>
</tbody>
</table>

### Returns

Nothing: the operation answers without a body (Done (whether or not an e-mail was sent)).

### 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 (RequestPasswordReset needs no login)
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 client = Connect("");
var json = client.GetRequiredService<JsonSerializerOptionsProvider>().Options;

// 2. The request
var request = JsonSerializer.Deserialize<RequestPasswordResetRequest>("""
    {
      "username": ""
    }
    """, json);

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

// 4. The result
// (RequestPasswordReset answers no content: the call returns once it succeeded and throws an HttpRequestException otherwise)
if (!response.IsSuccessStatusCode) throw new HttpRequestException(response.RawContent, null, response.StatusCode);
Console.WriteLine("Done");
```

## `RequestValidationEmailAsync` {#requestvalidationemail}

```csharp
Task<IRequestValidationEmailApiResponse> RequestValidationEmailAsync(RequestValidationEmailRequest requestValidationEmailRequest, CancellationToken cancellationToken = default)
```

Send a new validation e-mail. A new validation link for an address that registered but did not confirm yet. It answers the same whether or not such an account exists.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:RequestValidationEmail]] · <code>POST /openapi/account/RequestValidationEmail</code></td></tr>
<tr><th>Scope</th><td>none: callable before logging in</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>requestValidationEmailRequest</code></td><td><code>[[page:reference/sdk/dotnet/models#RequestValidationEmailRequest|RequestValidationEmailRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:RequestValidationEmail]]'s request body.</td></tr>
</tbody>
</table>

### Returns

Nothing: the operation answers without a body (Done (whether or not an e-mail was sent)).

### 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 (RequestValidationEmail needs no login)
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 client = Connect("");
var json = client.GetRequiredService<JsonSerializerOptionsProvider>().Options;

// 2. The request
var request = JsonSerializer.Deserialize<RequestValidationEmailRequest>("""
    {
      "username": ""
    }
    """, json);

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

// 4. The result
// (RequestValidationEmail answers no content: the call returns once it succeeded and throws an HttpRequestException otherwise)
if (!response.IsSuccessStatusCode) throw new HttpRequestException(response.RawContent, null, response.StatusCode);
Console.WriteLine("Done");
```

## `SaveSettingsAsync` {#savesettings}

```csharp
Task<ISaveSettingsApiResponse> SaveSettingsAsync(AccountSettings accountSettings, CancellationToken cancellationToken = default)
```

Change the account settings. Changes the settings that are passed; the others stay as they are. With an API token, those of the account that created it.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:SaveSettings]] · <code>POST /openapi/account/SaveSettings</code></td></tr>
<tr><th>Scope</th><td>[[scope:account:write]]</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>accountSettings</code></td><td><code>[[page:reference/sdk/dotnet/models#AccountSettings|AccountSettings]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:SaveSettings]]'s request body.</td></tr>
</tbody>
</table>

### Returns

Nothing: the operation answers without a body (Saved).

### 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<AccountSettings>("""
    {
      "full_name": "",
      "country_code": "",
      "preferred_language": "",
      "time_zone_id": "",
      "bim_context": "",
      "show_deleted_nodes": false,
      "email_about_vulnerabilities": false,
      "ui_mode": "END_USER"
    }
    """, json);

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

// 4. The result
// (SaveSettings answers no content: the call returns once it succeeded and throws an HttpRequestException otherwise)
if (!response.IsSuccessStatusCode) throw new HttpRequestException(response.RawContent, null, response.StatusCode);
Console.WriteLine("Done");
```

## `SignOutOtherSessionsAsync` {#signoutothersessions}

```csharp
Task<ISignOutOtherSessionsApiResponse> SignOutOtherSessionsAsync(Option<SignOutOtherSessionsRequest> signOutOtherSessionsRequest = default, CancellationToken cancellationToken = default)
```

Sign out every other session. Ends every session of the signed-in account except this one, which continues on the session answered here: for a lost or shared device. An account session only. API tokens are separate credentials and keep working; revoke them with DeleteApiToken.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:SignOutOtherSessions]] · <code>POST /openapi/account/SignOutOtherSessions</code></td></tr>
<tr><th>Scope</th><td>[[scope:account:write]]</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>signOutOtherSessionsRequest</code></td><td><code>[[page:reference/sdk/dotnet/models#SignOutOtherSessionsRequest|SignOutOtherSessionsRequest]]</code><span class="opt">optional</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:SignOutOtherSessions]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/dotnet/models#AuthResult|AuthResult]]</code> — The new session

### 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<SignOutOtherSessionsRequest>("""
    {
      "response_format": "auth"
    }
    """, json);

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

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

## `ValidateEmailAddressAsync` {#validateemailaddress}

```csharp
Task<IValidateEmailAddressApiResponse> ValidateEmailAddressAsync(ValidateEmailAddressRequest validateEmailAddressRequest, CancellationToken cancellationToken = default)
```

Confirm an e-mail address and set the password. Confirms the address with the token from the validation e-mail and sets the account's password (8 to 128 characters, not a common one, not the address). It does not sign in: use LoginWithUsernamePassword after. The link is valid for a day.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:ValidateEmailAddress]] · <code>POST /openapi/account/ValidateEmailAddress</code></td></tr>
<tr><th>Scope</th><td>none: callable before logging in</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>validateEmailAddressRequest</code></td><td><code>[[page:reference/sdk/dotnet/models#ValidateEmailAddressRequest|ValidateEmailAddressRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:ValidateEmailAddress]]'s request body.</td></tr>
</tbody>
</table>

### Returns

Nothing: the operation answers without a body (The address is confirmed).

### 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 (ValidateEmailAddress needs no login)
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 client = Connect("");
var json = client.GetRequiredService<JsonSerializerOptionsProvider>().Options;

// 2. The request
var request = JsonSerializer.Deserialize<ValidateEmailAddressRequest>("""
    {
      "username": "",
      "token": "",
      "password": ""
    }
    """, json);

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

// 4. The result
// (ValidateEmailAddress answers no content: the call returns once it succeeded and throws an HttpRequestException otherwise)
if (!response.IsSuccessStatusCode) throw new HttpRequestException(response.RawContent, null, response.StatusCode);
Console.WriteLine("Done");
```
