# sui_getCheckpoints

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

POST https://sui-mainnet.g.alchemy.com/v2/{apiKey}

Retrieves a paginated list of checkpoints. Results can be ordered ascending or descending by sequence number.


Reference: https://www.alchemy.com/docs/chains/sui/sui-api-endpoints/sui-get-checkpoints

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| cursor | string | No | Optional paging cursor. If provided, results start from the item after the given cursor. |
| limit | integer | No | Maximum number of items to return. |
| descending_order | boolean | No | If true, results are returned in descending order. Defaults to false. |

## Result

**result** (object): Paginated list of checkpoints.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "sui_getCheckpoints",
  "params": [
    "10",
    1,
    true
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "data": [
      {
        "epoch": "0",
        "sequenceNumber": "9",
        "digest": "4XvAN2hfEtTgFfTLA5jaWn96rZ84hAyLtnzRKdsRDXHC",
        "networkTotalTransactions": "10",
        "previousDigest": "CxsCPaoZ2BGNACeFFdeDmfiRXxtyA484gBkL4N5JxXDW",
        "epochRollingGasCostSummary": {
          "computationCost": "0",
          "storageCost": "0",
          "storageRebate": "0",
          "nonRefundableStorageFee": "0"
        },
        "timestampMs": "1681392134159",
        "transactions": [
          "D2XXLRxxvYLsTTmN8ZZZhYikjKaRRPyWWC8AJEsvwvyE"
        ],
        "checkpointCommitments": [],
        "validatorSignature": "pH/sPzHYdSXJrDz2U5XY86edyshhbZ1hFQ3SMWpXSSxdiC+/9xtuVHqTu6C+h67n"
      }
    ],
    "nextCursor": "9",
    "hasNextPage": true
  },
  "id": 1
}
```

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://sui-mainnet.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "sui_getCheckpoints",
  "params": [
    "10",
    1,
    true
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({jsonrpc: '2.0', id: 1, method: 'sui_getCheckpoints', params: ['10', 1, true]})
};

fetch('https://sui-mainnet.g.alchemy.com/v2/docs-demo', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://sui-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "sui_getCheckpoints",
    "params": ["10", 1, True]
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://sui-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"sui_getCheckpoints\",\n  \"params\": [\n    \"10\",\n    1,\n    true\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://sui-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"sui_getCheckpoints\",\n  \"params\": [\n    \"10\",\n    1,\n    true\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://sui-mainnet.g.alchemy.com/v2/docs-demo");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"sui_getCheckpoints\",\n  \"params\": [\n    \"10\",\n    1,\n    true\n  ]\n}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

```


## OpenRPC Method Specification

```yaml
name: sui_getCheckpoints
summary: Return paginated list of checkpoints
description: |
  Retrieves a paginated list of checkpoints. Results can be ordered ascending or descending by sequence number.
params:
  - name: cursor
    required: false
    description: Optional paging cursor. If provided, results start from the item after the given cursor.
    schema:
      type: string
  - name: limit
    required: false
    description: Maximum number of items to return.
    schema:
      type: integer
  - name: descending_order
    required: false
    description: If true, results are returned in descending order. Defaults to false.
    schema:
      type: boolean
result:
  name: result
  description: Paginated list of checkpoints.
  schema:
    type: object
    required:
      - data
      - nextCursor
      - hasNextPage
    properties:
      data:
        type: array
        description: List of checkpoint objects.
        items:
          type: object
          required:
            - epoch
            - sequenceNumber
            - digest
            - networkTotalTransactions
            - previousDigest
            - epochRollingGasCostSummary
            - timestampMs
            - transactions
            - checkpointCommitments
            - validatorSignature
          properties:
            epoch:
              type: string
            sequenceNumber:
              type: string
            digest:
              type: string
            networkTotalTransactions:
              type: string
            previousDigest:
              type: string
            epochRollingGasCostSummary:
              type: object
              properties:
                computationCost:
                  type: string
                storageCost:
                  type: string
                storageRebate:
                  type: string
                nonRefundableStorageFee:
                  type: string
            timestampMs:
              type: string
            transactions:
              type: array
              items:
                type: string
            checkpointCommitments:
              type: array
              items:
                type: string
            validatorSignature:
              type: string
      nextCursor:
        type: string
      hasNextPage:
        type: boolean
examples:
  - name: Get 1 checkpoint in descending order starting from cursor 10
    params:
      - name: cursor
        value: '10'
      - name: limit
        value: 1
      - name: descending_order
        value: true
    result:
      name: result
      value:
        data:
          - epoch: '0'
            sequenceNumber: '9'
            digest: 4XvAN2hfEtTgFfTLA5jaWn96rZ84hAyLtnzRKdsRDXHC
            networkTotalTransactions: '10'
            previousDigest: CxsCPaoZ2BGNACeFFdeDmfiRXxtyA484gBkL4N5JxXDW
            epochRollingGasCostSummary:
              computationCost: '0'
              storageCost: '0'
              storageRebate: '0'
              nonRefundableStorageFee: '0'
            timestampMs: '1681392134159'
            transactions:
              - D2XXLRxxvYLsTTmN8ZZZhYikjKaRRPyWWC8AJEsvwvyE
            checkpointCommitments: []
            validatorSignature: pH/sPzHYdSXJrDz2U5XY86edyshhbZ1hFQ3SMWpXSSxdiC+/9xtuVHqTu6C+h67n
        nextCursor: '9'
        hasNextPage: true
```
