How to get current execution ID in the node

I understand that the “Execution ID” of a workflow represents a unique ID for every execution of the workflow. This is needed for a number of reasons like stopping a running execution or saving the execution in the database.

My question is: Is it possible to get the current execution ID from within a node using some metadata method. Something like



No that is currently sadly not possible.

What you are describing are actually currently two different IDs.

One is the ID of a currently running execution. Every execution will always get one as it gets used like you already wrote to, for example, stop a running execution. This ID simply resets with each start of the n8n instance and gets incremented by 1 with every execution. This one could theoretically get exposed inside of the workflow.

A totally different ID is the one of the past saved executions. This one is only given to executions that get saved to the database. Depending on the settings that are none, the ones that failed, the ones that did succeed or none. This ID gets incremented by 1 for each saved execution and never resets (unless obviously the database gets deleted).

Thanks for the clarity.

I am trying to get the 2nd one that you mentioned. Assume that the settings are to save the executions are always there, Is there anyway to get it?

No sadly not. The reason is that it does not exist till the workflow finished executing.
Only after it got executed does it check if the workflow should be saved or not (depending on error/success and if it did get started manually). So the ID does simply not exist at that point in time and can so not be returned.

Thank. I have accepted the answer.

1 Like