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

# Create Account

> Create a new sub-account with a signer

# Create Account

Creates a new sub-account under your Prime Account. Each sub-account gets its own on-chain wallet (Quark Wallet) on all supported networks.

## Request

```
POST /accounts
```

### Body parameters

| Parameter        | Type   | Required      | Description                                                      |
| ---------------- | ------ | ------------- | ---------------------------------------------------------------- |
| `signer_type`    | string | Yes           | Type of signer. Currently supported: `"eoa"`                     |
| `signer_address` | string | Yes (for EOA) | Ethereum address of the EOA signer (`0x`-prefixed, 40 hex chars) |

## Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://prime-api.legend.xyz/accounts \
    -H "Authorization: Bearer $LEGEND_QUERY_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "signer_type": "eoa",
      "signer_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18"
    }'
  ```

  ```typescript TypeScript theme={null}
  const account = await client.accounts.create({
    signerType: "eoa",
    signerAddress: "0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18",
  });
  ```

  ```python Python theme={null}
  account = await client.accounts.create(
      signer_type="eoa",
      signer_address="0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18",
  )
  ```

  ```rust Rust theme={null}
  use legend_client::CreateAccountParams;

  let account = client.accounts.create(&CreateAccountParams {
      signer_type: "eoa".into(),
      ethereum_signer_address: Some("0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18".into()),
      ..Default::default()
  }).await?;
  ```
</CodeGroup>

```json Response (201 Created) theme={null}
{
  "account_id": "acc_2o0yiljtp378",
  "signer_type": "eoa",
  "signer_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18",
  "legend_wallet_address": "0xc40897f38bc3d4e4d17f9daf46d2a13b4c47642f",
  "created_at": "2025-06-15T10:30:00Z"
}
```

### Response fields

| Field                   | Type   | Description                                             |
| ----------------------- | ------ | ------------------------------------------------------- |
| `account_id`            | string | Unique identifier for the sub-account (`acc_` prefix)   |
| `signer_type`           | string | Signer type used for this account                       |
| `signer_address`        | string | Ethereum address of the signer                          |
| `legend_wallet_address` | string | On-chain wallet address (deterministic from the signer) |
| `created_at`            | string | ISO 8601 timestamp                                      |

## Errors

| Status | Code                     | Description                                         |
| ------ | ------------------------ | --------------------------------------------------- |
| 400    | `invalid_params`         | Invalid `signer_type` or malformed `signer_address` |
| 409    | `account_already_exists` | A sub-account with this signer already exists       |

```json Error example theme={null}
{
  "error": "account_already_exists",
  "message": "An account already exists with this configuration"
}
```

## Notes

* The `legend_wallet_address` is deterministic — it's computed from the signer address using CREATE2. This means you can predict the wallet address before creating the account.
* Quark Wallets are created on all supported networks simultaneously.
* The signer's private key never touches Legend's servers. You or your end-user retain full custody.
