Poll API
Poll API provides a stream of Doma Protocol events. These events could be used to build your own representation of Doma protocol state, analytics, or any kind of processing.
API works using Poll -> Acknowledge system. It means that to receive new events, older events should be acknowledged. Sample integration could look like this:
Call Poll API to get new events. Optional
limit
andeventTypes
could be specified.Process events (store in database, send to message queue, etc.).
Call Poll Ack API to acknowledge last received event (you can use
lastId
from response). This would acknowledge all of the events from polled batch.
Tips:
To process events one-by-one, specify
limit=1
in Poll API call.To reprocess already received events (e.g. if new event type is added), Poll Reset API can be used to rewind polling cursor to a lower id. To reset cursor to the beginning,
eventId
should be set to0
.Each returned event has a
uniqueId
field, that can be used as an idempotency key for events processing.
Returns blockchain events that have occurred since the last acknowledged event.
Maximum number of events to return in a single response page.
Whether to return only finalized events.
true
GET /v1/poll HTTP/1.1
Host: api-testnet.doma.xyz
Api-Key: YOUR_API_KEY
Accept: */*
{
"events": [
{
"id": 101,
"name": "example.com",
"tokenId": "109782310436602119473309635585647935844683647842954156419454133097053284015402",
"type": "NAME_TOKEN_MINTED",
"uniqueId": "text",
"relayId": "text",
"eventData": {
"networkId": "eip155:1",
"finalized": true,
"txHash": "text",
"blockNumber": "11111",
"logIndex": 1,
"tokenAddress": "0x1234567890123456789012345678901234567890",
"tokenId": "1",
"type": "NAME_TOKEN_MINTED",
"owner": "text",
"name": "example.com",
"expiresAt": "2026-01-17T13:55:54.099Z",
"correlationId": "text"
}
}
],
"lastId": 42,
"hasMoreEvents": true
}
Updates the last acknowledged event id for the client.
Last event id that was processed by the client.
POST /v1/poll/ack/{lastEventId} HTTP/1.1
Host: api-testnet.doma.xyz
Api-Key: YOUR_API_KEY
Accept: */*
No content
Updates the last acknowledged event id for the client. Can be used to reset the polling state to re-consume events.
Event id to reset the last acknowledged event id to.
POST /v1/poll/reset/{eventId} HTTP/1.1
Host: api-testnet.doma.xyz
Api-Key: YOUR_API_KEY
Accept: */*
No content
Last updated