> ## Documentation Index
> Fetch the complete documentation index at: https://docs.validationcloud.io/llms.txt
> Use this file to discover all available pages before exploring further.

# ledger_index

Looks up the last closed ledger at a given real-world time. Useful for correlating events that happened off-chain with historical data in the XRP Ledger.

This method will use `20` [Compute Units](/nodeapi/about/billing).

***

## Reference: [Here](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/clio-methods/ledger_index)

## **Parameters**

* `date` (string, optional) An ISO 8601 timestamp of the time to look up, without microseconds and using `Z` as the time zone marker, for example `2025-01-01T00:00:00Z`. If omitted, use the current time.

## Returns

* `ledger_index` (number) The ledger index of the most recently closed ledger at the specified time.
* `ledger_hash` (string) The identifying hash of that ledger.
* `closed` (string) The official close time of that ledger.
* `validated` (boolean) If `true`, the ledger has been validated by the consensus process and is immutable.

```json theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
// Result
{
  "result": {
    "ledger_index": 93153309,
    "ledger_hash": "7BAACC9E41B907204EC0A9296ED2F6F4B78FCC6C9D81BE3CCBB0EBC5951E97DF",
    "closed": "2025-01-01T00:00:00Z",
    "validated": true,
    "status": "success"
  }
}
```

<CodeGroup>
  ```bash title="mainnet" theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
  curl https://mainnet.xrpl.validationcloud.io/v1/<YOUR_API_KEY_HERE> \
      -X POST \
      -H "Content-Type: application/json" \
      -d '{"method":"ledger_index","params":[{"date":"2025-01-01T00:00:00Z"}]}'
  ```
</CodeGroup>

Over WebSocket, send `{"id":1,"command":"ledger_index","date":"2025-01-01T00:00:00Z"}` to `wss://mainnet.xrpl.validationcloud.io/v1/<YOUR_API_KEY_HERE>`.

> This method is served by Clio, our full-history XRPL server, and is not available from rippled.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.