> For the complete documentation index, see [llms.txt](https://www.notbank.com/learn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.notbank.com/learn/api-reference/websocket-api/user.md).

# User

### GetUserAccounts

**Permissions:** NotbankTrading, NotbankReadOnly\
**Call Type:** Synchronous

Gets the list of account Ids associated with a given user. More than one user may be associated with a given account.

#### Request

{% tabs %}
{% tab title="Node" %}

```javascript
import Notbank from 'notbank'
// websocket connection code ...

await client.getUserService().getUserAccounts({
  "UserId": 1
});


// request payload
{
  UserId?: number;
}
```

{% endtab %}

{% tab title="Java" %}

```java
import exchange.notbank.users.paramBuilders.GetUserAccountsParamBuilder;

var response = client.getUserService().getUserAccounts(new GetUserAccountsParamBuilder(1)).get();
```

{% endtab %}

{% tab title="Python" %}

```python
from notbank_python_sdk.requests_models import GetUserAccountsRequest

response = client.get_user_accounts(GetUserAccountsRequest(user_id=1))
```

{% endtab %}

{% tab title="Json" %}

```json
{
  "m": 0,
  "i": 0,
  "n": "GetUserAccounts",
  "o": "{
    \"OMSId\": 1
    \"UserId\": 1
  }"
}
```

{% endtab %}
{% endtabs %}

| Key    | Value                                                                                                                                                                                                                                                                                  |
| ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| OMSId  | **integer**. The ID of the OMS on which the user has one ore more accounts. **optional**.                                                                                                                                                                                              |
| UserId | **integer**. The ID of the user whose accounts you want to return. If not specified, the accounts of the user currently authenticated will be returned. A user with elevated permissions can specify any UserID and will be able to get the account/s owned by any user. **optional**. |

#### Response

```json
{
  "m": 1,
  "i": 0,
  "n": "GetUserAccounts",
  "o": "[1]"
}
```

Returns an array as a response, each element represents an ID of an account associated to the user.

### GetUserDevices

**Permissions:** NotbankTrading\
**Call Type:** Synchronous

Get the list of Registered Devices of a specific user.

#### Request

{% tabs %}
{% tab title="Node" %}

```javascript
import Notbank from 'notbank'
// websocket connection code ...

await client.getUserService().getUserDevices({
  "UserId": 6
});


// request payload
{
  UserId?: number;
}
```

{% endtab %}

{% tab title="Java" %}

```java
import exchange.notbank.users.paramBuilders.GetUserDevicesParamBuilder;

var response = client.getUserService().getUserDevices(new GetUserDevicesParamBuilder(6)).get();
```

{% endtab %}

{% tab title="Python" %}

```python
from notbank_python_sdk.requests_models import GetUserDevicesRequest

response = client.get_user_devices(GetUserDevicesRequest(user_id=6))
```

{% endtab %}

{% tab title="Json" %}

```json
{
  "m": 0,
  "i": 0,
  "n": "GetUserDevices",
  "o": "{
    \"UserId\": 6
  }"
}
```

{% endtab %}
{% endtabs %}

| Key    | Value                                                                                                                                                                    |
| ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| UserId | **integer**. The ID of the user for whose registered device/s will be returned. If not, the registered devices of the authenticated user will be returned. **optional**. |

#### Response

```json
{
  "m": 1,
  "i": 0,
  "n": "GetUserDevices",
  "o": "[
    {
      \"HashCode\": 345283502,
      \"Location\": \"\",
      \"DeviceName\": \"Windows NT 10.0; Win64; x64\",
      \"IpAddress\": \"69.10.61.175\",
      \"UserId\": 6,
      \"IsTrusted\": false,
      \"ExpirationTime\": 638169851720253079
    },
    {
      \"HashCode\": 1697796896,
      \"Location\": \"\",
      \"DeviceName\": \"Windows NT 10.0; Win64; x64\",
      \"IpAddress\": \"69.10.61.175\",
      \"UserId\": 6,
      \"IsTrusted\": true,
      \"ExpirationTime\": 637853361524214929
    }
  ]"
}
```

| Key            | Value                                                                                                     |
| -------------- | --------------------------------------------------------------------------------------------------------- |
| HashCode       | **integer**. A unique code that identifies the user registered device.                                    |
| Location       | **string**. Defaults to empty string, for future provision.                                               |
| DeviceName     | **string**. The name of the device.                                                                       |
| IpAddress      | **string**. The IpAddress from where the user registered the device.                                      |
| UserId         | **integer**. The ID of the user who owns the device.                                                      |
| IsTrusted      | **boolean**. If true the device is trusted, which means the user has confirmed it, otherwise it is false. |
| ExpirationTime | **long integer**. The date and time up to when the device will be trusted. In **ticks** format.           |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.notbank.com/learn/api-reference/websocket-api/user.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
