> 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/useredeem.md). Agents can also search and read this documentation through its [MCP server](https://docs.zama.org/protocol/~gitbook/mcp).

# useRedeem

Mutation hook that redeems confidential vault shares and returns the batch each leg landed in.

Mutation hook that redeems a vault's shares with the SDK's signer. Wraps [`VaultClient.redeem`](https://docs.zama.org/protocol/sdk/api-references/sdk/vaultclient.md#redeem). [`useBatch`](https://docs.zama.org/protocol/sdk/api-references/react/usebatch.md) reads each returned batch.

In a group, the mutation first asks the wallet for each operator approval of the router that the account lacks. See [Wallet prompts](https://docs.zama.org/protocol/sdk/vaults/advanced.md#wallet-prompts).

## Import

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

## Usage

{% tabs %}
{% tab title="RedeemButton.tsx" %}

```tsx
import { useRedeem } from "@zama-fhe/react-sdk/vaults";
import { STABLE } from "./vaults";

function RedeemButton() {
  const redeem = useRedeem({ onSuccess: ({ batches }) => saveBatches(batches) });

  return (
    <button
      disabled={redeem.isPending}
      onClick={() => redeem.mutate({ group: STABLE, vaultId: "beta", amount: 500n })}
    >
      {redeem.isPending ? "Redeeming..." : "Redeem"}
    </button>
  );
}
```

{% endtab %}
{% endtabs %}

`saveBatches` stands in for your own storage. See [Store the batches](https://docs.zama.org/protocol/sdk/vaults/deposits.md#4-store-the-batches).

## Parameters

```ts
import { type UseVaultMutationOptions } from "@zama-fhe/react-sdk/vaults";
```

## Mutation variables

Same as [`useDeposit`](https://docs.zama.org/protocol/sdk/api-references/react/usedeposit.md#mutation-variables): `group` and `vaultId` or `vault`, `amount`, `skipBalanceCheck` and `onJoinSubmitted`. The `amount` is in shares, not assets. As in `useDeposit`, `vaultId` is typed as `string`.

**Throws:** as [`useDeposit`](https://docs.zama.org/protocol/sdk/api-references/react/usedeposit.md#mutation-variables).

## Return Type

The `data` property (after a successful mutation) is a [`JoinOutcome`](https://docs.zama.org/protocol/sdk/api-references/sdk/vaultclient.md#joinoutcome): `batches`, the batch each leg landed in, and `txHashes`, approvals first.

When the mutation settles, successful or not, the hook invalidates every vault read and every confidential balance.

## Related

* [useDeposit](https://docs.zama.org/protocol/sdk/api-references/react/usedeposit.md): the deposit direction
* [useBatch](https://docs.zama.org/protocol/sdk/api-references/react/usebatch.md): follow each batch
* [Vault deposits and redemptions](https://docs.zama.org/protocol/sdk/vaults/deposits.md#redeem)


---

# 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/useredeem.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.
