How to get detailed data of a workflow execution?

Hi, I want to create a detailed report of workflow execution, for which I need detailed data of an execution. I would like to know how UI fetches all the data related to a particular execution Id and displays state of every node at the time execution.

To display past executions (at least the ones which got saved to the database) the UI uses the endpoint /rest/executions/:id
Be however aware that this is not an officially supported API and is currently only meant for the Editor-UI. Meaning that it may change in the future. So if you rely on it, make sure to check what got changed before you upgrade to a new n8n version. The code for that endpoint can be found here:

The data of a currently running execution gets pushed to the Editor-UI via Server-Sent events. That happens via workflow hooks which get triggered at different points through the execution of the workflow. The code for that can be found here: