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

# wallet_addSubAccount

> Create a new sub-account for the connected user, scoped to your application.

Opens the popup to create a new sub-account. The user approves the creation.

## Request

```ts theme={null}
const subAccount = await provider.request({
  method: 'wallet_addSubAccount',
  params: [{ version: '1', account: { type: 'create' } }],
})
```

## Parameters

<ParamField path="params[0].version" type="'1'" required>
  Protocol version. Must be `'1'`.
</ParamField>

<ParamField path="params[0].account" type="AddSubAccountAccount" required>
  Sub-account specification.

  <Expandable title="Variants">
    <ParamField path="type" type="'create' | 'deployed' | 'undeployed'">
      `'create'`, create a new sub-account.
      `'deployed'`, register a sub-account already deployed on-chain.
      `'undeployed'`, register a sub-account with factory + factoryData but not yet deployed.
    </ParamField>
  </Expandable>
</ParamField>

## Returns

```ts theme={null}
{
  address: '0x...',
  chainId?: '0x...',
  factory?: '0x...',
  factoryData?: '0x...',
}
```

## Errors

| Code   | Cause                  |
| ------ | ---------------------- |
| `4001` | User rejected creation |
| `4100` | Wallet not connected   |

## Related

* [`wallet_getSubAccounts`](/api-reference/rpc-methods/wallet-get-sub-accounts), list existing sub-accounts.
* [Sub-accounts](/app-sdk/sub-accounts)
