> For the complete documentation index, see [llms.txt](https://docs.leather.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.leather.io/developers/stacks-methods/stx_addaccount.md).

# stx\_addAccount

Ask the user to verify a Stacks multisig address derived from public keys and a threshold.

## Method name

`stx_addAccount`

Leather derives the Stacks multisig address from the public keys and the threshold and shows it to the user with the signing policy and the account name. For your app this is a verification request: the user confirms the address, and nothing is added to the wallet. Only Leather's own web app can add the multisig account to the extension. Available in the Leather browser extension from [6.105.0](https://github.com/leather-io/mono/releases/tag/%40leather.io%2Fextension-v6.105.0).

The method needs no prior connection. The confirm button is enabled only when the user's active account holds one of the public keys.

## Parameters

| Parameter    | Description                                                        | Required | Type       |
| ------------ | ------------------------------------------------------------------ | -------- | ---------- |
| `publicKeys` | Two or more compressed secp256k1 public keys, hex-encoded          | ✅        | `string[]` |
| `threshold`  | Number of signatures required, from 1 to the number of public keys | ✅        | `number`   |
| `name`       | Account name shown to the user                                     | ✅        | `string`   |
| `network`    | Network identifier                                                 | ❌        | `string`   |

## Example request

```typescript
try {
  const response = await window.LeatherProvider.request("stx_addAccount", {
    publicKeys, // compressed keys, one of them the user's STX publicKey from getAddresses
    threshold: 2,
    name: "Treasury 2-of-3",
  });

  console.log("Verified address:", response.result.address);
} catch (error) {
  console.log("Request error:", error.error.code, error.error.message);
}
```

## Example response

```json
{
    "jsonrpc": "2.0",
    "id": "7b2e1c3d-4f5a-4b6c-9d8e-0f1a2b3c4d5e",
    "result": {
        "added": false,
        "address": "SM...",
        "publicKeys": ["02...", "03...", "02..."],
        "threshold": 2,
        "role": "signer"
    }
}
```

`added` is `false` for every origin except Leather's web app, where the result is `{ added: true, accountId, address, publicKeys, threshold, role }`.

## Errors

| Code     | Message                      | When                                                                                             |
| -------- | ---------------------------- | ------------------------------------------------------------------------------------------------ |
| `-32602` | Parameter validation details | A parameter fails validation, for example fewer than two keys or a threshold above the key count |
| `4001`   | `User rejected request`      | The user selects Deny or closes the window                                                       |
