---
updatedAt: 2026-08-18T18:39:20.000Z
agentTools:
  projectIndex: https://stockpit.readme.io/llms.txt
---

# Queries

Users are the people who access the company's Stockpit account.

# Available queries

### `User` - Returns a single user based on the `id` or `email` provided

```graphql
query {
  User (id: 100012) {
    id
    label
    first_name
    last_name
    email
    active
    lang
  }
}
```

### `Users` - Returns a list of users based on the filters defined

```graphql
query {
  Users {
    data {
      id
      label
      first_name
      last_name
      email
      active
      lang
    }
  }
}
```

<br />

***

# Available fields

| id <span style={{ fontWeight: "normal" }}>- [ID](/reference/data-types#id)  </span> |
| :---------------------------------------------------------------------------------- |
| Unique identifier of the user                                                       |

| label <span style={{ fontWeight: "normal" }}>- [String](/reference/data-types#string)  </span> |
| :--------------------------------------------------------------------------------------------- |
| Label of the user                                                                              |

| first\_name <span style={{ fontWeight: "normal" }}>- [String](/reference/data-types#string)  </span> |
| :--------------------------------------------------------------------------------------------------- |
| First name of the user                                                                               |

| last\_name <span style={{ fontWeight: "normal" }}>- [String](/reference/data-types#string)  </span> |
| :-------------------------------------------------------------------------------------------------- |
| Last name of the user                                                                               |

| email <span style={{ fontWeight: "normal" }}>- [String](/reference/data-types#string)  </span> |
| :--------------------------------------------------------------------------------------------- |
| Email address of the user                                                                      |

| active <span style={{ fontWeight: "normal" }}>- [Boolean](/reference/data-types#boolean)  </span> |
| :------------------------------------------------------------------------------------------------ |
| If true, the user is active                                                                       |

| lang <span style={{ fontWeight: "normal" }}>- [Lang](#lang-enum)  </span> |
| :------------------------------------------------------------------------ |
| Language of the user (enum values :  fr, en, ca)                          |

| created\_at <span style={{ fontWeight: "normal" }}>- [DateTime](/reference/data-types#datetime)  </span> |
| :------------------------------------------------------------------------------------------------------- |
| Date and time the user was created                                                                       |

| updated\_at <span style={{ fontWeight: "normal" }}>- [DateTime](/reference/data-types#datetime)  </span> |
| :------------------------------------------------------------------------------------------------------- |
| Date and time the user was last updated                                                                  |

| notifications <span style={{ fontWeight: "normal" }}>- Array of [Notification](/reference/notification-queries) - Subquery  </span> |
| :---------------------------------------------------------------------------------------------------------------------------------- |
| List of the notifications of the user                                                                                               |

| two\_factor\_authentication <span style={{ fontWeight: "normal" }}>- [Boolean](/reference/data-types#boolean)  </span> |
| :--------------------------------------------------------------------------------------------------------------------- |
| If true, two-factor authentication is enabled for the user                                                             |

| active\_user\_profiles <span style={{ fontWeight: "normal" }}>- Array of [UserProfile](/reference/user-profile-queries) - Subquery  </span> |
| :------------------------------------------------------------------------------------------------------------------------------------------ |
| List of the active user profiles of the user                                                                                                |

<br />

***

# Filters

You can create filters based on following fields

| id                                                             |
| :------------------------------------------------------------- |
| Example: { "column": "ID", "operator": "EQ", "value": 100012 } |

| label                                                                 |
| :-------------------------------------------------------------------- |
| Example: { "column": "LABEL", "operator": "LIKE", "value": "%john%" } |

| active                                                           |
| :--------------------------------------------------------------- |
| Example: { "column": "ACTIVE", "operator": "EQ", "value": true } |

| first\_name                                                                |
| :------------------------------------------------------------------------- |
| Example: { "column": "FIRST_NAME", "operator": "LIKE", "value": "%John%" } |

| last\_name                                                               |
| :----------------------------------------------------------------------- |
| Example: { "column": "LAST_NAME", "operator": "LIKE", "value": "%Doe%" } |

| email                                                                             |
| :-------------------------------------------------------------------------------- |
| Example: { "column": "EMAIL", "operator": "EQ", "value": "john.doe@example.com" } |

| created\_at                                                                           |
| :------------------------------------------------------------------------------------ |
| Example: { "column": "CREATED_AT", "operator": "GT", "value": "2024-01-01 00:00:00" } |

| updated\_at                                                                           |
| :------------------------------------------------------------------------------------ |
| Example: { "column": "UPDATED_AT", "operator": "LT", "value": "2024-12-31 23:59:59" } |

***

# Sorting

You can sort data based on following fields : id, label, first\_name, last\_name, email, lang, email\_verified\_at, created\_at, updated\_at

```graphql
query Users(
  $orderBy: [QueryUsersOrderByOrderByClause!],
  $where: QueryUsersWhereWhereConditions,
  $first: Int,
  $page: Int
) {
  Users(
    orderBy: $orderBy
    where: $where
    first: $first
    page: $page
  ) {
    paginatorInfo {
      total
      count
      currentPage
      perPage
    }
    data {
      id
      label
      first_name
      last_name
      email
      active
      lang
    }
  }
}
```

```json Variables (JSON)
{
  "orderBy": [
    {
      "column": "CREATED_AT",
      "order": "DESC"
    }
  ],
  "first": 50,
  "page": 1
}
```

## Example of a query

```graphql
query Users(
  $orderBy: [QueryUsersOrderByOrderByClause!],
  $where: QueryUsersWhereWhereConditions,
  $first: Int,
  $page: Int
) {
  Users(
    orderBy: $orderBy
    where: $where
    first: $first
    page: $page
  ) {
    paginatorInfo {
      total
    }
    data {
      id
      label
      email
      active
      lang
    }
  }
}
```

```json
{
  "orderBy": [
    {
      "column": "CREATED_AT",
      "order": "DESC"
    }
  ],
  "first": 50,
  "page": 1,
  "where": {
    "AND": [
      {
        "AND": [
          {
            "column": "ACTIVE",
            "operator": "EQ",
            "value": true
          },
          {
            "column": "CREATED_AT",
            "operator": "GT",
            "value": "2020-01-01 00:00:00"
          }
        ]
      }
    ]
  }
}
```

## Example of data returned

```json
{
  "data": {
    "Users": {
      "paginatorInfo": {
        "total": 1,
        "count": 1,
        "currentPage": 1,
        "perPage": 50
      },
      "data": [
        {
          "id": 100012,
          "label": "John Doe",
          "email": "john.doe@example.com",
          "active": true,
          "lang": "fr"
        }
      ]
    }
  }
}
```

# Data types

## User type

| id <span style={{ fontWeight: "normal" }}>- [ID](/reference/data-types#id)  </span> |
| :---------------------------------------------------------------------------------- |
| Unique identifier of the user                                                       |

| label <span style={{ fontWeight: "normal" }}>- [String](/reference/data-types#string)  </span> |
| :--------------------------------------------------------------------------------------------- |
| Label of the user                                                                              |

| first\_name <span style={{ fontWeight: "normal" }}>- [String](/reference/data-types#string)  </span> |
| :--------------------------------------------------------------------------------------------------- |
| First name of the user                                                                               |

| last\_name <span style={{ fontWeight: "normal" }}>- [String](/reference/data-types#string)  </span> |
| :-------------------------------------------------------------------------------------------------- |
| Last name of the user                                                                               |

| email <span style={{ fontWeight: "normal" }}>- [String](/reference/data-types#string)  </span> |
| :--------------------------------------------------------------------------------------------- |
| Email address of the user                                                                      |

| active <span style={{ fontWeight: "normal" }}>- [Boolean](/reference/data-types#boolean)  </span> |
| :------------------------------------------------------------------------------------------------ |
| If true, the user is active                                                                       |

| lang <span style={{ fontWeight: "normal" }}>- [Lang](#lang-enum)  </span> |
| :------------------------------------------------------------------------ |
| Language of the user (enum values :  fr, en, ca)                          |

| created\_at <span style={{ fontWeight: "normal" }}>- [DateTime](/reference/data-types#datetime)  </span> |
| :------------------------------------------------------------------------------------------------------- |
| Date and time the user was created                                                                       |

| updated\_at <span style={{ fontWeight: "normal" }}>- [DateTime](/reference/data-types#datetime)  </span> |
| :------------------------------------------------------------------------------------------------------- |
| Date and time the user was last updated                                                                  |

| notifications <span style={{ fontWeight: "normal" }}>- Array of [Notification](/reference/notification-queries) - Subquery  </span> |
| :---------------------------------------------------------------------------------------------------------------------------------- |
| List of the notifications of the user                                                                                               |

| two\_factor\_authentication <span style={{ fontWeight: "normal" }}>- [Boolean](/reference/data-types#boolean)  </span> |
| :--------------------------------------------------------------------------------------------------------------------- |
| If true, two-factor authentication is enabled for the user                                                             |

| active\_user\_profiles <span style={{ fontWeight: "normal" }}>- Array of [UserProfile](/reference/user-profile-queries) - Subquery  </span> |
| :------------------------------------------------------------------------------------------------------------------------------------------ |
| List of the active user profiles of the user                                                                                                |

## Lang enum

| Value | Description |
| :---- | :---------- |
| `fr`  | French      |
| `en`  | English     |
| `ca`  | Catalan     |