# /v1/beacon/states/{state_id}/validators/{validator_id}

> 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}/validators/{validator_id}

Returns validator specified by state and ID or public key,   along with its status and balance.   The validator can be referenced by its index (numeric) or hex-encoded public key (`bytes48` with 0x prefix).


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

## 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>`.  |
| validator_id | string | Yes | Validator identifier.   Either validator index (integer) or hex-encoded public key (bytes48 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/validators/474200
```

### JavaScript

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

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

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/validators/474200"

	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/validators/474200")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://eth-mainnetbeacon.g.alchemy.com/v2/docs-demo/eth/v1/beacon/states/head/validators/474200");
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}/validators/{validator_id}
method: GET
operation:
  summary: /v1/beacon/states/{state_id}/validators/{validator_id}
  description: |
    Returns validator specified by state and ID or public key,   along with its status and balance.   The validator can be referenced by its index (numeric) or hex-encoded public key (`bytes48` with 0x prefix).
  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>`.
    - name: validator_id
      in: path
      required: true
      schema:
        type: string
        example: '474200'
      description: |
        Validator identifier.   Either validator index (integer) or hex-encoded public key (bytes48 with `0x` prefix).
  responses:
    '200':
      description: Validator details for the given state and identifier.
      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
                description: Validator details.
                properties:
                  index:
                    type: string
                    description: Validator index.
                    example: '474200'
                  balance:
                    type: string
                    description: Current validator balance in Gwei.
                    example: '2048384789135'
                  status:
                    type: string
                    description: Current validator status.
                    example: active_ongoing
                  validator:
                    type: object
                    description: Validator information.
                    properties:
                      pubkey:
                        type: string
                        description: Validator public key.
                        example: '0x842b273237caa03ff23a25e2664e5c9c6fb17342c0ec2f12b018cf0958cbe0e42f07500150bc5a9f8b44cfcf477e4a78'
                      withdrawal_credentials:
                        type: string
                        description: Withdrawal credentials.
                        example: '0x02000000000000000000000039fd78fe6a72faae2ab5f1f053c253b2e3685c15'
                      effective_balance:
                        type: string
                        description: Effective balance of the validator.
                        example: '2048000000000'
                      slashed:
                        type: boolean
                        description: Whether the validator has been slashed.
                        example: false
                      activation_eligibility_epoch:
                        type: string
                        description: Epoch when validator became eligible for activation.
                        example: '162210'
                      activation_epoch:
                        type: string
                        description: Epoch when validator was activated.
                        example: '162260'
                      exit_epoch:
                        type: string
                        description: Epoch when validator exited, or max uint64 if not scheduled.
                        example: '18446744073709551615'
                      withdrawable_epoch:
                        type: string
                        description: Epoch when validator can withdraw funds, or max uint64 if not scheduled.
                        example: '18446744073709551615'
          examples:
            response:
              summary: Example response
              value:
                execution_optimistic: false
                finalized: false
                data:
                  index: '474200'
                  balance: '2048384789135'
                  status: active_ongoing
                  validator:
                    pubkey: '0x842b273237caa03ff23a25e2664e5c9c6fb17342c0ec2f12b018cf0958cbe0e42f07500150bc5a9f8b44cfcf477e4a78'
                    withdrawal_credentials: '0x02000000000000000000000039fd78fe6a72faae2ab5f1f053c253b2e3685c15'
                    effective_balance: '2048000000000'
                    slashed: false
                    activation_eligibility_epoch: '162210'
                    activation_epoch: '162260'
                    exit_epoch: '18446744073709551615'
                    withdrawable_epoch: '18446744073709551615'
```
