Skip to main content
The useListEvents hook provides access to individual event records with pagination. It fetches data from the /events/list endpoint, allowing you to display detailed event logs and histories.
Learn how to setup Autumn hooks in the Getting Started guide.

Parameters

featureId
string | string[]
required
The feature ID or array of feature IDs to query events for.
offset
number
Number of events to skip for pagination. Defaults to 0.
limit
number
Maximum number of events to return per page. Defaults to 50.
customRange
object
Custom date range for filtering events by timestamp.
swrConfig
SWRConfiguration
Optional SWR configuration object to customize caching and revalidation behavior. Accepts a refreshInterval in milliseconds.

Returns

list

Array of individual event records. Each event object includes:
  • id: Unique event identifier
  • timestamp: Unix timestamp in milliseconds when the event occurred
  • feature_id: The feature associated with the event recorded
  • customer_id: The customer that recorded this event
  • value: The numeric value recorded with the event
  • properties: Metadata and custom properties for the event

hasMore

Boolean indicating whether there are more events available on subsequent pages.

hasPrevious

Boolean indicating whether there are previous events available on earlier pages.

page

Current page number (1-based indexing).

isLoading

Boolean indicating whether the event data is currently being fetched.

error

Any AutumnError that occurred while fetching event data.

refetch()

Function to manually refetch the current page of events.

nextPage()

Function to navigate to the next page of events. Only call when hasMore is true.

prevPage()

Function to navigate to the previous page of events. Only call when hasPrevious is true.

goToPage()

Function to jump to a specific page number. Accepts a page number (1-based) as parameter.

resetPagination()

Function to reset pagination back to the first page.