# platform.sampleValidators

Sample validators from the specified Subnet.

This method will use `60` [Compute Units](https://docs.validationcloud.io/v1/about/billing).

***

## Reference: [Here](https://docs.avax.network/reference/avalanchego/p-chain/api#platformsamplevalidators)

## **Parameters**

* `height` - int - the numerical value representing the P-Chain height to get the validator set at.
* `subnetID` - string - (optional) the subnet ID to get the validator set of. If not given, gets validator set of the Primary Network.

## Returns

* `validators` - object - the validators and their weights of a subnet or the Primary Network.

```json
// Result
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "validators": [
      "NodeID-MFrZFVCXPv5iCn6M9K6XduxGTYp891xXZ",
      "NodeID-NFBbbJ4qCmNaCzeW7sxErhvWqvEQMnYcN"
    ]
  }
}
```

{% tabs %}
{% tab title="mainnet" %}

```bash
curl https://mainnet.avalanche.validationcloud.io/v1/<YOUR_API_KEY_HERE>/ext/bc/P \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{
    "jsonrpc":"2.0",
    "id"     :1,
    "method" :"platform.sampleValidators",
    "params" :{
        "size":2
    }
}'

```

{% endtab %}

{% tab title="testnet" %}

```bash
curl https://fuji.avalanche.validationcloud.io/v1/<YOUR_API_KEY_HERE>/ext/bc/P \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{
    "jsonrpc":"2.0",
    "id"     :1,
    "method" :"platform.sampleValidators",
    "params" :{
        "size":2
    }
}'
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.validationcloud.io/v1/avalanche/p-chain/platform.samplevalidators.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
