For AI agents: a documentation index is available at /llms.txt. A markdown version of this page is available at the same URL with .md appended (or via Accept: text/markdown).
Skip to main content

getEvents

Returns events emitted in a ledger range. This method uses 160 credits from your daily balance.

The node keeps a bounded history of events. Use getHealth to read the ledgers currently available. Events are returned in ascending id order. When you page, deduplicate events by id.

Parameters​

  • startLedger: (integer) [optional] - Ledger sequence to start from, inclusive. The node returns an error if this is outside the ledgers it has stored. Omit this field when pagination.cursor is set.
  • endLedger: (integer) [optional] - Ledger sequence at which to stop, exclusive. Omit this field when pagination.cursor is set.
  • filters: (array) [optional] - Filters for the returned events. An event is included when it matches any filter. To match a filter, the event must match both a contract ID and a topic. An omitted contractIds or topics field matches every value. The maximum is 5 filters. Each filter contains:
    • type: (string) [optional] - contract or system. If omitted, both types are included.
    • contractIds: (array) [optional] - Contract IDs to include (C... addresses). If omitted, events from all contracts are included. The maximum is 5 IDs.
    • topics: (array) [optional] - Topic filters. Each filter is an array of segment matchers. A segment is a base64-encoded ScVal, * to match exactly one segment, or ** to match zero or more segments. ** can only be the last segment, and it does not count toward the limit of 4 segments. If omitted, all topics match. The maximum is 5 topic filters.
  • pagination: (object) [optional] - Paging options:
    • cursor: (string) [optional] - Paging token. Set this to the cursor from the previous response to fetch the next page.
    • limit: (integer) [optional] - Maximum number of events to return. The range is 1 to 10000. The default is 100.
  • xdrFormat: (string) [optional] - Format for XDR fields in the response. base64 is the default. json returns unpacked JSON. Do not rely on a stable schema for the JSON form, because it changes when the underlying XDR changes.

Returns​

result: (object) - Matching events and the ledger range stored by the node.

  • latestLedger: (integer) - Sequence number of the latest ledger known to the node when it handled the request.
  • oldestLedger: (integer) - Sequence number of the oldest ledger kept in history.
  • latestLedgerCloseTime: (string) - Unix timestamp, as a string, of when the latest ledger closed.
  • oldestLedgerCloseTime: (string) - Unix timestamp, as a string, of when the oldest retained ledger closed.
  • cursor: (string) - Paging token for the next page.
  • events: (array) - Matching events. Each event contains:
    • type: (string) - contract or system.
    • ledger: (integer) - Sequence number of the ledger that emitted the event.
    • ledgerClosedAt: (string) - ISO 8601 timestamp of when that ledger closed.
    • contractId: (string) - Contract that emitted the event (C... address).
    • id: (string) - Unique event ID. Use it to order events and to drop duplicates when paging.
    • transactionIndex: (integer) - Index used to order the event among transactions in the ledger.
    • operationIndex: (integer) - Index used to order the event among operations.
    • inSuccessfulContractCall: (boolean) - true when the event was emitted during a successful contract call. This field is deprecated.
    • topic: (array) - Event topics, as base64-encoded ScVal values. There are 1 to 4 topics.
    • value: (string) - Event data, as a base64-encoded ScVal.
    • txHash: (string) - Hex-encoded hash of the transaction that emitted the event.

Request​

curl https://stellar-mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "getEvents", "params": {"startLedger": 64923183, "endLedger": 64923184, "filters": [{"type": "contract", "contractIds": ["CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA"], "topics": [["AAAADwAAAANmZWUA", "*", "**"]]}], "pagination": {"limit": 2}}}'

Response​

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"events": [
{
"type": "contract",
"ledger": 64923183,
"ledgerClosedAt": "2026-10-13T14:28:17Z",
"contractId": "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA",
"id": "0278842947737223168-0000000000",
"operationIndex": 0,
"transactionIndex": 0,
"txHash": "a90606c6676698aae7a1b5b4cb31bb5878f6ce16a953ed42c609f2e9aa566052",
"inSuccessfulContractCall": true,
"topic": [
"AAAADwAAAANmZWUA",
"AAAAEgAAAAAAAAAAdXTZPts/p6OWtwqrt7gXvO8y5ejC1yhlMgutz1dQhC8="
],
"value": "AAAACgAAAAAAAAAAAAAAAAAAAGQ="
},
{
"type": "contract",
"ledger": 64923183,
"ledgerClosedAt": "2026-10-13T14:28:17Z",
"contractId": "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA",
"id": "0278842947737223168-0000000001",
"operationIndex": 0,
"transactionIndex": 0,
"txHash": "ae69d1767c5db3d753b7b0359ccb329def822258609f897df262806d66ce5a9d",
"inSuccessfulContractCall": true,
"topic": [
"AAAADwAAAANmZWUA",
"AAAAEgAAAAAAAAAAy+nyZgMUFMlbexc96DJK9lDjChy21Vh0wogYcKDGuYc="
],
"value": "AAAACgAAAAAAAAAAAAAAAAAAAlg="
}
],
"cursor": "0278842947737223168-0000000001",
"latestLedger": 64923230,
"oldestLedger": 63886431,
"latestLedgerCloseTime": "1791901932",
"oldestLedgerCloseTime": "1786359079"
}
}