# User

## Get a list of users.

<mark style="color:blue;">`GET`</mark> `https://api.trustedsite.com/api/v1/user/list.json`

Requires `account_user` permission.

Returns a paginated list of users.

<https://www.trustedsite.com/user/account/users>

#### Query Parameters

| Name       | Type    | Description                                                     |
| ---------- | ------- | --------------------------------------------------------------- |
| email      | String  | Filter by email                                                 |
| name       | String  | Filter by name                                                  |
| sort       | Integer | `0` = email (default)                                           |
| sort\_desc | Integer | <p><code>0</code> = No (default)</p><p><code>1</code> = Yes</p> |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "list": [
        {
            "role": 3,
            "user_id": 1,
            "phone": "1-000-000-0000",
            "last_name": "Doe",
            "title": "CEO",
            "first_name": "Jon",
            "email": "jon@example.com"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Get the details of a user.

<mark style="color:blue;">`GET`</mark> `https://api.trustedsite.com/api/v1/user/get.json`

If not `me`, requires `account_user` permission.

Returns the details of a user.

<https://www.trustedsite.com/user/account/users>

#### Query Parameters

| Name                                       | Type    | Description |
| ------------------------------------------ | ------- | ----------- |
| user\_id<mark style="color:red;">\*</mark> | Integer |             |

{% tabs %}
{% tab title="400: Bad Request " %}

```javascript
{
    "code": 0,
    "message": "user_id required"
}
```

{% endtab %}

{% tab title="200: OK " %}

```javascript
{
    "user": {
        "role": 3,
        "user_id": 1,
        "phone": "1-000-000-0000",
        "last_name": "Smith",
        "title": "CEO",
        "first_name": "Jon",
        "email": "jon@example.com"
    }
}
```

{% endtab %}

{% tab title="404: Not Found " %}

```javascript
{
    "code": 0,
    "message": "user not found"
}
```

{% endtab %}
{% endtabs %}

## Get the details of me.

<mark style="color:blue;">`GET`</mark> `https://api.trustedsite.com/api/v1/user/me.json`

Returns the details of me.

<https://www.trustedsite.com/user/account/users>

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "user": {
        "role": 1,
        "user_id": 1,
        "phone": "1-000-000-0000",
        "last_name": "Smith",
        "title": "CEO",
        "first_name": "Jon",
        "email": "jon@example.com"
    }
}
```

{% endtab %}
{% endtabs %}

## Update the details of a user.

<mark style="color:blue;">`GET`</mark> `https://api.trustedsite.com/api/v1/user/update.json`

If not `me`, requires `account_user` permission.

<https://www.trustedsite.com/user/account/users>

#### Query Parameters

| Name                                       | Type    | Description |
| ------------------------------------------ | ------- | ----------- |
| user\_id<mark style="color:red;">\*</mark> | Integer |             |
| first\_name                                | String  |             |
| last\_name                                 | String  |             |
| title                                      | String  |             |
| phone                                      | String  |             |

{% tabs %}
{% tab title="400: Bad Request " %}

```javascript
{
    "code": 0,
    "message": "user_id required"
}
```

{% endtab %}

{% tab title="200: OK " %}

```javascript
{
    "success": 1
}
```

{% endtab %}

{% tab title="404: Not Found " %}

```javascript
{
    "code": 0,
    "message": "user not found"
}
```

{% endtab %}
{% endtabs %}

## Invite a new user.

<mark style="color:blue;">`GET`</mark> `https://api.trustedsite.com/api/v1/user/invite.json`

Requires `account_user` permission.

<https://www.trustedsite.com/user/account/add-user>

#### Query Parameters

| Name                                    | Type    | Description |
| --------------------------------------- | ------- | ----------- |
| email<mark style="color:red;">\*</mark> | String  |             |
| role<mark style="color:red;">\*</mark>  | Integer |             |
| first\_name                             | String  |             |
| last\_name                              | String  |             |
| phone                                   | Integer |             |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "success": 1
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    "code": 0,
    "message": "email required"
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    "code": 0,
    "message": "role required"
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    "code": 0,
    "message": "email not valid"
}
```

{% endtab %}
{% endtabs %}
