# getLeaderSchedule

> Returns the full slot-leader assignment for an epoch, grouped by validator identity.

Source: https://docs.constant-k.com/rpc/http/getleaderschedule/

`getLeaderSchedule` returns the leader schedule for the epoch containing a given slot: every validator identity mapped to the slots it leads. Returned slot numbers are epoch-relative indexes, not absolute; add the epoch's first slot to convert.

A single fetch per epoch supports looking up leaders locally, instead of calling `getSlotLeader` or `getSlotLeaders` per slot.

- Transport: HTTP, JSON-RPC 2.0 `POST` to `https://rpc-newyork.constant-k.com/?api-key=YOUR_API_KEY` (New York) or `https://rpc-frankfurt.constant-k.com/?api-key=YOUR_API_KEY` (Frankfurt) or `https://rpc-amsterdam.constant-k.com/?api-key=YOUR_API_KEY` (Amsterdam). The key also works as an `x-api-key` header.
- Category: Slots & Epochs
- Availability: All plans
- Rate limits: Free 5/s · Operator 50/s · Blade Runner 200/s · Nexus 500/s

## Parameters

`params` is a positional JSON array, in this order:

- `slot` (integer | null, optional): Any slot within the target epoch. Omit (pass null) to use the current epoch.
- `config` (object, optional): Optional configuration.
  - `commitment` (string, optional, one of `finalized`, `confirmed`, `processed`, default `"finalized"`): Bank state to compute the schedule from.
  - `identity` (string, optional): Restrict the result to a single validator identity, base-58 encoded. The response then contains at most one key.

## Result

- `result` (object | null, optional): Map of validator identity to the epoch-relative slot indexes it leads, or null if the epoch's schedule can't be determined (for example, a future epoch too far ahead to have been computed yet).
  - `option 1` (object, optional): A dynamic map keyed by validator identity (base-58, not enumerable ahead of time), where each value is an array of integers: the epoch-relative slot indexes (0-based from the epoch's first slot) that identity leads.
  - `option 2` (null, optional)

## Example: Get one validator's leader slots for the current epoch

Request:

```bash
curl "https://rpc-newyork.constant-k.com/?api-key=YOUR_API_KEY" \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getLeaderSchedule",
    "params": [
      null,
      { "identity": "21Z4wTDGvWQE1aTyapzAzKp8wGj2Hrt8PSvusMyEB5PV" }
    ]
  }'
```

Response:

```json
{
  "jsonrpc": "2.0",
  "result": {
    "21Z4wTDGvWQE1aTyapzAzKp8wGj2Hrt8PSvusMyEB5PV": [
      148,
      149,
      150,
      151,
      2836,
      2837,
      2838,
      2839,
      5920,
      5921,
      5922,
      5923
    ]
  },
  "id": 1
}
```

_Long arrays in this example were trimmed._

## Notes

- Slot numbers are indexes within the epoch (0 at its first slot); adding `getEpochInfo`'s `absoluteSlot - slotIndex` converts one to an absolute slot.
- A validator typically leads dozens to hundreds of 4-slot runs per 432,000-slot epoch, depending on stake weight; the example above is trimmed to 3 runs.
- `identity` scopes the result to one validator; without it, the response enumerates every leader for the whole epoch.

