# Create Policy

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

POST https://manage.g.alchemy.com/api/gasManager/policy

Creates a new gas manager policy with the specified rules. The newly created policy will be in the `inactive` status.

<Note title="Header Access Token">
  To call this endpoint, you must use your [access token](/docs/how-to-create-access-keys) in the [authorization header](/docs/how-to-use-api-keys-in-http-headers) of the API request. 
</Note>


Reference: https://www.alchemy.com/docs/wallets/api-reference/gas-manager-admin-api/admin-api-endpoints/create-policy

## Headers

| Name | Type | Required | Description |
|------|------|----------|-------------|
| Authorization | string | Yes | Bearer authentication token |

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://manage.g.alchemy.com/api/gasManager/policy \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "policyName": "My Policy",
  "policyType": "sponsorship",
  "appId": "6d834x9k1yh4dx6z",
  "networks": [
    "string"
  ],
  "rules": {
    "maxSpendUsd": 5000,
    "maxSpendPerSenderUsd": 100,
    "maxSpendPerUoUsd": 20,
    "maxCount": 100,
    "maxCountPerSender": 2,
    "senderAllowlist": [
      "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
      "0x70997970c51812dc3a010c7d01b50e0d17dc79c8"
    ],
    "senderBlocklist": [
      "string"
    ],
    "startTimeUnix": "1674228753",
    "endTimeUnix": "1679340742",
    "sponsorshipExpiryMs": "600000",
    "webhookRules": {
      "webhookUrl": "https://dashboard.alchemy.com/gas-manager/policy/create",
      "approveOnFailure": false
    }
  },
  "solanaRules": {
    "maxSpendUsd": 6500,
    "maxSpendPerTxnUsd": 30,
    "maxCount": 200,
    "startTimeUnix": "1674228753",
    "endTimeUnix": "1679340742"
  },
  "erc20Rules": {
    "maxSpendUsd": 5000,
    "maxSpendPerSenderUsd": 100,
    "maxSpendPerUoUsd": 20,
    "maxCount": 100,
    "maxCountPerSender": 2,
    "senderAllowlist": [
      "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
      "0x70997970c51812dc3a010c7d01b50e0d17dc79c8"
    ],
    "senderBlocklist": [
      "string"
    ],
    "startTimeUnix": "1674228753",
    "endTimeUnix": "1679340742",
    "sponsorshipExpiryMs": "600000",
    "webhookRules": {
      "webhookUrl": "https://dashboard.alchemy.com/gas-manager/policy/create",
      "approveOnFailure": false
    },
    "tokens": [
      {
        "network": "string",
        "tokenAddress": "string",
        "priceReferenceNetwork": "string",
        "priceReferenceTokenAddress": "string"
      }
    ],
    "recipientAddress": "string",
    "usePostOp": false,
    "priceMultiplier": 1
  }
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    policyName: 'My Policy',
    policyType: 'sponsorship',
    appId: '6d834x9k1yh4dx6z',
    networks: ['string'],
    rules: {
      maxSpendUsd: 5000,
      maxSpendPerSenderUsd: 100,
      maxSpendPerUoUsd: 20,
      maxCount: 100,
      maxCountPerSender: 2,
      senderAllowlist: [
        '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
        '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
      ],
      senderBlocklist: ['string'],
      startTimeUnix: '1674228753',
      endTimeUnix: '1679340742',
      sponsorshipExpiryMs: '600000',
      webhookRules: {
        webhookUrl: 'https://dashboard.alchemy.com/gas-manager/policy/create',
        approveOnFailure: false
      }
    },
    solanaRules: {
      maxSpendUsd: 6500,
      maxSpendPerTxnUsd: 30,
      maxCount: 200,
      startTimeUnix: '1674228753',
      endTimeUnix: '1679340742'
    },
    erc20Rules: {
      maxSpendUsd: 5000,
      maxSpendPerSenderUsd: 100,
      maxSpendPerUoUsd: 20,
      maxCount: 100,
      maxCountPerSender: 2,
      senderAllowlist: [
        '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
        '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
      ],
      senderBlocklist: ['string'],
      startTimeUnix: '1674228753',
      endTimeUnix: '1679340742',
      sponsorshipExpiryMs: '600000',
      webhookRules: {
        webhookUrl: 'https://dashboard.alchemy.com/gas-manager/policy/create',
        approveOnFailure: false
      },
      tokens: [
        {
          network: 'string',
          tokenAddress: 'string',
          priceReferenceNetwork: 'string',
          priceReferenceTokenAddress: 'string'
        }
      ],
      recipientAddress: 'string',
      usePostOp: false,
      priceMultiplier: 1
    }
  })
};

