# Mutations / Users

# Users

**Mutation**
## createUser — Returns [User](/documentation/Objects/User#User)

**Scopes required:** create_users

| Arguments | Type | Description |
| --- | --- | --- |
| name | *String!* | The name of the user to create |
| username | *String!* | The username of the user |
| password | *String!* | The user's password to log into Shopfront with |
| role | [ID](/documentation/Types/UUID#UUID) | The user's role |
| reportingAccess | [[ID!]](/documentation/Types/UUID#UUID) | The Outlet's this user has access to for reporting, if not specified all Outlets will be available for access |
| pendingPasswordReset | *Boolean* | Whether the user should change their password at their next login |

**Example Mutation**

```graphql
mutation CreateUser($name: String!, $username: String!, $password: String!) {
    createUser(name: $name, username: $username, password: $password) {
        id,
        name,
        parent,
        deleted,
        username
    }
}

# Example variables
{
    "name": "<NAME>",
    "username": "<USERNAME>",
    "password": "<PASSWORD>"
}
```

**Mutation**
## deleteUser — Returns [User](/documentation/Objects/User#User)

**Scopes required:** modify_users, modify_integrations

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the user to delete |

**Example Mutation**

```graphql
mutation DeleteUser($id: ID!) {
    deleteUser(id: $id) {
        id,
        name,
        parent,
        deleted,
        username
    }
}

# Example variables
{
    "id": "<ID>"
}
```

**Mutation**
## updateUser — Returns [User](/documentation/Objects/User#User)

<p class="scopes"><span class="scope scope--none">No scope required</span></p>

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the user to update |
| name | *String* | The user's name |
| username | *String* | The username of the user |
| password | *String* | The new password for the user |
| role | [ID](/documentation/Types/UUID#UUID) | The role of the user |
| email | [Email](/documentation/Types/Email#Email) | The user's contact email address |
| phone | *String* | The user's contact phone number |
| image | *String* | The small image to use for the user |
| quickMenu | [[QuickMenuItemInput]](/documentation/Inputs/Quick-Menu-Item-Input#QuickMenuItemInput) | The items to display on the quick menu (like a list of favourites) |
| darkMode | [UserDarkModeEnum](/documentation/Enums/User-Dark-Mode-Enum#UserDarkModeEnum) | The theme for the user that will override the register's "Dark Mode" setting |
| reportingAccess | [[ID!]](/documentation/Types/UUID#UUID) | The Outlet's this user has access to for reporting |
| pendingPasswordReset | *Boolean* | Whether the user should change their password at their next login |

**Example Mutation**

```graphql
mutation UpdateUser($id: ID!) {
    updateUser(id: $id) {
        id,
        name,
        parent,
        deleted,
        username
    }
}

# Example variables
{
    "id": "<ID>"
}
```

**Mutation**
## updateUserDashboard — Returns *boolean*

**Scopes required:** edit_user_dashboard

> <p>This is currently an experimental mutation, please get in contact with us before using it.</p>

| Arguments | Type | Description |
| --- | --- | --- |
| ids | [[ID]!](/documentation/Types/UUID#UUID) | The IDs of the users to update the dashboard for |
| dashboard | [JSON!](/documentation/Types/JSON#JSON) | The dashboard configuration to set |

**Example Mutation**

```graphql
mutation UpdateUserDashboard($ids: [ID]!, $dashboard: JSON!) {
    updateUserDashboard(ids: $ids, dashboard: $dashboard)
}

# Example variables
{
    "ids": [
        "<IDS>"
    ],
    "dashboard": "<DASHBOARD>"
}
```

**Mutation**
## updateUserFormFavourites — Returns *boolean*

<p class="scopes"><span class="scope scope--none">No scope required</span></p>

> <p>This is currently an experimental mutation, please get in contact with us before using it.</p>

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the user |
| page | [FavouriteFormPageTypeEnum!](/documentation/Enums/Favourite-Form-Page-Type-Enum#FavouriteFormPageTypeEnum) | The page the favourite fields relate to |
| fields | *[String]!* | A list of fields the user has favourited |

**Example Mutation**

```graphql
mutation UpdateUserFormFavourites($id: ID!, $page: FavouriteFormPageTypeEnum!, $fields: [String]!) {
    updateUserFormFavourites(id: $id, page: $page, fields: $fields)
}

# Example variables
{
    "id": "<ID>",
    "page": "product",
    "fields": [
        "<FIELDS>"
    ]
}
```