> ## 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.

# Create Spend Accounts

# Overview

A user cash balance account is a spending account that allows users to manage and track their available funds within the Fluz platform. Each cash balance account is identified by a unique nickname and maintains separate balances for total, available, and lifetime deposits. Users can create multiple cash balance accounts (e.g., "Team Travel", "Operations Wallet", "Marketing Budget") to organize their spending across different purposes.

Cash balance accounts are required for making deposits, purchasing gift cards, and funding virtual card transactions on the Fluz platform.

# Create User Cash Balance Account

## Sample request

You can create a new user cash balance account with the `createUserCashBalance` mutation. This mutation allows you to set up a new spending account with a custom nickname to help organize your funds. The query takes a `CreateUserCashBalanceInput` input object.

```json theme={null}
{
  "query": "mutation createUserCashBalance($input: CreateUserCashBalanceInput!) { createUserCashBalance(input: $input) { userCashBalanceId totalCashBalance availableCashBalance lifetimeCashBalance nickname status createdAt }}",
  "variables": {
    "input": {
      "nickname": "Team Travel"
    }
  }
}
```

This mutation requires the `CreateUserCashBalanceInput` 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                                                                                 |
| :--------- | :------ | :------------------------------------------------------------------------------------------ |
| nickname   | String! | A custom name for the cash balance account. This helps identify the purpose of the account. |

## CreateUserCashBalanceInput

```json theme={null}
{
  "nickname": "Team Travel"
}
```

## Sample response

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

```json theme={null}
{
  "data": {
    "createUserCashBalance": {
      "userCashBalanceId": "f8a3c9e1-7b2d-4f5e-9c8a-1d2e3f4g5h6i",
      "totalCashBalance": "0",
      "availableCashBalance": "0",
      "lifetimeCashBalance": "0",
      "nickname": "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.

<StickyContactSalesBanner />
