# /v1/beacon/rewards/attestations/{epoch}

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

POST https://eth-mainnetbeacon.g.alchemy.com/v2/docs-demo/eth/v1/beacon/rewards/attestations/{epoch}

Retrieve attestation reward info for validators specified by an array of **public keys** or **validator indices**.   If no array is provided, reward info for **every validator** will be returned.


Reference: https://www.alchemy.com/docs/chains/ethereum/ethereum-beacon-api-endpoints/ethereum-beacon-api-endpoints/v-1-beacon-rewards-attestations-epoch

## Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| epoch | string | Yes | Epoch identifier from which to retrieve rewards info. |

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://eth-mainnetbeacon.g.alchemy.com/v2/docs-demo/eth/v1/beacon/rewards/attestations/1 \
  --header 'Content-Type: application/json' \
  --data '[
  "474200"
]'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify(['474200'])
};

fetch('https://eth-mainnetbeacon.g.alchemy.com/v2/docs-demo/eth/v1/beacon/rewards/attestations/1', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://eth-mainnetbeacon.g.alchemy.com/v2/docs-demo/eth/v1/beacon/rewards/attestations/1"

payload = ["474200"]
headers = {"Content-Type": "application/json"}

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://eth-mainnetbeacon.g.alchemy.com/v2/docs-demo/eth/v1/beacon/rewards/attestations/1"

	payload := strings.NewReader("[\n  \"474200\"\n]")

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

	req.Header.Add("Content-Type", "application/json")

	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://eth-mainnetbeacon.g.alchemy.com/v2/docs-demo/eth/v1/beacon/rewards/attestations/1")
  .header("Content-Type", "application/json")
  .body("[\n  \"474200\"\n]")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://eth-mainnetbeacon.g.alchemy.com/v2/docs-demo/eth/v1/beacon/rewards/attestations/1");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("[\n  \"474200\"\n]", false);
var response = await client.PostAsync(request);

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

```


## Operation Specification

```yaml
path: /eth/v1/beacon/rewards/attestations/{epoch}
method: POST
operation:
  summary: /v1/beacon/rewards/attestations/{epoch}
  description: |
    Retrieve attestation reward info for validators specified by an array of **public keys** or **validator indices**.   If no array is provided, reward info for **every validator** will be returned.
  tags:
    - Ethereum Beacon API Endpoints
  security:
    - apiKey: []
  parameters:
    - name: epoch
      in: path
      required: true
      schema:
        type: string
        example: '1'
      description: Epoch identifier from which to retrieve rewards info.
  requestBody:
    required: false
    content:
      application/json:
        schema:
          type: array
          items:
            type: string
            description: Either hex encoded public key (0x…48 bytes) or validator index.
          example:
            - '474200'
  responses:
    '200':
      description: Attestation rewards for validators.
      content:
        application/json:
          schema:
            type: object
            properties:
              execution_optimistic:
                type: boolean
              finalized:
                type: boolean
              data:
                type: object
                properties:
                  ideal_rewards:
                    type: array
                    description: Ideal rewards baselines for validators.
                    items:
                      type: object
                      properties:
                        effective_balance:
                          type: string
                          example: '32000000000'
                        head:
                          type: string
                          example: '2500'
                        target:
                          type: string
                          example: '5000'
                        source:
                          type: string
                          example: '5000'
                        inclusion_delay:
                          type: string
                          example: '1'
                        inactivity:
                          type: string
                          example: '5000'
                  total_rewards:
                    type: array
                    description: Total rewards actually received by validators.
                    items:
                      type: object
                      properties:
                        validator_index:
                          type: string
                          example: '474200'
                        head:
                          type: string
                          example: '2000'
                        target:
                          type: string
                          example: '2000'
                        source:
                          type: string
                          example: '4000'
                        inclusion_delay:
                          type: string
                          example: '1'
                        inactivity:
                          type: string
                          example: '2000'
          examples:
            response_example:
              summary: Example response
              value:
                execution_optimistic: false
                finalized: false
                data:
                  ideal_rewards:
                    - effective_balance: '32000000000'
                      head: '2500'
                      target: '5000'
                      source: '5000'
                      inclusion_delay: '1'
                      inactivity: '5000'
                  total_rewards:
                    - validator_index: '474200'
                      head: '2000'
                      target: '2000'
                      source: '4000'
                      inclusion_delay: '1'
                      inactivity: '2000'
```