fetch('https://manage.g.alchemy.com/api/gasManager/policy', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://manage.g.alchemy.com/api/gasManager/policy"

payload = {
    "policyName": "My Policy",
    "policyType": "sponsorship",
    "appId": "6d834x9k1yh4dx6z",
    "networks": ["string"],
    "rules": {
        "maxSpendUsd": 5000,
        "maxSpendPerSenderUsd": 100,
        "maxSpendPerUoUsd": 20,
        "maxCount": 100,
        "maxCountPerSender": 2,
        "senderAllowlist": ["0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", "0x70997970c51812dc3a010c7d01b50e0d17dc79c8"],
        "senderBlocklist": ["string"],
        "startTimeUnix": "1674228753",
        "endTimeUnix": "1679340742",
        "sponsorshipExpiryMs": "600000",
        "webhookRules": {
            "webhookUrl": "https://dashboard.alchemy.com/gas-manager/policy/create",
            "approveOnFailure": False
        }
    },
    "solanaRules": {
        "maxSpendUsd": 6500,
        "maxSpendPerTxnUsd": 30,
        "maxCount": 200,
        "startTimeUnix": "1674228753",
        "endTimeUnix": "1679340742"
    },
    "erc20Rules": {
        "maxSpendUsd": 5000,
        "maxSpendPerSenderUsd": 100,
        "maxSpendPerUoUsd": 20,
        "maxCount": 100,
        "maxCountPerSender": 2,
        "senderAllowlist": ["0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", "0x70997970c51812dc3a010c7d01b50e0d17dc79c8"],
        "senderBlocklist": ["string"],
        "startTimeUnix": "1674228753",
        "endTimeUnix": "1679340742",
        "sponsorshipExpiryMs": "600000",
        "webhookRules": {
            "webhookUrl": "https://dashboard.alchemy.com/gas-manager/policy/create",
            "approveOnFailure": False
        },
        "tokens": [
            {
                "network": "string",
                "tokenAddress": "string",
                "priceReferenceNetwork": "string",
                "priceReferenceTokenAddress": "string"
            }
        ],
        "recipientAddress": "string",
        "usePostOp": False,
        "priceMultiplier": 1
    }
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://manage.g.alchemy.com/api/gasManager/policy"

	payload := strings.NewReader("{\n  \"policyName\": \"My Policy\",\n  \"policyType\": \"sponsorship\",\n  \"appId\": \"6d834x9k1yh4dx6z\",\n  \"networks\": [\n    \"string\"\n  ],\n  \"rules\": {\n    \"maxSpendUsd\": 5000,\n    \"maxSpendPerSenderUsd\": 100,\n    \"maxSpendPerUoUsd\": 20,\n    \"maxCount\": 100,\n    \"maxCountPerSender\": 2,\n    \"senderAllowlist\": [\n      \"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266\",\n      \"0x70997970c51812dc3a010c7d01b50e0d17dc79c8\"\n    ],\n    \"senderBlocklist\": [\n      \"string\"\n    ],\n    \"startTimeUnix\": \"1674228753\",\n    \"endTimeUnix\": \"1679340742\",\n    \"sponsorshipExpiryMs\": \"600000\",\n    \"webhookRules\": {\n      \"webhookUrl\": \"https://dashboard.alchemy.com/gas-manager/policy/create\",\n      \"approveOnFailure\": false\n    }\n  },\n  \"solanaRules\": {\n    \"maxSpendUsd\": 6500,\n    \"maxSpendPerTxnUsd\": 30,\n    \"maxCount\": 200,\n    \"startTimeUnix\": \"1674228753\",\n    \"endTimeUnix\": \"1679340742\"\n  },\n  \"erc20Rules\": {\n    \"maxSpendUsd\": 5000,\n    \"maxSpendPerSenderUsd\": 100,\n    \"maxSpendPerUoUsd\": 20,\n    \"maxCount\": 100,\n    \"maxCountPerSender\": 2,\n    \"senderAllowlist\": [\n      \"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266\",\n      \"0x70997970c51812dc3a010c7d01b50e0d17dc79c8\"\n    ],\n    \"senderBlocklist\": [\n      \"string\"\n    ],\n    \"startTimeUnix\": \"1674228753\",\n    \"endTimeUnix\": \"1679340742\",\n    \"sponsorshipExpiryMs\": \"600000\",\n    \"webhookRules\": {\n      \"webhookUrl\": \"https://dashboard.alchemy.com/gas-manager/policy/create\",\n      \"approveOnFailure\": false\n    },\n    \"tokens\": [\n      {\n        \"network\": \"string\",\n        \"tokenAddress\": \"string\",\n        \"priceReferenceNetwork\": \"string\",\n        \"priceReferenceTokenAddress\": \"string\"\n      }\n    ],\n    \"recipientAddress\": \"string\",\n    \"usePostOp\": false,\n    \"priceMultiplier\": 1\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")
	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://manage.g.alchemy.com/api/gasManager/policy")
  .header("Content-Type", "application/json")
  .header("Authorization", "Bearer <token>")
  .body("{\n  \"policyName\": \"My Policy\",\n  \"policyType\": \"sponsorship\",\n  \"appId\": \"6d834x9k1yh4dx6z\",\n  \"networks\": [\n    \"string\"\n  ],\n  \"rules\": {\n    \"maxSpendUsd\": 5000,\n    \"maxSpendPerSenderUsd\": 100,\n    \"maxSpendPerUoUsd\": 20,\n    \"maxCount\": 100,\n    \"maxCountPerSender\": 2,\n    \"senderAllowlist\": [\n      \"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266\",\n      \"0x70997970c51812dc3a010c7d01b50e0d17dc79c8\"\n    ],\n    \"senderBlocklist\": [\n      \"string\"\n    ],\n    \"startTimeUnix\": \"1674228753\",\n    \"endTimeUnix\": \"1679340742\",\n    \"sponsorshipExpiryMs\": \"600000\",\n    \"webhookRules\": {\n      \"webhookUrl\": \"https://dashboard.alchemy.com/gas-manager/policy/create\",\n      \"approveOnFailure\": false\n    }\n  },\n  \"solanaRules\": {\n    \"maxSpendUsd\": 6500,\n    \"maxSpendPerTxnUsd\": 30,\n    \"maxCount\": 200,\n    \"startTimeUnix\": \"1674228753\",\n    \"endTimeUnix\": \"1679340742\"\n  },\n  \"erc20Rules\": {\n    \"maxSpendUsd\": 5000,\n    \"maxSpendPerSenderUsd\": 100,\n    \"maxSpendPerUoUsd\": 20,\n    \"maxCount\": 100,\n    \"maxCountPerSender\": 2,\n    \"senderAllowlist\": [\n      \"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266\",\n      \"0x70997970c51812dc3a010c7d01b50e0d17dc79c8\"\n    ],\n    \"senderBlocklist\": [\n      \"string\"\n    ],\n    \"startTimeUnix\": \"1674228753\",\n    \"endTimeUnix\": \"1679340742\",\n    \"sponsorshipExpiryMs\": \"600000\",\n    \"webhookRules\": {\n      \"webhookUrl\": \"https://dashboard.alchemy.com/gas-manager/policy/create\",\n      \"approveOnFailure\": false\n    },\n    \"tokens\": [\n      {\n        \"network\": \"string\",\n        \"tokenAddress\": \"string\",\n        \"priceReferenceNetwork\": \"string\",\n        \"priceReferenceTokenAddress\": \"string\"\n      }\n    ],\n    \"recipientAddress\": \"string\",\n    \"usePostOp\": false,\n    \"priceMultiplier\": 1\n  }\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://manage.g.alchemy.com/api/gasManager/policy");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n  \"policyName\": \"My Policy\",\n  \"policyType\": \"sponsorship\",\n  \"appId\": \"6d834x9k1yh4dx6z\",\n  \"networks\": [\n    \"string\"\n  ],\n  \"rules\": {\n    \"maxSpendUsd\": 5000,\n    \"maxSpendPerSenderUsd\": 100,\n    \"maxSpendPerUoUsd\": 20,\n    \"maxCount\": 100,\n    \"maxCountPerSender\": 2,\n    \"senderAllowlist\": [\n      \"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266\",\n      \"0x70997970c51812dc3a010c7d01b50e0d17dc79c8\"\n    ],\n    \"senderBlocklist\": [\n      \"string\"\n    ],\n    \"startTimeUnix\": \"1674228753\",\n    \"endTimeUnix\": \"1679340742\",\n    \"sponsorshipExpiryMs\": \"600000\",\n    \"webhookRules\": {\n      \"webhookUrl\": \"https://dashboard.alchemy.com/gas-manager/policy/create\",\n      \"approveOnFailure\": false\n    }\n  },\n  \"solanaRules\": {\n    \"maxSpendUsd\": 6500,\n    \"maxSpendPerTxnUsd\": 30,\n    \"maxCount\": 200,\n    \"startTimeUnix\": \"1674228753\",\n    \"endTimeUnix\": \"1679340742\"\n  },\n  \"erc20Rules\": {\n    \"maxSpendUsd\": 5000,\n    \"maxSpendPerSenderUsd\": 100,\n    \"maxSpendPerUoUsd\": 20,\n    \"maxCount\": 100,\n    \"maxCountPerSender\": 2,\n    \"senderAllowlist\": [\n      \"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266\",\n      \"0x70997970c51812dc3a010c7d01b50e0d17dc79c8\"\n    ],\n    \"senderBlocklist\": [\n      \"string\"\n    ],\n    \"startTimeUnix\": \"1674228753\",\n    \"endTimeUnix\": \"1679340742\",\n    \"sponsorshipExpiryMs\": \"600000\",\n    \"webhookRules\": {\n      \"webhookUrl\": \"https://dashboard.alchemy.com/gas-manager/policy/create\",\n      \"approveOnFailure\": false\n    },\n    \"tokens\": [\n      {\n        \"network\": \"string\",\n        \"tokenAddress\": \"string\",\n        \"priceReferenceNetwork\": \"string\",\n        \"priceReferenceTokenAddress\": \"string\"\n      }\n    ],\n    \"recipientAddress\": \"string\",\n    \"usePostOp\": false,\n    \"priceMultiplier\": 1\n  }\n}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

```


## Operation Specification

```yaml
path: /api/gasManager/policy
method: POST
operation:
  summary: Create Policy
  description: |
    Creates a new gas manager policy with the specified rules. The newly created policy will be in the `inactive` status.

    <Note title="Header Access Token">
      To call this endpoint, you must use your [access token](/docs/how-to-create-access-keys) in the [authorization header](/docs/how-to-use-api-keys-in-http-headers) of the API request. 
    </Note>
  operationId: create-policy
  security:
    - BearerAuth: []
  requestBody:
    content:
      application/json:
        schema:
          type: object
          required:
            - policyName
            - policyType
            - appId
          properties:
            policyName:
              type: string
              description: Name of the policy
              default: My Policy
            policyType:
              description: Type of the policy. Supported values are `sponsorship` and `bundler_sponsorship` for sponsoring gas on EVM networks, `erc20` for enabling users to pay gas with any ERC-20 token on EVM networks, and `solana` for sponsoring fees and rent on Solana.
              type: string
              enum:
                - sponsorship
                - bundler_sponsorship
                - erc20
                - solana
              default: sponsorship
            appId:
              type: string
              description: |
                ID for the app associated with the new policy.
              default: 6d834x9k1yh4dx6z
            networks:
              description: |
                Networks to be enabled for the policy. Required for `sponsorship`, `bundler_sponsorship`, and `solana` policy types. Example: `ETH_MAINNET`. For Solana policies, valid values are `SOLANA_MAINNET` and `SOLANA_DEVNET`. For `erc20` policies, networks are specified in `erc20Rules.tokens` and this field is ignored.
              type: array
              items:
                type: string
            rules:
              description: Rules for `sponsorship` and `bundler_sponsorship` policy types. Omit for other policy types.
              type: object
              properties:
                maxSpendUsd:
                  type: number
                  description: Maximum amount of USD that can be sponsored
                  default: 5000
                maxSpendPerSenderUsd:
                  type: number
                  description: Maximum amount of USD that can be sponsored for a single sender (not enforced on testnets)
                  default: 100
                maxSpendPerUoUsd:
                  type: number
                  description: Maximum amount of USD that can be sponsored for a single userOperation (not enforced on testnets)
                  default: 20
                maxCount:
                  type: integer
                  description: Maximum number of userOperations that can be sponsored
                  default: 100
                maxCountPerSender:
                  type: integer
                  description: Maximum number of userOperations that can be sponsored for a single sender
                  default: 2
                senderAllowlist:
                  type: array
                  items:
                    type: string
                  description: List of addresses that are eligible for sponsorship
                  default:
                    - '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'
                    - '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
                senderBlocklist:
                  type: array
                  items:
                    type: string
                  description: List of addresses that are banned from receiving sponsorship
                startTimeUnix:
                  type: string
                  description: Unix timestamp of when the policy starts
                  default: '1674228753'
                endTimeUnix:
                  type: string
                  description: Unix timestamp of when the policy ends
                  default: '1679340742'
                sponsorshipExpiryMs:
                  type: string
                  description: Milliseconds after the sponsorship is issued that it expires
                  default: '600000'
                webhookRules:
                  type: object
                  description: Enable conditional gas sponsorship by making a request to your server to verify sponsorship eligibility
                  properties:
                    webhookUrl:
                      type: string
                      format: uri
                      description: The URL to call to verify sponsorship eligibility.
                      example: https://dashboard.alchemy.com/gas-manager/policy/create
                    approveOnFailure:
                      type: boolean
                      description: If true, the userOp will be sponsored in the event on an error or timeout.
                      default: false
                  required:
                    - webhookUrl
                    - approveOnFailure
              required:
                - startTimeUnix
            solanaRules:
              description: Rules for `solana` policy type. Omit for other policy types.
              type: object
              properties:
                maxSpendUsd:
                  type: number
                  description: Maximum amount of USD that can be sponsored
                  default: 6500
                maxSpendPerTxnUsd:
                  type: number
                  description: Maximum amount of USD that can be sponsored per transaction (not enforced on testnet)
                  default: 30
                maxCount:
                  type: integer
                  description: Maximum number of transactions that can be sponsored
                  default: 200
                startTimeUnix:
                  type: string
                  description: Unix timestamp of when the policy starts
                  default: '1674228753'
                endTimeUnix:
                  type: string
                  description: Unix timestamp of when the policy ends
                  default: '1679340742'
              required:
                - startTimeUnix
            erc20Rules:
              description: Rules for `erc20` policy type. Omit for other policy types.
              allOf:
                - type: object
                  properties:
                    maxSpendUsd:
                      type: number
                      description: Maximum amount of USD that can be sponsored
                      default: 5000
                    maxSpendPerSenderUsd:
                      type: number
                      description: Maximum amount of USD that can be sponsored for a single sender (not enforced on testnets)
                      default: 100
                    maxSpendPerUoUsd:
                      type: number
                      description: Maximum amount of USD that can be sponsored for a single userOperation (not enforced on testnets)
                      default: 20
                    maxCount:
                      type: integer
                      description: Maximum number of userOperations that can be sponsored
                      default: 100
                    maxCountPerSender:
                      type: integer
                      description: Maximum number of userOperations that can be sponsored for a single sender
                      default: 2
                    senderAllowlist:
                      type: array
                      items:
                        type: string
                      description: List of addresses that are eligible for sponsorship
                      default:
                        - '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'
                        - '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
                    senderBlocklist:
                      type: array
                      items:
                        type: string
                      description: List of addresses that are banned from receiving sponsorship
                    startTimeUnix:
                      type: string
                      description: Unix timestamp of when the policy starts
                      default: '1674228753'
                    endTimeUnix:
                      type: string
                      description: Unix timestamp of when the policy ends
                      default: '1679340742'
                    sponsorshipExpiryMs:
                      type: string
                      description: Milliseconds after the sponsorship is issued that it expires
                      default: '600000'
                    webhookRules:
                      type: object
                      description: Enable conditional gas sponsorship by making a request to your server to verify sponsorship eligibility
                      properties:
                        webhookUrl:
                          type: string
                          format: uri
                          description: The URL to call to verify sponsorship eligibility.
                          example: https://dashboard.alchemy.com/gas-manager/policy/create
                        approveOnFailure:
                          type: boolean
                          description: If true, the userOp will be sponsored in the event on an error or timeout.
                          default: false
                      required:
                        - webhookUrl
                        - approveOnFailure
                  required:
                    - startTimeUnix
                - type: object
                  properties:
                    tokens:
                      type: array
                      items:
                        type: object
                        properties:
                          network:
                            type: string
                            description: Network of the Erc20 token
                          tokenAddress:
                            type: string
                            description: Erc20 token contract address
                          priceReferenceNetwork:
                            type: string
                            description: Network of the token used as a price reference to calculate an ERC-20 token's conversion rate. Required together with `priceReferenceTokenAddress` for testnet tokens. For mainnet tokens, omit both fields to use the payment token's supported price, or provide both fields to use a price reference instead. Choose a reference token with the same number of decimals as the payment token.
                          priceReferenceTokenAddress:
                            type: string
                            description: Contract address of the token on `priceReferenceNetwork` used as a price reference to calculate an ERC-20 token's conversion rate. Required together with `priceReferenceNetwork` for testnet tokens. For mainnet tokens, omit both fields to use the payment token's supported price, or provide both fields to use a price reference instead. Choose a reference token with the same number of decimals as the payment token.
                        required:
                          - network
                          - tokenAddress
                      description: Erc20 tokens allowed under this policy.
                    recipientAddress:
                      type: string
                      description: Wallet address that will receive the tokens paid by users. Please ensure that you own this address across all networks enabled under this policy.
                    usePostOp:
                      type: boolean
                      description: |
                        Erc20 transfer mode
                        - [Recommended] True: The user pays for the gas after the userOp execution. Enables the user to allow the paymaster contract to spend the ERC-20 token on their behalf (`approve()`) without a separate tx, improving ux. If the transfer fails, the userOp will revert but you’ll remain liable for the gas costs.
                        - False: The user pays for the gas before the userOp execution. Requires the paymaster contract to have allowance onchain before the userOp gets submitted. If the allowance doesn’t exist, the userOp will fail immediately.
                    priceMultiplier:
                      type: number
                      default: 1
                      description: |
                        Adjust the Erc20 amount the user pays. For example:
                        - `1.1` means that the user pays 10% more (you monetize gas payments)
                        - `0.95` means that the user pays 5% less (you partially sponsor gas)
                  required:
                    - tokens
                    - recipientAddress
                    - usePostOp
  responses:
    '200':
      description: Policy created successfully
      content:
        application/json:
          schema:
            type: object
            required:
              - data
            properties:
              data:
                type: object
                properties:
                  policy:
                    type: object
                    properties:
                      policyId:
                        type: string
                        description: String ID of the policy
                        default: '0x1234567890abcdef'
                      appId:
                        type: string
                        description: String ID of the app
                        default: '0x1234567890abcdef'
                      status:
                        type: string
                        enum:
                          - active
                          - inactive
                          - pending_approval
                          - rejected
                        description: Status of the policy.
                      rules:
                        description: Rules for `sponsorship` and `bundler_sponsorship` policy types. Empty if `policyType` is not `sponsorship` or `bundler_sponsorship`.
                        type: object
                        properties:
                          maxSpendUsd:
                            type: number
                            description: Maximum amount of USD that can be sponsored
                            default: 5000
                          maxSpendPerSenderUsd:
                            type: number
                            description: Maximum amount of USD that can be sponsored for a single sender (not enforced on testnets)
                            default: 100
                          maxSpendPerUoUsd:
                            type: number
                            description: Maximum amount of USD that can be sponsored for a single userOperation (not enforced on testnets)
                            default: 20
                          maxCount:
                            type: integer
                            description: Maximum number of userOperations that can be sponsored
                            default: 100
                          maxCountPerSender:
                            type: integer
                            description: Maximum number of userOperations that can be sponsored for a single sender
                            default: 2
                          senderAllowlist:
                            type: array
                            items:
                              type: string
                            description: List of addresses that are eligible for sponsorship
                            default:
                              - '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'
                              - '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
                          senderBlocklist:
                            type: array
                            items:
                              type: string
                            description: List of addresses that are banned from receiving sponsorship
                          startTimeUnix:
                            type: string
                            description: Unix timestamp of when the policy starts
                            default: '1674228753'
                          endTimeUnix:
                            type: string
                            description: Unix timestamp of when the policy ends
                            default: '1679340742'
                          sponsorshipExpiryMs:
                            type: string
                            description: Milliseconds after the sponsorship is issued that it expires
                            default: '600000'
                          webhookRules:
                            type: object
                            description: Enable conditional gas sponsorship by making a request to your server to verify sponsorship eligibility
                            properties:
                              webhookUrl:
                                type: string
                                format: uri
                                description: The URL to call to verify sponsorship eligibility.
                                example: https://dashboard.alchemy.com/gas-manager/policy/create
                              approveOnFailure:
                                type: boolean
                                description: If true, the userOp will be sponsored in the event on an error or timeout.
                                default: false
                            required:
                              - webhookUrl
                              - approveOnFailure
                        required:
                          - startTimeUnix
                      policyName:
                        type: string
                        description: Name of the policy
                        default: Gas Manager Policy
                      lastUpdatedUnix:
                        type: string
                        description: Unix timestamp of when the policy was last updated
                        default: '1674228753'
                      policyVersion:
                        type: integer
                        description: Version of the policy
                        default: 0
                      policyType:
                        description: Type of the policy.
                        type: string
                        enum:
                          - sponsorship
                          - bundler_sponsorship
                          - erc20
                          - solana
                        default: sponsorship
                      policyState:
                        type: string
                        description: State of the policy
                        default: ongoing
                      networks:
                        type: array
                        items:
                          type: string
                        description: List of networks the policy is active on
                      gasPumpId:
                        type: string
                        description: Gas pump id
                      erc20Rules:
                        description: Erc20 rules for policy. Empty if `policyType` is not `erc20`.
                        allOf:
                          - type: object
                            properties:
                              maxSpendUsd:
                                type: number
                                description: Maximum amount of USD that can be sponsored
                                default: 5000
                              maxSpendPerSenderUsd:
                                type: number
                                description: Maximum amount of USD that can be sponsored for a single sender (not enforced on testnets)
                                default: 100
                              maxSpendPerUoUsd:
                                type: number
                                description: Maximum amount of USD that can be sponsored for a single userOperation (not enforced on testnets)
                                default: 20
                              maxCount:
                                type: integer
                                description: Maximum number of userOperations that can be sponsored
                                default: 100
                              maxCountPerSender:
                                type: integer
                                description: Maximum number of userOperations that can be sponsored for a single sender
                                default: 2
                              senderAllowlist:
                                type: array
                                items:
                                  type: string
                                description: List of addresses that are eligible for sponsorship
                                default:
                                  - '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'
                                  - '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
                              senderBlocklist:
                                type: array
                                items:
                                  type: string
                                description: List of addresses that are banned from receiving sponsorship
                              startTimeUnix:
                                type: string
                                description: Unix timestamp of when the policy starts
                                default: '1674228753'
                              endTimeUnix:
                                type: string
                                description: Unix timestamp of when the policy ends
                                default: '1679340742'
                              sponsorshipExpiryMs:
                                type: string
                                description: Milliseconds after the sponsorship is issued that it expires
                                default: '600000'
                              webhookRules:
                                type: object
                                description: Enable conditional gas sponsorship by making a request to your server to verify sponsorship eligibility
                                properties:
                                  webhookUrl:
                                    type: string
                                    format: uri
                                    description: The URL to call to verify sponsorship eligibility.
                                    example: https://dashboard.alchemy.com/gas-manager/policy/create
                                  approveOnFailure:
                                    type: boolean
                                    description: If true, the userOp will be sponsored in the event on an error or timeout.
                                    default: false
                                required:
                                  - webhookUrl
                                  - approveOnFailure
                            required:
                              - startTimeUnix
                          - type: object
                            properties:
                              tokens:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    network:
                                      type: string
                                      description: Network of the Erc20 token
                                    tokenAddress:
                                      type: string
                                      description: Erc20 token contract address
                                    priceReferenceNetwork:
                                      type: string
                                      description: Network of the token used as a price reference to calculate an ERC-20 token's conversion rate. Required together with `priceReferenceTokenAddress` for testnet tokens. For mainnet tokens, omit both fields to use the payment token's supported price, or provide both fields to use a price reference instead. Choose a reference token with the same number of decimals as the payment token.
                                    priceReferenceTokenAddress:
                                      type: string
                                      description: Contract address of the token on `priceReferenceNetwork` used as a price reference to calculate an ERC-20 token's conversion rate. Required together with `priceReferenceNetwork` for testnet tokens. For mainnet tokens, omit both fields to use the payment token's supported price, or provide both fields to use a price reference instead. Choose a reference token with the same number of decimals as the payment token.
                                  required:
                                    - network
                                    - tokenAddress
                                description: Erc20 tokens allowed under this policy.
                              recipientAddress:
                                type: string
                                description: Wallet address that will receive the tokens paid by users. Please ensure that you own this address across all networks enabled under this policy.
                              usePostOp:
                                type: boolean
                                description: |
                                  Erc20 transfer mode
                                  - [Recommended] True: The user pays for the gas after the userOp execution. Enables the user to allow the paymaster contract to spend the ERC-20 token on their behalf (`approve()`) without a separate tx, improving ux. If the transfer fails, the userOp will revert but you’ll remain liable for the gas costs.
                                  - False: The user pays for the gas before the userOp execution. Requires the paymaster contract to have allowance onchain before the userOp gets submitted. If the allowance doesn’t exist, the userOp will fail immediately.
                              priceMultiplier:
                                type: number
                                default: 1
                                description: |
                                  Adjust the Erc20 amount the user pays. For example:
                                  - `1.1` means that the user pays 10% more (you monetize gas payments)
                                  - `0.95` means that the user pays 5% less (you partially sponsor gas)
                            required:
                              - tokens
                              - recipientAddress
                              - usePostOp
                      solanaRules:
                        description: Solana rules for policy. Empty if `policyType` is not `solana`.
                        type: object
                        properties:
                          maxSpendUsd:
                            type: number
                            description: Maximum amount of USD that can be sponsored
                            default: 6500
                          maxSpendPerTxnUsd:
                            type: number
                            description: Maximum amount of USD that can be sponsored per transaction (not enforced on testnet)
                            default: 30
                          maxCount:
                            type: integer
                            description: Maximum number of transactions that can be sponsored
                            default: 200
                          startTimeUnix:
                            type: string
                            description: Unix timestamp of when the policy starts
                            default: '1674228753'
                          endTimeUnix:
                            type: string
                            description: Unix timestamp of when the policy ends
                            default: '1679340742'
                        required:
                          - startTimeUnix
                    required:
                      - policyId
                      - appId
                      - status
```
