Skip to main content
Version: 2.2

Get events by contract

Don't have an API key yet?

Start using this API for your project today.

Get your free API key
POSThttps://deep-index.moralis.io/api/v2.2/:address/events

Get events for a contract ordered by block number in descending order. Try it with Swagger.

PATH PARAMS
addressstringrequired
The address of the contract
QUERY PARAMS
chainstring
The chain to query
from_blocknumber

The minimum block number from which to get the logs

  • Provide the param 'from_block' or 'from_date'
  • If 'from_date' and 'from_block' are provided, 'from_block' will be used.
to_blocknumber

The maximum block number from which to get the logs.

  • Provide the param 'to_block' or 'to_date'
  • If 'to_date' and 'to_block' are provided, 'to_block' will be used.
from_datestring

The start date from which to get the logs (any format that is accepted by momentjs)

  • Provide the param 'from_block' or 'from_date'
  • If 'from_date' and 'from_block' are provided, 'from_block' will be used.
to_datestring

Get the logs up to this date (any format that is accepted by momentjs)

  • Provide the param 'to_block' or 'to_date'
  • If 'to_date' and 'to_block' are provided, 'to_block' will be used.
topicstringrequired
The topic of the event
offsetnumber
offset
limitnumber
The desired page size of the result.
orderstring
The order of the result, in ascending (ASC) or descending (DESC)
cursorstring
The cursor returned in the previous response (used for getting the next page).
BODY PARAM
jsonrequired
ABI of the specific event
Responses
API KEY
import Moralis from 'moralis';

try {
await Moralis.start({
apiKey: "YOUR_API_KEY"
});

const response = await Moralis.EvmApi.events.getContractEvents({
"chain": "0x1",
"order": "DESC",
"address": "0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB"
});

console.log(response.raw);
} catch (e) {
console.error(e);
}
Response Example
Empty