# suix_queryTransactionBlocks

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

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

Returns a paginated list of transaction blocks that match the given query criteria.  You can filter by input object, sender, transaction kind, and more. Supports pagination and ordering.


Reference: https://www.alchemy.com/docs/chains/sui/sui-api-endpoints/suix-query-transaction-blocks

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| query | object | Yes | Transaction query filter and field options. |
| cursor | string | No | Optional paging cursor, a transaction digest string. |
| limit | integer | No | Maximum number of results to return. |
| descending_order | boolean | No | Whether to return results in descending order. |

## Result

**result** (object): A page of matched transaction blocks.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "suix_queryTransactionBlocks",
  "params": [
    {
      "filter": {
        "InputObject": "0x8da140bad1be69f7e64abf9f494b094dd3a77242577cab0ad658c9436bed225e"
      },
      "options": null
    },
    "44G1v9zusjuKqKjeAqZz2GBvBWd1MGiNPQGB4pZeagNb",
    100,
    false
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "data": [
      {
        "digest": "GUPcK4cmRmgsTFr52ab9f6fnzNVg3Lz6hF2aXFcsRzaD"
      },
      {
        "digest": "B2iV1SVbBjgTKfbJKPQrvTT6F3kNdekFuBwY9tQcAxV2"
      },
      {
        "digest": "8QrPa4x9iNG5r2zQfmeH8pJoVjjtq9AGzp8rp2fxi8Sk"
      },
      {
        "digest": "3nek86HEjXZ7K3EtrAcBG4wMrCS21gqr8BqwwC6M6P7F"
      }
    ],
    "nextCursor": "3nek86HEjXZ7K3EtrAcBG4wMrCS21gqr8BqwwC6M6P7F",
    "hasNextPage": false
  },
  "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": "suix_queryTransactionBlocks",
  "params": [
    {
      "filter": {
        "property1": "string"
      },
      "options": {
        "property1": "string"
      }
    },
    "44G1v9zusjuKqKjeAqZz2GBvBWd1MGiNPQGB4pZeagNb",
    100,
    false
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'suix_queryTransactionBlocks',
    params: [
      {filter: {property1: 'string'}, options: {property1: 'string'}},
      '44G1v9zusjuKqKjeAqZz2GBvBWd1MGiNPQGB4pZeagNb',
      100,
      false
    ]
  })
};

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": "suix_queryTransactionBlocks",
    "params": [
        {
            "filter": { "property1": "string" },
            "options": { "property1": "string" }
        },
        "44G1v9zusjuKqKjeAqZz2GBvBWd1MGiNPQGB4pZeagNb",
        100,
        False
    ]
}
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\": \"suix_queryTransactionBlocks\",\n  \"params\": [\n    {\n      \"filter\": {\n        \"property1\": \"string\"\n      },\n      \"options\": {\n        \"property1\": \"string\"\n      }\n    },\n    \"44G1v9zusjuKqKjeAqZz2GBvBWd1MGiNPQGB4pZeagNb\",\n    100,\n    false\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\": \"suix_queryTransactionBlocks\",\n  \"params\": [\n    {\n      \"filter\": {\n        \"property1\": \"string\"\n      },\n      \"options\": {\n        \"property1\": \"string\"\n      }\n    },\n    \"44G1v9zusjuKqKjeAqZz2GBvBWd1MGiNPQGB4pZeagNb\",\n    100,\n    false\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\": \"suix_queryTransactionBlocks\",\n  \"params\": [\n    {\n      \"filter\": {\n        \"property1\": \"string\"\n      },\n      \"options\": {\n        \"property1\": \"string\"\n      }\n    },\n    \"44G1v9zusjuKqKjeAqZz2GBvBWd1MGiNPQGB4pZeagNb\",\n    100,\n    false\n  ]\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: suix_queryTransactionBlocks
summary: Query transactions using filter criteria
description: |
  Returns a paginated list of transaction blocks that match the given query criteria.  You can filter by input object, sender, transaction kind, and more. Supports pagination and ordering.
params:
  - name: query
    required: true
    description: Transaction query filter and field options.
    schema:
      type: object
      properties:
        filter:
          type: object
        options:
          type: object
          nullable: true
  - name: cursor
    required: false
    description: Optional paging cursor, a transaction digest string.
    schema:
      type: string
  - name: limit
    required: false
    description: Maximum number of results to return.
    schema:
      type: integer
  - name: descending_order
    required: false
    description: Whether to return results in descending order.
    schema:
      type: boolean
result:
  name: result
  description: A page of matched transaction blocks.
  schema:
    type: object
    required:
      - data
      - nextCursor
      - hasNextPage
    properties:
      data:
        type: array
        description: A list of results.
        items:
          type: object
      nextCursor:
        description: Cursor for fetching the next page.
        type: string
        nullable: true
      hasNextPage:
        type: boolean
examples:
  - name: Query transactions using InputObject filter
    params:
      - name: query
        value:
          filter:
            InputObject: '0x8da140bad1be69f7e64abf9f494b094dd3a77242577cab0ad658c9436bed225e'
          options: null
      - name: cursor
        value: 44G1v9zusjuKqKjeAqZz2GBvBWd1MGiNPQGB4pZeagNb
      - name: limit
        value: 100
      - name: descending_order
        value: false
    result:
      name: result
      value:
        data:
          - digest: GUPcK4cmRmgsTFr52ab9f6fnzNVg3Lz6hF2aXFcsRzaD
          - digest: B2iV1SVbBjgTKfbJKPQrvTT6F3kNdekFuBwY9tQcAxV2
          - digest: 8QrPa4x9iNG5r2zQfmeH8pJoVjjtq9AGzp8rp2fxi8Sk
          - digest: 3nek86HEjXZ7K3EtrAcBG4wMrCS21gqr8BqwwC6M6P7F
        nextCursor: 3nek86HEjXZ7K3EtrAcBG4wMrCS21gqr8BqwwC6M6P7F
        hasNextPage: false
```
