---
title: ledger_seq
description: Fetch the current ledger sequence number
---
import { Tabs, TabItem } from '@astrojs/starlight/components';

### Behaviour

* Return the sequence number from the current ledger

### Definition

C

<Tabs>
<TabItem label="C">
```c
int64_t ledger_seq();
```
</TabItem>

<TabItem label="JavaScript">
```javascript
function ledger_seq(): ErrorCode | number
```
</TabItem>
</Tabs>



### Example

<Tabs>
<TabItem label="C">
```c
int64_t seq =
    ledger_seq();
```


</TabItem>

<TabItem label="JavaScript">
```javascript
const seq = ledger_seq()
```
</TabItem>
</Tabs>



### Parameters

This API takes no parameters.

### Return Code

<Tabs>
<TabItem label="C">
| Type     | Description                               |
| -------- | ----------------------------------------- |
| int64_t | The sequence number of the current ledger |


</TabItem>

<TabItem label="JavaScript">
| Type   | Description                               |
| ------ | ----------------------------------------- |
| number | The sequence number of the current ledger |
</TabItem>
</Tabs>

