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

# useCancelVault

> Withdraw the owner's approval for an open vault request from their wallet, until the item is vaulted.

```ts theme={null}
function useCancelVault(): {
  cancelVault: (args: { requestId: string }) => Promise<WalletSubmission>;
  status: "idle" | "pending" | "success" | "error";
  data: WalletSubmission | null;
  error: Error | null;
  reset: () => void;
};
```

`cancelVault({ requestId })` sends the owner's cancel from their wallet, with
the cost covered by Endstate. With a tap session it then reads eligibility
until Endstate no longer names the request, and resolves once it does, so
[`useCanVault`](https://docs.endstate.io/sdks/web/reference/react/useCanVault) offers the vault again.
It needs no tap session, only the wallet that approved the request; without
one it resolves once the network included the cancel. If Endstate has not
seen the cancel within two minutes, or the read fails, it still resolves and
`useCanVault` keeps its last answer.

## Example

```tsx theme={null}
"use client";
import { useCancelVault } from "@endstate-sdk/web/react";

// requestId is the id vault() returned, or canVault's requestId after a reload.
function CancelButton({ requestId }: { requestId: string }) {
  const { cancelVault, status } = useCancelVault();
  return (
    <button
      disabled={status === "pending" || status === "success"}
      onClick={() => cancelVault({ requestId })}
    >
      Cancel the vault request
    </button>
  );
}
```

## Returns

**cancelVault** `(args: \{ requestId: string \}) =\> Promise\<WalletSubmission\>`

Resolves with `{ transactionHash, address, resourceId }`. Rejects with
`submission.not_executable` when the request is already closed, and with
`auth.forbidden` when this wallet did not approve it.

**status** `"idle" | "pending" | "success" | "error"`

The outcome of the latest call for the current tap, wallet and sign-in.

**data** `WalletSubmission | null`

The latest cancel the wallet sent.

**error** `Error | null`

The failure that moved `status` to `"error"`.

**reset** `() =\> void`

Returns the hook to `"idle"`.


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