# /v1/validator/duties/attester/{epoch}

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

POST https://eth-mainnetbeacon.g.alchemy.com/v2/docs-demo/eth/v1/validator/duties/attester/{epoch}

Requests the beacon node to provide a set of attestation duties, which should be performed by validators, for a particular epoch. Duties should only need to be checked once per epoch, however a chain reorganization could occur, resulting in a change of duties.


Reference: https://www.alchemy.com/docs/chains/ethereum/ethereum-beacon-api-endpoints/ethereum-beacon-api-endpoints/v-1-validator-duties-attester-epoch

## Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| epoch | string | Yes | Should only be allowed 1 epoch ahead.  |

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://eth-mainnetbeacon.g.alchemy.com/v2/docs-demo/eth/v1/validator/duties/attester/387896 \
  --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/validator/duties/attester/387896', 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/validator/duties/attester/387896"

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/validator/duties/attester/387896"

	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/validator/duties/attester/387896")
  .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/validator/duties/attester/387896");
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/validator/duties/attester/{epoch}
method: POST
operation:
  summary: /v1/validator/duties/attester/{epoch}
  description: |
    Requests the beacon node to provide a set of attestation duties, which should be performed by validators, for a particular epoch. Duties should only need to be checked once per epoch, however a chain reorganization could occur, resulting in a change of duties.
  tags:
    - Ethereum Beacon API Endpoints
  security:
    - apiKey: []
  parameters:
    - name: epoch
      in: path
      required: true
      schema:
        type: string
        example: '387896'
      description: |
        Should only be allowed 1 epoch ahead.
  requestBody:
    required: true
    content:
      application/json:
        schema:
          type: array
          description: An array of the validator indices for which to obtain the duties.
          items:
            type: string
          example:
            - '474200'
  responses:
    '200':
      description: Success response
      content:
        application/json:
          schema:
            type: object
            properties:
              dependent_root:
                type: string
                description: Dependent root for these duties.
                example: '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2'
              execution_optimistic:
                type: boolean
                description: Whether the execution payload is optimistic.
              data:
                type: array
                description: List of attester duties for the requested indices.
                items:
                  type: object
                  properties:
                    pubkey:
                      type: string
                      description: Validator public key.
                      example: '0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a'
                    validator_index:
                      type: string
                      description: Validator index.
                      example: '1'
                    committee_index:
                      type: string
                      description: Committee index for the validator at the duty slot.
                      example: '1'
                    committee_length:
                      type: string
                      description: Number of validators in the committee.
                      example: '1'
                    committees_at_slot:
                      type: string
                      description: Total number of committees at the duty slot.
                      example: '1'
                    validator_committee_index:
                      type: string
                      description: Position of the validator within the committee.
                      example: '1'
                    slot:
                      type: string
                      description: Slot at which the validator should attest.
                      example: '1'
          examples:
            response:
              summary: Example response
              value:
                dependent_root: '0x017c4443db02f7e4ece54ada0ba2e1516596e39150261c59338b9b6f22d8fbeb'
                execution_optimistic: false
                data:
                  - pubkey: '0x842b273237caa03ff23a25e2664e5c9c6fb17342c0ec2f12b018cf0958cbe0e42f07500150bc5a9f8b44cfcf477e4a78'
                    validator_index: '474200'
                    committees_at_slot: '64'
                    committee_index: '44'
                    committee_length: '528'
                    validator_committee_index: '308'
                    slot: '12412675'
```
