Users can directly interact with our bundler via API endpoints—enabling actions like sending UserOperations, estimating gas, and more. Learn more about how to use the bundler endpoints here.

Examples

Bundler API Examples

Checkout out our Bundler API Examples repository for a quick start.

  1. Clone the repository
git clone https://github.com/gelatodigital/how-to-use-bundler-api-endpoints.git
  1. Install dependencies
pnpm install

How to use the Bundler API Endpoints?

There are various methods of payments that can be used with Gelato Bundler, lets go through them one by one.

1. Sponsoring gas with 1Balance

Gelato’s 1Balance is a powerful alternative to traditional onchain paymasters. It acts as a cross-chain gas tank, allowing you to sponsor gas fees across any supported EVM-compatible chain — using just a single balance.

Instead of maintaining balances on multiple chains, you only need to deposit funds in one place, and you’re ready to sponsor gas anywhere.

Important: When using Gelato Bundler for Sponsoring Transactions with 1Balance, both maxFeePerGas and maxPriorityFeePerGas are set to 0. This allows transaction fees to be accurately settled post-execution, rather than upfront via the EntryPoint.

To start sponsoring transactions with 1Balance, follow these steps:

  1. Create a Sponsor API Key : Check out our How-To Guide for detailed instructions on generating a sponsor API key.
  2. Use the API Key in Your Requests : When calling Gelato API endpoints, make sure to include the sponsorAPIKey as a query parameter.
  3. Configure the UserOperation Parameters :
    • Set maxFeePerGas, maxPriorityFeePerGas, and preVerificationGas to 0 (0x0). This allows transaction fees to be settled after execution, rather than through the EntryPoint.
    • Leave all paymaster-related fields empty (i.e paymaster, paymasterData, paymasterPostOpGasLimit, paymasterVerificationGasLimit).

When you pass the sponsorAPIKey in the query params:

  • The eth_estimateUserOperationGas endpoint will return preVerificationGas as 0.
  • The eth_getUserOperationGasPrice endpoint will return maxFeePerGas and maxPriorityFeePerGas as 0.

Check out the required parameters for sponsoring gas with 1Balance in the following scenarios:

2. Onchain Paymasters

This is the standard method of sponsoring gas or paying gas fees with ERC-20 tokens using onchain paymasters.

To use features like gas sponsorship, ERC-20 token payments, or other custom payment methods via onchain paymasters, follow these steps:

  1. Include Paymaster Fields : You must pass all required paymaster-related fields along with the standard UserOperation parameters.
  2. sponsorAPIKey is not required for this method
  3. Fetch Gas Parameters from Gelato APIs : Use the following endpoints to retrieve gas-related values:
    • maxFeePerGas and maxPriorityFeePerGas can be fetched from eth_getUserOperationGasPrice API Endpoint.
    • callGasLimit, verificationGasLimit, preVerificationGas & paymasterVerificationGasLimit can be fetched from eth_estimateUserOperationGas API Endpoint.

Check out the required parameters for on-chain paymasters in the following scenarios:

3. Paying Gas with Native Tokens

This is the standard method where users pay gas fees directly using their native tokens (like ETH, MATIC, etc.).

To use this method, follow these steps:

  1. Keep Paymaster Fields Empty : Do not include any paymaster-related fields in the UserOperation parameters. This ensures the transaction is treated as a self-sponsored native token payment.
  2. sponsorAPIKey is not required for this method
  3. Fetch Gas Parameters from Gelato APIs : Use the following endpoints to retrieve gas-related values:
    • maxFeePerGas and maxPriorityFeePerGas can be fetched from eth_getUserOperationGasPrice API Endpoint.
    • callGasLimit, verificationGasLimit, preVerificationGas can be fetched from eth_estimateUserOperationGas API Endpoint.

Check out the required parameters for paying gas with native tokens in the following scenarios:


Now that you’ve learned about the required parameters for different payment methods with the Gelato Bundler, let’s move on to the next step: exploring the Bundler API Endpoints.