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

# 1. Set Account Type

> Choose the execution mode that matches your wallet infrastructure.

<Tabs>
  <Tab title="EOA">
    ## Standard EOA Mode

    Use this mode for standard Ethereum external wallet accounts from wallets like MetaMask, Rabby, or Trust Wallet or when using WalletConnect.

    **Key requirements:**

    * Requires `fundingTokens` parameter
    * One signature per funding token (1 token = 1 signature, 2 tokens = 2 signatures)

    <CodeGroup>
      ```typescript TypeScript theme={null}
      const quoteRequest = {
        mode: "eoa",
        ownerAddress: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
        fundingTokens: [
          {
            tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
            chainId: 1,
            amount: "1000000000"
          }
        ],
        composeFlows: [...],
        // other parameters
      };

      const response = await fetch('https://api.biconomy.io/v1/quote', {
        method: 'POST',
        headers: {
          'X-API-Key': 'YOUR_API_KEY',
          'Content-Type': 'application/json'
        },
        body: JSON.stringify(quoteRequest)
      });
      ```

      ```bash cURL theme={null}
      curl -X POST https://api.biconomy.io/v1/quote \
        -H "X-API-Key: YOUR_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{
          "mode": "eoa",
          "ownerAddress": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
          "fundingTokens": [
            {
              "tokenAddress": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
              "chainId": 1,
              "amount": "1000000000"
            }
          ],
          "composeFlows": [...]
        }'
      ```
    </CodeGroup>
  </Tab>

  <Tab title="EOA-7702">
    ## EIP-7702 Delegated Mode

    Use this mode if you have access to EIP-7702 delegation, typically available through embedded wallet providers like Privy, Dynamic, or Trust, or
    if you have direct access to the private key (e.g. on the backend).

    **When to use:**

    * Your users have embedded wallets that support EIP-7702
    * You want to leverage delegation features

    <CodeGroup>
      ```typescript TypeScript theme={null}
      const quoteRequest = {
        mode: "eoa-7702",
        ownerAddress: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
        authorizations: [
          {
            address: "0x00000069E0Fb590E092Dd0E36FF93ac28ff11a3a",
            chainId: 8453,
            nonce: 38,
            r: "0x192a2503401595804c35cdc5b748fe35cceb77ef534bf5d670f7797376487ded",
            s: "0x1fd3c8acd0b7c5f64a8d72c35c39988544fca961b838277ab11750041cccc3d1",
            yParity: 1
          }
        ],
        composeFlows: [...],
        // other parameters
      };

      const response = await fetch('https://api.biconomy.io/v1/quote', {
        method: 'POST',
        headers: {
          'X-API-Key': 'YOUR_API_KEY',
          'Content-Type': 'application/json'
        },
        body: JSON.stringify(quoteRequest)
      });
      ```

      ```bash cURL theme={null}
      curl -X POST https://api.biconomy.io/v1/quote \
        -H "X-API-Key: YOUR_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{
          "mode": "eoa-7702",
          "ownerAddress": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
          "authorizations": [
            {
              "address": "0x00000069E0Fb590E092Dd0E36FF93ac28ff11a3a",
              "chainId": 8453,
              "nonce": 38,
              "r": "0x192a2503401595804c35cdc5b748fe35cceb77ef534bf5d670f7797376487ded",
              "s": "0x1fd3c8acd0b7c5f64a8d72c35c39988544fca961b838277ab11750041cccc3d1",
              "yParity": 1
            }
          ],
          "composeFlows": [...]
        }'
      ```
    </CodeGroup>

    ### Getting EIP-7702 Authorization

    If you don't have the authorization yet, use the **412 fallback pattern**:

    ```typescript theme={null}
    // Step 1: Try quote without authorization
    let quoteResponse = await fetch('https://api.biconomy.io/v1/quote', {
      method: 'POST',
      headers: {
        'X-API-Key': 'YOUR_API_KEY',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        mode: "eoa-7702",
        ownerAddress: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
        composeFlows: [...]
      })
    });

    // Step 2: Handle 412 error (missing authorization)
    if (quoteResponse.status === 412) {
      const error = await quoteResponse.json();
      const authItems = error.authorizations;

      // Step 3: Sign authorizations
      const signedAuths = await Promise.all(
        authItems.map(async (authItem) => {
          const authorization = await walletClient.signAuthorization({
            ...authItem,
            account
          });

          return {
            ...authorization,
            yParity: authorization.yParity,
            v: authorization.v?.toString()
          };
        })
      );

      // Step 4: Retry quote with authorizations
      quoteResponse = await fetch('https://api.biconomy.io/v1/quote', {
        method: 'POST',
        headers: {
          'X-API-Key': 'YOUR_API_KEY',
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          mode: "eoa-7702",
          ownerAddress: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
          composeFlows: [...],
          authorizations: signedAuths
        })
      });
    }

    const quote = await quoteResponse.json();
    ```
  </Tab>

  <Tab title="Smart Account">
    ## Smart Account Mode

    Use this mode if your application is built on native ERC-7579 smart accounts, such as Biconomy Nexus accounts.

    **When to use:**

    * You've deployed Biconomy Nexus accounts for your users
    * Your app uses ERC-7579 compatible smart accounts

    <CodeGroup>
      ```typescript TypeScript theme={null}
      const quoteRequest = {
        mode: "smart-account",
        ownerAddress: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
        composeFlows: [...],
        // other parameters
      };

      const response = await fetch('https://api.biconomy.io/v1/quote', {
        method: 'POST',
        headers: {
          'X-API-Key': 'YOUR_API_KEY',
          'Content-Type': 'application/json'
        },
        body: JSON.stringify(quoteRequest)
      });
      ```

      ```bash cURL theme={null}
      curl -X POST https://api.biconomy.io/v1/quote \
        -H "X-API-Key: YOUR_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{
          "mode": "smart-account",
          "ownerAddress": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
          "composeFlows": [...]
        }'
      ```
    </CodeGroup>
  </Tab>
</Tabs>
