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

# Change GP Safe daily spending limit

> Manage daily spending limits for Gnosis Pay Safe accounts

The daily spending limit feature allows partners to manage daily spending limits for Gnosis Pay Safe accounts.

All transactions are gasless, enabling users to perform these operations completely free of charge.

## Overview

The daily spending limit update process involves the following steps:

1. **Fetch EIP-712 Typed Data** - Get the EIP-712 typed data for wallet signing
2. **Sign and Submit** - Sign the EIP-712 data and submit the update
3. **Monitor Update** - Wait for the delay relay to process the change and check the new limit

<Warning>
  * The signing wallet must be one of the Gnosis Pay Safe signers (EOA or smart contract wallet)
  * For smart contract wallets, signatures are verified using ERC-1271 standard
  * Updates are processed after a 3-minute delay as transactions are going through the Gnosis Pay delay relay
</Warning>

## Daily Limit Update Process

<Steps titleSize="h3">
  <Step title="Fetch EIP-712 Typed Data for Signing">
    [Get the EIP-712 typed data that needs to be signed by the user's wallet](/api-reference/account-management/get-eip-712-typed-data-for-setting-daily-limit):

    ```bash cURL theme={null}
    curl -X GET \
     /api/v1/accounts/daily-limit/transaction-data?newLimit=${newLimit}
    ```

    The response contains EIP-712 typed data with `domain`, `types`, `primaryType`, and `message` fields that need to be signed by the user's wallet using the EIP-712 standard.
  </Step>

  <Step title="Sign and Submit EIP-712 Data">
    <Warning>
      **Safe Activation Required**: This step only works when the Gnosis Pay Safe account has been fully activated and its modules are deployed. If you receive an error during submission, ensure that the Safe account activation process has been completed first.

      For more information about Safe account setup and module deployment, see the [Safe Management API documentation](/api-reference/safe-management/deploy-and-setup-a-safe).
    </Warning>

    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 Gnosis Pay 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>

    Once signed, [submit the transaction to update the daily limit](/api-reference/account-management/set-new-daily-spending-limit):

    ```bash cURL theme={null}
    # For EOA wallets
    curl -X PUT /api/v1/accounts/daily-limit \
     -d '{
      "newLimit": 1500,
      "signature": "0x...",
      "message": {
        "salt": "0x...",
        "data": "0x..."
      }
    }'

    # For smart contract wallets (include smartWalletAddress)
    curl -X PUT /api/v1/accounts/daily-limit \
     -d '{
      "newLimit": 1500,
      "signature": "0x...",
      "message": {
        "salt": "0x...",
        "data": "0x..."
      },
      "smartWalletAddress": "0x..."
    }'
    ```
  </Step>

  <Step title="Monitor the Transaction Execution">
    The daily limit change is processed through a delay relay mechanism that executes after 3 minutes.

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

    Additionally, you can also [poll the following endpoint to check when the new limit becomes active](/api-reference/account-management/get-current-daily-spending-limit):

    ```bash cURL theme={null}
    curl -X GET /api/v1/accounts/daily-limit
    ```
  </Step>
</Steps>

## Complete Implementation Example

The following example demonstrates the complete flow:

```typescript theme={null}

const newDailyLimit = 1337;

/**
 * Step 1: Fetch EIP-712 typed data for signing
 */
const response = await fetch(
  `https://api.gnosispay.com/api/v1/accounts/daily-limit/transaction-data?newLimit=${newDailyLimit}`
);
const { data: typedData } = await response.json();

/**
 * Step 2: Sign the EIP-712 typed data
 */
const signature = await walletClient.signTypedData({
  ...typedData,
  domain: {
    ...typedData.domain,
    verifyingContract: typedData.domain.verifyingContract as `0x${string}`,
  },
});

/**
 * Step 3: Submit the signed data
 */
const submitResponse = await fetch("https://api.gnosispay.com/api/v1/accounts/daily-limit", {
  method: "PUT",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    newLimit: newDailyLimit,
    signature,
    message: typedData.message,
    // Include smartWalletAddress if using a smart contract wallet
    // smartWalletAddress: "0x...",
  }),
});

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

/**
 * Step 4: Monitor for the updated limit
 */
console.log(`Daily limit update submitted with ID: ${updateResult.id}`);
console.log(`Status: ${updateResult.status}`);
console.log("Limit change will be processed after the 3-minute delay period");

// Optional: Poll for the updated limit
const pollForUpdate = async () => {
  const checkResponse = await fetch(
    "https://api.gnosispay.com/api/v1/accounts/daily-limit"
  );
  const { data: { dailyLimit: updatedLimit } } = await checkResponse.json();

  if (updatedLimit === newDailyLimit) {
    console.log(`Limit successfully updated to: ${updatedLimit}`);
    return true;
  }

  console.log(`Waiting for update... Current: ${updatedLimit}, Target: ${newDailyLimit}`);
  return false;
};

// Poll every 30 seconds until the update is complete
const interval = setInterval(async () => {
  if (await pollForUpdate()) {
    clearInterval(interval);
  }
}, 30000);
```
