# getLeaderSchedule

Returns the leader schedule for an epoch.

#### Parameters required for this RPC call

* Fetch the leader schedule for the epoch that corresponds to the provided slot. If unspecified, the leader schedule for the current epoch is fetched. This is an optional parameter.
* **configuration** : This contains the following parameters, all are optional fields.
  * **commitment**: The commitment describes how finalized a block is at that point in time. <mark style="color:yellow;">processed</mark>, <mark style="color:yellow;">confirmed</mark> and <mark style="color:yellow;">finalized</mark> are supported.
  * **identity**: Only return results for this validator identity (base-58 encoded)

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

<pre class="language-bash"><code class="lang-bash">curl https://rpc.shyft.to?api_key=YOUR-API-KEY -s -X \
<strong>  POST -H "Content-Type: application/json" -d ' 
</strong>   {
     "jsonrpc": "2.0",
     "id": 1,
     "method": "getLeaderSchedule",
     "params": [
       null,
       {
         "commitment": "processed",
         "identity": "dv2eQHeP4RFrJZ6UeiZWoc3XTtmtZCUKxxCApCDcRNV"
       }
     ]
   }
 '
</code></pre>

{% endtab %}

{% tab title="Web3.js" %}

```javascript
import { Connection, PublicKey, clusterApiUrl } from "@solana/web3.js";

const connection = new Connection("https://rpc.shyft.to?api_key=YOUR-API-KEY", "confirmed");

let leaderSchedule = await connection.getLeaderSchedule();

console.log(leaderSchedule);
```

{% endtab %}

{% tab title="Response" %}

```json
{
  "jsonrpc": "2.0",
  "result": {
    "4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F": [
      0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
      21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
      39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
      57, 58, 59, 60, 61, 62, 63
    ]
  },
  "id": 1
}
```

{% endtab %}
{% endtabs %}

Returns `null` if requested epoch is not found, otherwise returns an object where:

* Keys are validator identities (as base-58 encoded strings)
* Values are arrays of leader slot indices relative to the first slot in the requested epoch


---

# 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.shyft.to/solana/rpc-calls/http/getleaderschedule.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.
