Gas Manager Admin API Quickstart

Learn how to programmatically create, update, and manage gas manager policies for your app using the Gas Manager Admin API.

What is a Gas Manager Policy?

Gas manager policies are rules defined by you that govern how and when you will sponsor a user's gas fees. Examples of some of these rules are in the screenshot below:

Creating a gas policy through Alchemy Dashboard

Creating a gas policy through Alchemy Dashboard

What is the Gas Manager Admin API?

The Gas Manager Admin API is a REST API with endpoints that allow you to programmatically create, update and manage gas policies. Programmatically managing gas policies is for "power" users with complex use cases who need to manage this process dynamically through code instead of incrementally in the Alchemy Dashboard.

How to Use the Gas Manager Admin API to Create a Policy

To use Gas Manager Admin API, follow these steps:

  1. Create an Alchemy app: to create gas policies, you first need to create an Alchemy app through your Alchemy Dashboard. Because your policy will be linked to your app, make sure the network for this app is set to the network on which you will be sponsoring gas.
  2. Create access keys for your account: To call Gas Manager Admin APIs, an authorization header is required in all the requests. This auth header should be your access key. Follow this guide for creating access keys.
  3. Create the policy: Next, make a request to the Create Policy endpoint with your policy rules.

Gas Manager Admin API Endpoints

All the Gas Manager Admin API endpoints are listed below, with links to their individual pages and brief descriptions.

  • Accepts an app id and a rules object. Creates a new gas manager policy with the rules associated with the given app. Returns the policy id of the newly created policy. The new policy will be in the “inactive” status.
  • Returns policy information by id.
  • Deletes a policy by id
  • Accepts a rules object and replaces all rules in an existing policy by id.
  • Accepts an app id and returns all policies under that app.
  • Modifies the status of a policy to either "active" or "inactive".
  • Returns stats about a policy specified by ID, including signatures mined, signatures expired, signatures pending, USD mined, and USD pending.
  • Returns a list of sponsorships associated with the specified policy ID. The results are paginated.
ReadMe