> For the complete documentation index, see [llms.txt](https://docs.thebrief.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.thebrief.ai/public-api/rest-api/users.md).

# Users

## List team users

This endpoint makes an HTTP GET request to retrieve a list of users from the team.

**Request Body:** This request does not require a request body.

### Request

* Method: GET
* Endpoint: `https://api.thebrief.ai/v1/users`
* Query Parameters:
  * `keyword` (string, optional): The keyword to search for users (it will search in name and email too).
  * `limit` (integer, optional): The maximum number of users to be returned.
  * `cursor` (string, optional): A cursor for pagination.
  * `orderBy` (enum, optional): option to order the response results by next fields:&#x20;

    ```typescript
    ID
    NAME
    CREATED_AT
    UPDATED_AT
    ```
  * `orderDirection` (enum, optional): option to order the response by direction:

    ```
    ASC
    DESC
    ```

```bash
curl --location 'https://api.thebrief.ai/v1/users?keyword=userName&limit=10&cursor=eyJsaW1pdCI6MSwibGFzdElkIjozOTE3M' \
--header 'Authorization: Bearer eyJ...'
```

**Response Body**

* `response` (object)
  * `totalCount` (number): The total count of users.
  * `nodes` (array): An array of user objects.
    * `id` (number): The unique identifier of the user.
    * `name` (string): The name of the user.
    * `email` (string): The email address of the user.
    * `role` (object): The role object of the user.
      * `id` (number): The unique identifier of the role.
      * `name` (string): The name of the role.
      * `description` (string): The description of the role.
    * `profilePicture` (string): The URL of the user's profile picture.
  * `pageInfo` (object): Information about the page.
    * `hasNextPage` (boolean): Indicates whether there is a next page.
    * `endCursor` (string): The cursor for the end of the page.

## Create team user

This endpoint allows you to create a new team user.

### Request

* Method: POST
* Endpoint: `https://api.thebrief.ai/v1/users`
* Body:
  * `name` (string, required): The name of the user.
  * `email` (string, required): The email of the user.
  * `role`  (string, required): The role of the user.

### Response

The response will be in JSON format with the following structure:

* `name` (string) - The name of the user.
* `id` (int) - The id of the user.
* `email` (string) - The email of the user.

<pre class="language-json"><code class="lang-json"><strong>{
</strong>    "response": {
        "name": "User Name",
        "id": 1111111,
        "email": "user.email@email.com"
    }
}
</code></pre>

## Delete team user

This endpoint allows you to delete a team user.

### Request

* Method: DEL
* Endpoint: `https://api.thebrief.ai/v1/users`
* Body:
  * `email` (string, required): The email of the user.

### Response

The response will be in JSON format:

```json
{
    "response": true
}
```

## Update team user role

This endpoint allows you to update the role in a team for a team user.

### Request

* Method: PUT
* Endpoint: `https://api.thebrief.ai/v1/users/updateTeamUserRole`
* Body:
  * `userId` (integer, required): The id of the user.
  * `roleId`  (integer, required): The role id.

### Response

The response will be in JSON format with the following structure:

* `id` (int) - The id of the user.
* `name` (string) - The name of the user.
* `email` (string) - The email of the user.
* `profilePicture` (string) - The profilePicture url of the user.
* `role` (object) - The role of the user in the team.
  * `id` (int) - the id of the role
  * `name` (string) - the name of the role
  * `description` (string) - the description of the role

<pre class="language-json"><code class="lang-json"><strong>{
</strong>    "response": {
        "id": 11111,
        "name": "User Name",
        "email": "user.email@email.com",
        "profilePicture": null,
        "role": {
            "id: 3,
            "name": "Viewer",
            "description": null
        },
    }
}
</code></pre>
