# /v1/beacon/states/{state_id}/finality_checkpoints

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

GET https://eth-mainnetbeacon.g.alchemy.com/v2/docs-demo/eth/v1/beacon/states/{state_id}/finality_checkpoints

Returns finality checkpoints for the given state.   If finality is not yet achieved, the checkpoint will return epoch `0` and `ZERO_HASH` as root.


Reference: https://www.alchemy.com/docs/chains/ethereum/ethereum-beacon-api-endpoints/ethereum-beacon-api-endpoints/v-1-beacon-states-state-id-finality-checkpoints

## Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| state_id | string | Yes | State identifier.   Can be one of:   `head` (canonical head in node's view),   `genesis`,   `finalized`,   `justified`,   `<slot>`,   `<hex encoded stateRoot with 0x prefix>`.  |

## Code Examples

### cURL

```bash
curl --request GET \
  --url https://eth-mainnetbeacon.g.alchemy.com/v2/docs-demo/eth/v1/beacon/states/head/finality_checkpoints
```

### JavaScript

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

fetch('https://eth-mainnetbeacon.g.alchemy.com/v2/docs-demo/eth/v1/beacon/states/head/finality_checkpoints', 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/states/head/finality_checkpoints"

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/v1/beacon/states/head/finality_checkpoints"

	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/v1/beacon/states/head/finality_checkpoints")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://eth-mainnetbeacon.g.alchemy.com/v2/docs-demo/eth/v1/beacon/states/head/finality_checkpoints");
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/v1/beacon/states/{state_id}/finality_checkpoints
method: GET
operation:
  summary: /v1/beacon/states/{state_id}/finality_checkpoints
  description: |
    Returns finality checkpoints for the given state.   If finality is not yet achieved, the checkpoint will return epoch `0` and `ZERO_HASH` as root.
  tags:
    - Ethereum Beacon API Endpoints
  security:
    - apiKey: []
  parameters:
    - name: state_id
      in: path
      required: true
      schema:
        type: string
        example: head
      description: |
        State identifier.   Can be one of:   `head` (canonical head in node's view),   `genesis`,   `finalized`,   `justified`,   `<slot>`,   `<hex encoded stateRoot with 0x prefix>`.
  responses:
    '200':
      description: Finality checkpoints for the requested state.
      content:
        application/json:
          schema:
            type: object
            properties:
              execution_optimistic:
                type: boolean
                description: Whether the execution payload is optimistic.
              finalized:
                type: boolean
                description: Whether the state is finalized.
              data:
                type: object
                properties:
                  previous_justified:
                    type: object
                    properties:
                      epoch:
                        type: string
                        description: Previous justified epoch.
                        example: '384528'
                      root:
                        type: string
                        description: Root hash of the previous justified epoch.
                        example: '0x95656528b8dbed879305ffa67ed688f8e262b2dfa5f620e384056f49dec95267'
                  current_justified:
                    type: object
                    properties:
                      epoch:
                        type: string
                        description: Current justified epoch.
                        example: '384529'
                      root:
                        type: string
                        description: Root hash of the current justified epoch.
                        example: '0x352dd41c368cea0c91374483378ce9f65f7a7180ca6fa5e08ae17ca509d19c0c'
                  finalized:
                    type: object
                    properties:
                      epoch:
                        type: string
                        description: Finalized epoch.
                        example: '384528'
                      root:
                        type: string
                        description: Root hash of the finalized epoch.
                        example: '0x95656528b8dbed879305ffa67ed688f8e262b2dfa5f620e384056f49dec95267'
          examples:
            response:
              summary: Example response
              value:
                execution_optimistic: false
                finalized: false
                data:
                  previous_justified:
                    epoch: '384528'
                    root: '0x95656528b8dbed879305ffa67ed688f8e262b2dfa5f620e384056f49dec95267'
                  current_justified:
                    epoch: '384529'
                    root: '0x352dd41c368cea0c91374483378ce9f65f7a7180ca6fa5e08ae17ca509d19c0c'
                  finalized:
                    epoch: '384528'
                    root: '0x95656528b8dbed879305ffa67ed688f8e262b2dfa5f620e384056f49dec95267'
```
