> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fluz.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Edit Spend Accounts

# Overview

Each cash balance account has it's own nickname so user could easily distinguish between them, if there are a few of them.

# Edit User Cash Balance Account

## Sample request

You can update a user cash balance account with the `updateUserCashBalance` mutation. This mutation allows you edit spend account's nickname to help organize your funds. The query takes a `UpdateUserCashBalanceInput` input object.

```json theme={null}
mutation updateUserCashBalance($input: UpdateUserCashBalanceInput!) {
    updateUserCashBalance(input: $input) {
        userCashBalanceId
        totalCashBalance
        availableCashBalance
        lifetimeCashBalance
        nickname
        status
        createdAt
    }
}
```

This mutation requires the `UpdateUserCashBalanceInput` input type. Any field marked with an exclamation mark (`!`) in the schema is mandatory and must be included in the request.

| Field name        | Type    | Description                                                                                                                                               |
| :---------------- | :------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------- |
| userCashBalanceId | UUID!   | An unique identifier for the cash balance account.                                                                                                        |
| nickname          | String! | A custom name for the cash balance account. This helps identify the purpose of the account. Has to be at least 2 characters long, but no longer than 100. |

## UpdateUserCashBalanceInput

```json theme={null}
{
  "userCashBalanceId": "f8a3c9e1-7b2d-4f5e-9c8a-1d2e3f4g5h6i",
  "nickname": "New Team Travel"
}
```

## Sample response

The response from the `updateUserCashBalance` mutation will include the newly created cash balance account details, including its unique identifier and initial balance information.

```json theme={null}
{
  "data": {
    "updateUserCashBalance": {
      "userCashBalanceId": "f8a3c9e1-7b2d-4f5e-9c8a-1d2e3f4g5h6i",
      "totalCashBalance": "0",
      "availableCashBalance": "0",
      "lifetimeCashBalance": "0",
      "nickname": "New Team Travel",
      "status": "ACTIVE",
      "createdAt": "2025-01-15T10:30:00.000Z"
    }
  }
}
```

### Response Fields

| Field name           | Type                   | Description                                                  |
| :------------------- | :--------------------- | :----------------------------------------------------------- |
| userCashBalanceId    | UUID!                  | Unique identifier for the cash balance account               |
| totalCashBalance     | String!                | Total cash balance in the account (starts at 0)              |
| availableCashBalance | String!                | Available cash balance for immediate use (starts at 0)       |
| lifetimeCashBalance  | String!                | Cumulative total of all funds ever deposited (starts at 0)   |
| nickname             | String                 | The custom name assigned to the account                      |
| status               | UserCashBalanceStatus! | Current status of the account (ACTIVE, CLOSED, or SUSPENDED) |
| createdAt            | DateTime!              | Timestamp when the account was created                       |

> ❗️ Authorization required
>
> This mutation requires the `MANAGE_PAYMENT` scope. Ensure your access token has been granted this scope before attempting to create a cash balance account.
