# Account

> Identity, settlements, and terms-and-conditions services.

Source: https://docs.stxapp.io/sdks/csharp/reference/account/

## `STXIdentityService`

```csharp
public class STXIdentityService
{
    Task<STXIdentity> GetMeAsync();
}
```

Returns the identity behind the current credentials. Call it once after startup when authenticating with an API key: there is no login response to read the user id from, and the WebSocket channels need it to build their topic.

### `STXIdentity`

| | |
|---|---|
| `UserId`, `AccountId` | Identifiers. `UserId` is what channel topics are keyed on |
| `FirstName`, `LastName` | Display name |
| `KeyId` | The API key that authenticated the call, when using API-key auth |
| `Method` | How the caller authenticated |
| `Scope` | The key's scope, `read_only` or `read_write` |

:::note
**Migrating from 1.5.x.** `STXProfileService` and `STXUserProfile` were removed. Use `STXIdentityService` and `STXIdentity`, which return the identifiers callers actually needed and work under both authentication methods.

If you picked up 1.6.0 before it was announced, these were briefly called `STXViewerService` and `STXViewer`. They were renamed in 1.6.1 to match the naming used elsewhere in the API. `GetMeAsync()` is unchanged.
:::

## `STXSettlementService`

```csharp
public class STXSettlementService
{
    Task<STXMySettlementHistory> GetMySettlementsAsync(
        IEnumerable<STXSettlementType> settlementTypes,
        STXRollingWindowIncrement rollingWindowIncrement = STXRollingWindowIncrement.DAYS,
        int rollingWindowValue = 1,
        int page = 1,
        int pageSize = 100);
}
```

`settlementTypes` is required. The rolling window bounds how far back to look: `rollingWindowIncrement` and `rollingWindowValue` together mean "the last N days", "the last N weeks", and so on.

### Enums

| Enum | Values |
|---|---|
| `STXSettlementType` | `CLOSED_LONG`, `CLOSED_SHORT`, `EXPIRED_LONG`, `EXPIRED_SHORT` |
| `STXTradeSettlementType` | `SETTLED`, `UNSETTLED` |
| `STXRollingWindowIncrement` | `SECONDS`, `MINUTES`, `HOURS`, `DAYS`, `MONTHS` |

A settlement describes how a position closed, not whether it won: `CLOSED_*` means the position was closed by an opposing trade, `EXPIRED_*` that it ran to market expiry.

## `STXTermsAndConditionsService`

```csharp
public class STXTermsAndConditionsService
{
    // NOT read-only. If the current terms are in effect, accepts them on the
    // user's behalf and returns the result of that acceptance.
    Task<bool> CheckTermsAndConditionsAsync();

    // Accept a version. Omit it to accept the one currently in effect.
    Task<bool> AcceptTermsAndConditionsAsync(string version = null);

    // Read-only. Fetches the current terms without accepting anything.
    Task<STXTermsAndConditions> GetTermsAndConditionsAsync();
}
```

:::caution
`CheckTermsAndConditionsAsync` accepts the current terms on the user's behalf when they are in effect. It is not a read-only check. To gate acceptance on user consent, call `GetTermsAndConditionsAsync`, display the terms, and call `AcceptTermsAndConditionsAsync` only after the user agrees.
:::

Task-oriented examples: [Authentication](/sdks/csharp/authentication/).
