Access top-level workflow id and execution id in subworkflows - Custom Node or Code Node

The idea is:

Expose the top-level workflow ID and execution ID in custom nodes and the Code node, even within sub-workflows. These values should be available as part of the execution context, regardless of whether the current node is running in the main workflow or within a sub-workflow.

My use case:

We have a number of complex workflows that invoke sub-workflows to handle modular or reusable logic. For observability and audit purposes, we log key actions and outcomes to an external system. However, since each sub-workflow runs in its own execution context, it’s difficult to correlate actions across the parent-child workflow boundary.

Having access to the top-level workflow ID and execution ID from within sub-workflows would allow us to associate all logs and operations back to the original triggering workflow, providing full traceability and simplifying troubleshooting.

I think it would be beneficial to add this because:

  • It enables end-to-end traceability across nested workflows.
  • It improves observability in logging, error tracking, and auditing.
  • It allows developers to implement custom logging and telemetry without having to manually pass metadata between workflows.
  • It aligns with common practices in distributed and event-driven systems where trace context is maintained across calls.

Any resources to support this?

  • Use cases in observability frameworks like OpenTelemetry, which emphasize trace propagation across services.

Are you willing to work on this?

Yes, other than working out the variable names, this is a very simple change to the Execute Workflow and Execute Workflow Trigger core nodes.

Just jumping in to say I’d really love to see this feature added — it would make a big difference for us and probably for a lot of other teams using n8n.

We have an auxiliary sub-workflow that handles service executions in parallel, and we need to avoid overlaps or too many concurrent runs. To manage that, we’ve built a locking mechanism that depends on the parent execution ID and workflow ID.

The issue is: we currently have to manually pass these values from the parent to every sub-workflow call. It works, but it’s easy to forget or misconfigure — especially when multiple people are maintaining the workflows.

If we could access something like $parent.execution.id or $parent.workflow.id directly inside the sub-workflow, it would:

  • Make everything way more reliable
  • Help with logging and debugging
  • Improve traceability between workflows
  • Reduce the chance of human error

Would be awesome to have this built-in.