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

# Create Batch

## Overview

Create a batch to group multiple transactions under a single proposal. Batches allow you to approve, reject, cancel, or execute multiple transactions with a single action.

## Prerequisites

* Existing multisig
* `@sqds/multisig` package installed
* Member with Proposer permissions

## Quick Example

```typescript theme={null}
import * as multisig from "@sqds/multisig";
import { Connection, PublicKey } from "@solana/web3.js";

const batchCreateIx = await multisig.instructions.batchCreate({
  batchIndex: transactionIndex,
  creator: member,
  multisigPda,
  vaultIndex: 0,
  memo: "Creating a batch",
});
```

## Batch Workflow

1. Create a batch
2. Create a proposal as a draft
3. Add transactions to the batch
4. Activate the proposal
5. Vote on the proposal
6. Execute the proposal

## Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `multisigPda` | `PublicKey` | Yes | PDA of the multisig |
| `batchIndex` | `bigint` | Yes | Global transaction index for this batch |
| `creator` | `PublicKey` | Yes | Member creating the batch |
| `vaultIndex` | `number` | Yes | Index of the vault for batch transactions |
| `memo` | `string` | No | Optional memo |

## Full Example

```typescript theme={null}
import * as multisig from "@sqds/multisig";
import { Connection, PublicKey } from "@solana/web3.js"

async function main(member: PublicKey) {
    // Cluster Connection
    const connection = new Connection("<your rpc url>");

    // If you've saved your createKey, you can define it as a static PublicKey
    const createKey = new PublicKey("<your createkey>")

    // Derive the multisig PDA
    const [multisigPda] = multisig.getMultisigPda({
        createKey,
    });
    // or
    // const multisigPda = new PublicKey("<your multisig key>");

    // Get deserialized multisig account info
    const multisigInfo = await multisig.accounts.Multisig.fromAccountAddress(
      connection,
      multisigPda
    );

    // A batch is a new transaction, so it uses the next transaction index
    const currentTransactionIndex = Number(multisigInfo.transactionIndex);
    const transactionIndex = BigInt(currentTransactionIndex + 1);
    // or, if this is your first transaction
    // const transactionIndex = 1n;

    // Create the batch, which we can add transactions to
    const batchCreateIx = await multisig.instructions.batchCreate({
        batchIndex: transactionIndex,
        creator: member,
        multisigPda,
        vaultIndex: 0,
        memo: "Creating a batch",
    });

    // Create the proposal for voting on the transactions
    const proposalCreateIx = await multisig.instructions.proposalCreate({
        multisigPda,
        // Created with the same index as the batch
        transactionIndex: transactionIndex,
        creator: member,
        // Proposal is created as a draft
        isDraft: true,
    });
}
```

## Error Handling

| Error | Cause | Solution |
| - | - | - |
| Invalid index | Wrong batch index | Fetch current index from multisig account |
| Insufficient permissions | Member lacks Proposer permission | Use a member with Proposer permissions |

## See Also

* [Add to Batch](/developers/typescript-sdk/instructions/add-to-batch)
* [Batch Account](/developers/typescript-sdk/accounts/batch)
* [Batch Reference](/developers/reference/accounts#batch)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.