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:
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.
To use Gas Manager Admin API, follow these steps:
- 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.
- Create access keys for your account: To call Gas Manager Admin APIs, an authorization header is required in all the requests. This
authheader should be your access key. Follow this guide for creating access keys.
- Create the policy: Next, make a request to the Create Policy endpoint with your policy rules.
- Activate the policy: Lastly, make a request to the Update Policy Status endpoint to change the policy status from "inactive" to "active".
All the Gas Manager Admin API endpoints are listed below, with links to their individual pages and brief descriptions.