> For the complete documentation index, see [llms.txt](https://docs.zama.org/protocol/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zama.org/protocol/sdk/api-references/react/usebatchregisterpermits.md). Agents can also search and read this documentation through its [MCP server](https://docs.zama.org/protocol/~gitbook/mcp).

# useBatchRegisterPermits

Mutation hook that verifies and persists the signatures an out-of-process signer produced for a list of prepared decryption permits.

[`useRegisterPermit`](https://docs.zama.org/protocol/sdk/api-references/react/useregisterpermit.md) for every [`useBatchPreparePermits`](https://docs.zama.org/protocol/sdk/api-references/react/usebatchpreparepermits.md) payload, each paired with its signature. Every permit is verified before any is stored, so a permit that fails verification leaves the store untouched. Storing stays best-effort, like `useRegisterPermit`: a failed store write is logged, not thrown. Automatically invalidates [`useHasPermit`](https://docs.zama.org/protocol/sdk/api-references/react/usehaspermit.md) queries on success.

## Import

```ts
import { useBatchRegisterPermits } from "@zama-fhe/react-sdk";
```

## Usage

```tsx
import { useBatchPreparePermits, useBatchRegisterPermits } from "@zama-fhe/react-sdk";

function CustodyPermitsFlow({
  custodyAddress,
  tokenAddresses,
}: {
  custodyAddress: `0x${string}`;
  tokenAddresses: `0x${string}`[];
}) {
  const { mutateAsync: batchPreparePermits } = useBatchPreparePermits();
  const { mutateAsync: batchRegisterPermits, isPending } = useBatchRegisterPermits();

  const handleAuthorize = async () => {
    const prepared = await batchPreparePermits({
      signer: custodyAddress,
      contracts: tokenAddresses,
    });
    const signed = await Promise.all(
      prepared.map(async (p) => ({
        prepared: p,
        signature: await custodyApi.signTypedData(p.eip712),
      })),
    );
    await batchRegisterPermits(signed);
  };

  return (
    <button onClick={handleAuthorize} disabled={isPending}>
      {isPending ? "Registering..." : "Complete offline authorization"}
    </button>
  );
}
```

## Parameters

`useBatchRegisterPermits` takes no configuration parameters.

## Mutation variables

### permits

`SignedPreparedPermit[]` — one entry per element `useBatchPreparePermits` returned:

| Field       | Type             | Meaning                                                     |
| ----------- | ---------------- | ----------------------------------------------------------- |
| `prepared`  | `PreparedPermit` | one of the payloads `useBatchPreparePermits` returned       |
| `signature` | `Hex`            | the `eth_signTypedData_v4` signature over `prepared.eip712` |

## Return Type

Returns a standard TanStack Query `UseMutationResult<void, Error, SignedPreparedPermit[]>`.

**Throws:** `ConfigurationError` for an empty list; otherwise whatever [`useRegisterPermit`](https://docs.zama.org/protocol/sdk/api-references/react/useregisterpermit.md) throws for the failing permit.

## Related

* [`useBatchPreparePermits`](https://docs.zama.org/protocol/sdk/api-references/react/usebatchpreparepermits.md) -- build the unsigned typed data this hook registers signatures for
* [`useRegisterPermit`](https://docs.zama.org/protocol/sdk/api-references/react/useregisterpermit.md) -- the single-permit form
* [Offline signing guide](https://docs.zama.org/protocol/sdk/guides/offline.md#offline-permits) -- the full offline permit workflow
* [ZamaSDK reference](https://docs.zama.org/protocol/sdk/api-references/sdk/zamasdk.md#permits-batchregisterpermits) -- `sdk.permits.batchRegisterPermits`'s full signature


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.zama.org/protocol/sdk/api-references/react/usebatchregisterpermits.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
