> ## Documentation Index
> Fetch the complete documentation index at: https://79cdaa32-9b19-4e9d-ab9d-a89800ef0f46.valox.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Withdraw funds from Spending Safe

> How to send funds from the Valox Safe to your EOA or somewhere else.

The withdrawal feature allows partners to withdraw tokens from Valox Safe accounts to any external address **on the Valox Chain**.
All transactions are gasless, enabling users to perform these operations completely free of charge.

The withdrawal process involves the following steps:

1. **Fetch Transaction Data** - Get the EIP-712 typed data for signing
2. **Sign and Submit** - Sign the transaction and submit the withdrawal
3. **Monitor Execution** - Wait for the delay relay to process the withdrawal

<Warning>
  Please remember the following:

  * The signing wallet must be one of the Valox Safe signers (EOA or smart contract wallet)
  * For smart contract wallets, signatures are verified using ERC-1271 standard
  * Withdrawals are processed after a 3-minute delay as transactions are going through the Valox delay relay
  * Cards are temporarily frozen for 3 minutes during withdrawal processing as a security measure
</Warning>

## Withdrawal Process

<Steps titleSize="h3">
  <Step title="Fetch Transaction Data for Signing">
    Get the EIP-712 typed data that needs to be signed by the user's wallet [(spec)](/api-reference/account-management/retrieve-transaction-data-for-withdrawing-from-safe):

    ```bash cURL theme={null}
    curl -X GET \
    /api/v1/accounts/withdraw/transaction-data?tokenAddress=${tokenAddress}&to=${toAddress}&amount=${amount}
    ```

    The response contains EIP-712 typed data that needs to be signed by the user's wallet.
  </Step>

  <Step title="Sign the EIP-712 Typed Data">
    The EIP-712 typed data from Step 1 must be signed by the user's wallet using the EIP-712 signature standard.

    <Note>
      **Wallet Requirements:**

      * The wallet must be a signer of the Valox Safe account
      * For **EOA wallets**: Standard EIP-712 signature is used
      * For **smart contract wallets**: ERC-1271 signature verification is used, and you must include the `smartWalletAddress` field in the request body
    </Note>
  </Step>

  <Step title="Submit Transaction">
    Once signed, [submit the transaction to execute the withdrawal](/api-reference/account-management/withdraw-from-safe-with-signature):

    ```bash cURL theme={null}
    # For EOA wallets
    curl -X POST \
    /api/v1/accounts/withdraw \
    -H "Content-Type: application/json" \
    -d '{
      "tokenAddress": "0x123456....",
      "to": "0x78910...",
      "amount": "1000000000000000000",
      "signature": "0x1234567890abcdef...",
      "message": {
        "salt": "0x1234567890...abcdef",
        "data": "0x123456...00de0b6b3a7640000"
      }
    }'

    # For smart contract wallets (include smartWalletAddress)
    curl -X POST \
    /api/v1/accounts/withdraw \
    -H "Content-Type: application/json" \
    -d '{
      "tokenAddress": "0x123456....",
      "to": "0x78910...",
      "amount": "1000000000000000000",
      "signature": "0x1234567890abcdef...",
      "message": {
        "salt": "0x1234567890...abcdef",
        "data": "0x123456...00de0b6b3a7640000"
      },
      "smartWalletAddress": "0x..."
    }'
    ```
  </Step>

  <Step title="Monitor the Execution">
    The withdrawal is processed through a **delay relay mechanism** that executes after 3 minutes.

    You can monitor the transaction status using the [delay-relay monitoring endpoints](/api-reference/safe-management/list-delayed-transactions) or by checking your Safe's transaction history.
  </Step>
</Steps>

## Complete Implementation Example

The following example demonstrates the complete flow:

```typescript theme={null}
const tokenAddress = "0x..."; // Token contract address
const toAddress = "0x..."; // Destination address
const amount = "1000000000000000000"; // Amount in token base units

/**
 * Step 1: Fetch transaction data for signing
 */
const response = await fetch(
  `https://api.valox.co/api/v1/accounts/withdraw/transaction-data?tokenAddress=${tokenAddress}&to=${toAddress}&amount=${amount}`
);
const { data: typedData } = await response.json();

/**
 * Step 2: Sign and submit the transaction
 */
const signature = await walletClient.signTypedData({
  ...typedData,
  domain: {
    ...typedData.domain,
    verifyingContract: typedData.domain.verifyingContract as `0x${string}`,
  },
});

const submitResponse = await fetch("https://api.valox.co/api/v1/accounts/withdraw", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    tokenAddress,
    to: toAddress,
    amount,
    signature,
    message: typedData.message,
    // Include smartWalletAddress if using a smart contract wallet
    // smartWalletAddress: "0x...",
  }),
});

const { data: transactionResult } = await submitResponse.json();

/**
 * Step 3: Monitor execution (optional)
 */
console.log(`Withdrawal submitted with ID: ${transactionResult.id}`);
console.log(`Status: ${transactionResult.status}`);
console.log("Transaction will be processed after the 3-minute delay period");
```

## Security Considerations

* Make sure the user is aware this transfer is on the Valox Chain
* Remember that transactions cannot be reversed once executed
* Cards are temporarily frozen during the withdrawal process as a security measure

## Token Support

This feature supports withdrawing any ERC-20 token that exists in the Safe account. Make sure to:

* Use the correct token contract address
* Specify the amount in the token's base units (considering decimals)
* Ensure sufficient token balance in the Safe account
