events - Flow
Example code for the /v1/events REST method. Complete guide on how to use the /v1/events REST method in GetBlock Web3 documentation
Returns events of a given type within a block-height range, or across a set of block IDs. Event type strings follow the A.{address}.{contract}.{event} format. Use it to index on-chain activity such as token transfers.
Endpoint
GET /v1/eventsQuery Parameters
type
string
Event type, e.g. A.1654653399040a61.FlowToken.TokensDeposited (required)
start_height
string
Start block height of the range
end_height
string
End block height of the range
block_ids
string
Comma-separated block IDs instead of a range
Example
export FLOW_REST=https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/
curl "${FLOW_REST}v1/events?type=A.1654653399040a61.FlowToken.TokensDeposited&start_height=88226300&end_height=88226301"const axios = require('axios');
const response = await axios.get('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/v1/events', {
params: {
type: 'A.1654653399040a61.FlowToken.TokensDeposited',
start_height: '88226300',
end_height: '88226301'
},
headers: { 'Content-Type': 'application/json' }
});
console.log(response.data);import requests
response = requests.get(
'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/v1/events',
headers={'Content-Type': 'application/json'},
params={
'type': 'A.1654653399040a61.FlowToken.TokensDeposited',
'start_height': '88226300',
'end_height': '88226301'
}
)
print(response.json())Response
[
{
"block_id": "3b5f...",
"block_height": "88226300",
"block_timestamp": "2025-01-15T12:00:00Z",
"events": [
{
"type": "A.1654653399040a61.FlowToken.TokensDeposited",
"transaction_id": "a1b2...",
"transaction_index": "0",
"event_index": "0",
"payload": "eyJ0eXBlIjoi..."
}
]
}
]Response Fields
block_height
string
Height the events were emitted at
events
array
Events with type, transaction id, and base64 payload
Use Cases
Activity Indexing: Track token transfers and NFT events
Analytics: Aggregate contract events over a height range
Error Handling
400 / Bad request
Bad request
A path, query, or body parameter was invalid
404 / Not found
Not found
The block, account, transaction, or resource does not exist
403 / RBAC: access denied
Access denied
The GetBlock access token is missing or incorrect
Was this helpful?