# /v2/validator/aggregate_attestation

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

GET https://eth-mainnetbeacon.g.alchemy.com/v2/docs-demo/eth/v2/validator/aggregate_attestation

Aggregates all attestations matching the given attestation data root, slot and committee index. Returns a single aggregated attestation. 503 is returned if the block identified by the response `beacon_block_root` is optimistic (i.e., the aggregated attestation attests to a block not fully verified by an execution engine). 404 is returned if no attestation is available for the requested `attestation_data_root`.


Reference: https://www.alchemy.com/docs/chains/ethereum/ethereum-beacon-api-endpoints/ethereum-beacon-api-endpoints/v-2-validator-aggregate-attestation

## Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| attestation_data_root | string | Yes | HashTreeRoot (hex) of the AttestationData to aggregate. |
| slot | string | Yes | Slot of the attestation. |
| committee_index | string | Yes | Committee index of the attestation. |

## Code Examples

### cURL

```bash
curl --request GET \
  --url 'https://eth-mainnetbeacon.g.alchemy.com/v2/docs-demo/eth/v2/validator/aggregate_attestation?attestation_data_root=0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2&slot=1&committee_index=1'
```

### JavaScript

```javascript
const options = {method: 'GET'};

fetch('https://eth-mainnetbeacon.g.alchemy.com/v2/docs-demo/eth/v2/validator/aggregate_attestation?attestation_data_root=0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2&slot=1&committee_index=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/v2/validator/aggregate_attestation?attestation_data_root=0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2&slot=1&committee_index=1"

response = requests.get(url)

print(response.text)
```

### Go

```go
package main

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

func main() {

	url := "https://eth-mainnetbeacon.g.alchemy.com/v2/docs-demo/eth/v2/validator/aggregate_attestation?attestation_data_root=0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2&slot=1&committee_index=1"

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

	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://eth-mainnetbeacon.g.alchemy.com/v2/docs-demo/eth/v2/validator/aggregate_attestation?attestation_data_root=0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2&slot=1&committee_index=1")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://eth-mainnetbeacon.g.alchemy.com/v2/docs-demo/eth/v2/validator/aggregate_attestation?attestation_data_root=0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2&slot=1&committee_index=1");
var client = new RestClient(options);
var request = new RestRequest("");
var response = await client.GetAsync(request);

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

```


## Operation Specification

```yaml
path: /eth/v2/validator/aggregate_attestation
method: GET
operation:
  summary: /v2/validator/aggregate_attestation
  description: |
    Aggregates all attestations matching the given attestation data root, slot and committee index. Returns a single aggregated attestation. 503 is returned if the block identified by the response `beacon_block_root` is optimistic (i.e., the aggregated attestation attests to a block not fully verified by an execution engine). 404 is returned if no attestation is available for the requested `attestation_data_root`.
  tags:
    - Ethereum Beacon API Endpoints
  security:
    - apiKey: []
  parameters:
    - name: attestation_data_root
      in: query
      required: true
      description: HashTreeRoot (hex) of the AttestationData to aggregate.
      schema:
        type: string
        format: hex
        example: '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2'
    - name: slot
      in: query
      required: true
      description: Slot of the attestation.
      schema:
        type: string
        example: '1'
    - name: committee_index
      in: query
      required: true
      description: Committee index of the attestation.
      schema:
        type: string
        example: '1'
  responses:
    '200':
      description: Returns aggregated Attestation object with the same AttestationData root, slot and committee index.
      content:
        application/json:
          schema:
            type: object
            properties:
              version:
                type: string
                example: electra
              data:
                type: object
                properties:
                  aggregation_bits:
                    type: string
                    example: '0x01'
                  data:
                    type: object
                    properties:
                      slot:
                        type: string
                        example: '1'
                      index:
                        type: string
                        example: '1'
                      beacon_block_root:
                        type: string
                        example: '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2'
                      source:
                        type: object
                        properties:
                          epoch:
                            type: string
                            example: '1'
                          root:
                            type: string
                            example: '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2'
                      target:
                        type: object
                        properties:
                          epoch:
                            type: string
                            example: '1'
                          root:
                            type: string
                            example: '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2'
                  signature:
                    type: string
                    example: 0x1b66ac1f...171505
                  committee_bits:
                    type: string
                    example: '0x0000000000000001'
          examples:
            response:
              summary: Example response
              value:
                version: electra
                data:
                  aggregation_bits: '0x01'
                  data:
                    slot: '1'
                    index: '1'
                    beacon_block_root: '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2'
                    source:
                      epoch: '1'
                      root: '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2'
                    target:
                      epoch: '1'
                      root: '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2'
                  signature: '0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505'
                  committee_bits: '0x0000000000000001'
```
