# Get All Policies

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

GET https://manage.g.alchemy.com/api/gasManager/policies

Returns all policies. The results are paginated.

<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/get-all-policies

## Headers

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

## Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| appId | string | No | An optional app id to filter results by policies associated with that app.  |
| limit | integer | No | An optional parameter to limit the number of results per page. |
| before | string | No | String - used for pagination. If there are previous results, `before` field is returned in the response and can be passed in the request to fetch the previous page. |
| after | string | No | String - used for pagination. If more results are available `after` field is returned in the response and can be passed in the request to fetch the next page. |

## Code Examples

### cURL

```bash
curl --request GET \
  --url https://manage.g.alchemy.com/api/gasManager/policies \
  --header 'Authorization: Bearer <token>'
```

### JavaScript

```javascript
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://manage.g.alchemy.com/api/gasManager/policies', 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/policies"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
```

### Go

```go
package main

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

func main() {

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

	req, _ := http.NewRequest("GET", url, nil)

	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.get("https://manage.g.alchemy.com/api/gasManager/policies")
  .header("Authorization", "Bearer <token>")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://manage.g.alchemy.com/api/gasManager/policies");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
var response = await client.GetAsync(request);

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

```


## Operation Specification

```yaml
path: /api/gasManager/policies
method: GET
operation:
  summary: Get All Policies
  description: |
    Returns all policies. The results are paginated.

    <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: get-all-policies
  security:
    - BearerAuth: []
  parameters:
    - name: appId
      in: query
      description: |
        An optional app id to filter results by policies associated with that app.
      schema:
        type: string
        default: 6d834x9k1yh4dx6z
    - name: limit
      in: query
      description: An optional parameter to limit the number of results per page.
      schema:
        type: integer
        default: 10
    - name: before
      in: query
      description: String - used for pagination. If there are previous results, `before` field is returned in the response and can be passed in the request to fetch the previous page.
      schema:
        type: string
    - name: after
      in: query
      description: String - used for pagination. If more results are available `after` field is returned in the response and can be passed in the request to fetch the next page.
      schema:
        type: string
  responses:
    '200':
      description: Policies fetched successfully
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                type: object
                properties:
                  policies:
                    type: array
                    items:
                      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
                          description: Status of the policy
                          default: active
                        rules:
                          description: Rules for `sponsorship` policy type. Empty if `policyType` is not `sponsorship`.
                          type: object
                          properties:
                            maxSpendUsd:
                              type: string
                              description: Maximum amount of USD that can be sponsored
                              default: '5000.00'
                            maxSpendPerSenderUsd:
                              type: string
                              description: Maximum amount of USD that can be sponsored for a single sender (not enforced on testnets)
                              default: '100.00'
                            maxSpendPerUoUsd:
                              type: string
                              description: Maximum amount of USD that can be sponsored for a single userOperation (not enforced on testnets)
                              default: '20.00'
                            maxCount:
                              type: string
                              description: Maximum number of userOperations that can be sponsored
                              default: '100'
                            maxCountPerSender:
                              type: string
                              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 from signing that the sponsorship 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
                            - sponsorshipExpiryMs
                        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: number
                          description: Version of the policy
                          default: 0
                        policyType:
                          description: Type of the policy.
                          type: string
                          enum:
                            - 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
                        gas_pump_id:
                          type: string
                          description: Gas pump id
                        erc20_rules:
                          description: Erc20 rules for policy. Empty if `policyType` is not `erc20`.
                          type: object
                          properties:
                            tokens:
                              type: array
                              items:
                                type: object
                                properties:
                                  network:
                                    type: string
                                    description: Network of the Erc20 token
                                  token_address:
                                    type: string
                                    description: Erc20 token contract address
                                  price_reference_network:
                                    type: string
                                    description: Network to be used to calculate conversion rate (required for testnet ERC-20 tokens)
                                  price_reference_token_address:
                                    type: string
                                    description: Erc20 token contract address (on `price_reference_network`) to be used to calculate conversion rate (required for testnet ERC-20 tokens)
                                required:
                                  - network
                                  - token_address
                              description: Erc20 tokens allowed under this policy
                            recipient_address:
                              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
                            use_post_op:
                              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.
                            price_multiplier:
                              type: number
                              description: |
                                Adjust the Erc20 amount the user pays. For example: 
                                - `1.1` means that they user pays 10% more (you monetize gas payments)
                                - `0.95` means that the user pays 5% less (you partially sponsor gas)
                            rules:
                              description: Rules for `erc20` policy type.
                              type: object
                              properties:
                                maxSpendUsd:
                                  type: string
                                  description: Maximum amount of USD that can be sponsored
                                  default: '5000.00'
                                maxSpendPerSenderUsd:
                                  type: string
                                  description: Maximum amount of USD that can be sponsored for a single sender (not enforced on testnets)
                                  default: '100.00'
                                maxSpendPerUoUsd:
                                  type: string
                                  description: Maximum amount of USD that can be sponsored for a single userOperation (not enforced on testnets)
                                  default: '20.00'
                                maxCount:
                                  type: string
                                  description: Maximum number of userOperations that can be sponsored
                                  default: '100'
                                maxCountPerSender:
                                  type: string
                                  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 from signing that the sponsorship 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
                                - sponsorshipExpiryMs
                        solana_rules:
                          description: Solana rules for policy. Empty if `policyType` is not `solana`.
                          type: object
                          properties:
                            maxSpendUsd:
                              type: string
                              description: Maximum amount of USD that can be sponsored
                              default: '6500.00'
                            maxSpendPerTxnUsd:
                              type: string
                              description: Maximum amount of USD that can be sponsored per transaction (not enforced on testnet)
                              default: '30.00'
                            maxCount:
                              type: string
                              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:
                        - policyId
                        - appId
                        - status
                  before:
                    type: string
                    description: String - used for pagination. If there are previous results, `before` field is returned in the response and can be passed in the request to fetch the previous page. Can be null if there are no previous results. Can be null if there are no previous results.
                  after:
                    type: string
                    description: String - used for pagination. If more results are available `after` field is returned in the response and can be passed in the request to fetch the next page. Can be null if there are no more results.
              error:
                type: object
                properties:
                  msg:
                    type: string
```
