--- title: 'List Events Within a Tenant' --- Browsing events within a tenant is exposed through the [List Tenant Events ](/api-reference/v4/endpoints/current-tenant-feed) API. This guide explains how to use the tenant feed API perform a full export of all results. ## Paging The tenant feed endpoint uses parameters that match the [Flare standard paging pattern ](/concepts/paging). ## Fetching new results in future executions It is possible to save the `next` in a database and use it to resume fetching new results in the future. However, it is important that future requests use **exactly** the same parameters for everything else but `next`. ## Getting the full data of results For performance reasons, feed results only contain the bare minimum. To get the full data, an API call must be made per result to the [Retrieve Event ](/api-reference/v2/endpoints/activities/get-activities-) endpoint. ## Available Endpoints ### List events for a tenant If you're looking to export the events of a tenant, refer to the [List Tenant Events ](/api-reference/v4/endpoints/current-tenant-feed) endpoint. ```python # (incomplete example) for resp in api_client.scroll( method="POST", url="/firework/v4/events/tenant/_search", json={ "from": last_from, }, ): ... ``` ### List events for a single identifier If you're looking to export the events of a single identifier, refer to the [List Identifier Events ](/api-reference/v4/endpoints/identifier-feed) endpoint. ```python # (incomplete example) # ID of the identifier for which we want to list the events. identifier_id: int = 12345 for resp in api_client.scroll( method="POST", url=f"/firework/v4/events/identifiers/{identifier_id}/_search", json={ "from": last_from, }, ): ... ``` ### List events for an identifier group If you're looking to export the events of an entire identifier group, refer to the [List Identifier Group's Events ](/api-reference/v4/endpoints/identifier-group-feed) endpoint. ```python # (incomplete example) # ID of the identifier group for which we want to list the events. identifier_group_id: int = 12345 for resp in api_client.scroll( method="POST", url=f"/firework/v4/events/identifier_groups/{identifier_group_id}/_search", json={ "from": last_from, }, ): ... ``` ## End-to-End Examples These are end-to-end examples in various programming languages. ```python import time from flareio import FlareApiClient api_client = FlareApiClient.from_env() last_from: str | None = None fetched_pages: int = 0 for resp in api_client.scroll( method="POST", url="/firework/v4/events/tenant/_search", json={ "from": last_from, }, ): # Rate limiting (search). time.sleep(1) resp_data: dict = resp.json() fetched_pages += 1 num_results: int = len(resp_data["items"]) print(f"Fetched page {fetched_pages} with {num_results} results...") # Save the last "next" value. last_from = resp_data.get("next") or last_from # (Optional): Get the full data for item in resp_data["items"]: # Rate limiting (default). time.sleep(0.25) event_response = api_client.get( url="/firework/v2/activities/", params={ "uid": item["metadata"]["uid"], }, ) full_data = event_response.json() print(f"Here is the full data of the event: {full_data}") print(f"The next execution could resume using {last_from=}.") ```