> For the complete documentation index, see [llms.txt](https://docs.validationcloud.io/v1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.validationcloud.io/v1/stellar/stellar-rpc-formerly-soroban-api/getevents.md).

# getEvents

Clients can request a filtered list of events emitted by a given ledger range.

This method will use `10` [Compute Units](/v1/about/billing.md).

***

## Reference: [Here](https://soroban.stellar.org/api/methods/getEvents)

## **Parameters**

* `startLedger` *(required)*
  * Stringified ledger sequence number to fetch events after (inclusive). This method will return an error if `startLedger` is less than the oldest ledger stored in this node, or greater than the latest ledger seen by this node. If a cursor is included in the request, `startLedger` must be omitted.
* `filters`
  * array of: type (string) A comma separated list of event types (`system`, `contract`, or `diagnostic`) used to filter events. If omitted, all event types are included.
  * contractIds (array) (optional) List of contract ids to query for events. If omitted, return events for all contracts. Maximum 5 contract IDs are allowed per request.
  * topics (array) (optional) List of topic filters. If omitted, query for all events. If multiple filters are specified, events will be included if they match any of the filters. Maximum 5 filters are allowed per request.
* `pagination` (see "[Pagination](https://soroban.stellar.org/api/pagination)")

## Returns

`latestLedger` (string): Stringified-number of the current latest ledger observed by the node when this response was generated.

```bash
// Result
{
  "jsonrpc": "2.0",
  "id": 8675309,
  "result": {
    "latestLedger": "230473",
    "events": [
      {
        "type": "contract",
        "ledger": "230010",
        "ledgerClosedAt": "2023-01-23T18:54:41Z",
        "contractId": "CB64D3G7SM2RTH6JSGG34DDTFTQ5CFDKVDZJZSODMCX4NJ2HV2KN7OHT",
        "id": "0000987885427757056-0000000001",
        "pagingToken": "0000987885427757056-0000000001",
        "inSuccessfulContractCall": true,
        "topic": [
          "AAAABQAAAAh0cmFuc2Zlcg==",
          "AAAABAAAAAEAAAAAAAAAAgAAAAUAAAAHQWNjb3VudAAAAAAEAAAAAQAAAAgAAAAAHavpBsZgRv4pEDXWB0NnwQBvvAL/8adWXz2fV7eNq2o=",
          "AAAABAAAAAEAAAAAAAAAAgAAAAUAAAAHQWNjb3VudAAAAAAEAAAAAQAAAAgAAAAAHavpBsZgRv4pEDXWB0NnwQBvvAL/8adWXz2fV7eNq2o="
        ],
        "value": {
          "xdr": "AAAABAAAAAEAAAAFAAAAAAABhqAAAAAAAAAAAA=="
        }
      },
      {
        "type": "contract",
        "ledger": "230170",
        "ledgerClosedAt": "2023-01-23T19:08:37Z",
        "contractId": "CB64D3G7SM2RTH6JSGG34DDTFTQ5CFDKVDZJZSODMCX4NJ2HV2KN7OHT",
        "id": "0000988572622524416-0000000001",
        "pagingToken": "0000988572622524416-0000000001",
        "inSuccessfulContractCall": true,
        "topic": [
          "AAAABQAAAAh0cmFuc2Zlcg==",
          "AAAABAAAAAEAAAAAAAAAAgAAAAUAAAAHQWNjb3VudAAAAAAEAAAAAQAAAAgAAAAAHavpBsZgRv4pEDXWB0NnwQBvvAL/8adWXz2fV7eNq2o=",
          "AAAABAAAAAEAAAAAAAAAAgAAAAUAAAAHQWNjb3VudAAAAAAEAAAAAQAAAAgAAAAAHavpBsZgRv4pEDXWB0NnwQBvvAL/8adWXz2fV7eNq2o="
        ],
        "value": {
          "xdr": "AAAABAAAAAEAAAAFAAAAAAAHoSAAAAAAAAAAAA=="
        }
      }
    ]
  }
}
```

{% tabs %}
{% tab title="mainnet" %}

<pre class="language-bash"><code class="lang-bash"><strong>curl https://mainnet.stellar.validationcloud.io/v1/&#x3C;YOUR_API_KEY_HERE> \
</strong>    -X POST \
    -H "Content-Type: application/json" \
    -d '{
  "jsonrpc": "2.0",
  "id": 8675309,
  "method": "getEvents",
  "params": {
    "startLedger": "227000",
    "filters": [
      {
        "type": "contract",
        "contractIds": [
          "CB64D3G7SM2RTH6JSGG34DDTFTQ5CFDKVDZJZSODMCX4NJ2HV2KN7OHT"
        ],
        "topics": [
          [
            "AAAABQAAAAh0cmFuc2Zlcg==",
            "*",
            "*"
          ]
        ]
      }
    ],
    "pagination": {
      "limit": 100
    }
  }
}'
</code></pre>

{% endtab %}

{% tab title="testnet" %}

```bash
curl https://testnet.stellar.validationcloud.io/v1/<YOUR_API_KEY_HERE> \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{
  "jsonrpc": "2.0",
  "id": 8675309,
  "method": "getEvents",
  "params": {
    "startLedger": "227000",
    "filters": [
      {
        "type": "contract",
        "contractIds": [
          "CB64D3G7SM2RTH6JSGG34DDTFTQ5CFDKVDZJZSODMCX4NJ2HV2KN7OHT"
        ],
        "topics": [
          [
            "AAAABQAAAAh0cmFuc2Zlcg==",
            "*",
            "*"
          ]
        ]
      }
    ],
    "pagination": {
      "limit": 100
    }
  }
}'

```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.validationcloud.io/v1/stellar/stellar-rpc-formerly-soroban-api/getevents.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
