# Get Sponsorships

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

GET https://manage.g.alchemy.com/api/gasManager/policy/{id}/sponsorships

Returns a list of sponsorships associated with the specified policy ID. 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-sponsorships

## Headers

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

## Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| id | string | Yes | ID of the policy. |

## Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| limit | integer | No | Limits the number of sponsorships returned. |

## Code Examples

### cURL

```bash
curl --request GET \
  --url https://manage.g.alchemy.com/api/gasManager/policy/a844e221-3c13-40c6-95db-d2db390e14b5/sponsorships \
  --header 'Authorization: Bearer <token>'
```

### JavaScript

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

fetch('https://manage.g.alchemy.com/api/gasManager/policy/a844e221-3c13-40c6-95db-d2db390e14b5/sponsorships', 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/a844e221-3c13-40c6-95db-d2db390e14b5/sponsorships"

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/policy/a844e221-3c13-40c6-95db-d2db390e14b5/sponsorships"

	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/policy/a844e221-3c13-40c6-95db-d2db390e14b5/sponsorships")
  .header("Authorization", "Bearer <token>")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://manage.g.alchemy.com/api/gasManager/policy/a844e221-3c13-40c6-95db-d2db390e14b5/sponsorships");
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/policy/{id}/sponsorships
method: GET
operation:
  summary: Get Sponsorships
  description: |
    Returns a list of sponsorships associated with the specified policy ID. 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-sponsorships
  security:
    - BearerAuth: []
  parameters:
    - name: id
      in: path
      required: true
      description: ID of the policy.
      schema:
        type: string
        default: a844e221-3c13-40c6-95db-d2db390e14b5
    - name: limit
      in: query
      description: Limits the number of sponsorships returned.
      schema:
        type: integer
        default: 5
  responses:
    '200':
      description: Sponsorships fetched successfully
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                type: object
                properties:
                  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.
                  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.
                  sponsorships:
                    type: array
                    items:
                      type: object
                      properties:
                        sender:
                          type: string
                          description: Address of the sender.
                        grantedAt:
                          type: string
                          description: Unix timestamp of when the sponsorship was granted.
                        confirmedTotalUsd:
                          type: string
                          description: Total amount of USD that was sponsored. Can be null if the userOp has not been mined.
                        status:
                          type: string
                          description: Status of the sponsorship. Can be PENDING, MINED or EXPIRED.
                        uoHash:
                          type: string
                          description: Hash of the userOperation.
                        uoExplorerUrl:
                          type: string
                          description: URL to view the userOperation in a block explorer.
                        txnHash:
                          type: string
                          description: Hash of the bundle transaction containing the userOperation. Can be null if not yet mined.
                        txnExplorerUrl:
                          type: string
                          description: URL to view the bundle transaction in an explorer. Can be null if not yet mined.
                        network:
                          type: string
                          description: Network where the userOperation was submitted.
                      required:
                        - sender
                        - grantedAt
                        - status
                        - uoHash
                        - uoExplorerUrl
                        - network
              error:
                type: object
                properties:
                  msg:
                    type: string
```
