Ability to set One Time flow Execution then disable part of workflow (use case: Generate API Token / Refresh API)

The idea is:

The addition of a feature that enables users to set workflows or specific nodes within a workflow to execute only once and then automatically disable or turn off. This functionality would be particularly useful in scenarios where a one-time execution is required, such as generating or refreshing an API token.

My use case:

In my current projects, I frequently need to generate new API tokens for accessing third-party services. Each token has a limited lifetime, and for security reasons, it’s vital to refresh these tokens periodically. Currently, managing this process requires manual intervention or custom scripting, which is not only time-consuming but also prone to errors.

Another use case involves setting up a workflow to perform a one-time data migration or setup task. Once the task is completed, there’s no need for the workflow to run again, and manually disabling it can be a hassle, especially in complex workflows where it’s easy to forget.

I think it would be beneficial to add this because:

  • Efficiency: Automates the process of disabling workflows or nodes after a one-time execution, saving time and reducing manual effort.
  • Error Reduction: Minimizes the risk of accidentally re-running critical one-time processes, which could lead to data duplication, inconsistencies, or breaches in security.
  • Flexibility: Offers more control over workflow execution, allowing for more complex and dynamic setups tailored to specific project requirements.

This feature would enhance the usability and robustness of n8n for a wide range of use cases, making it an even more powerful tool for automating tasks.

Any resources to support this?

While I don’t have direct links to resources that showcase this exact feature, many workflow and automation platforms lack this capability, which often leads to the need for workaround solutions that can be cumbersome and inefficient. Implementing this in n8n would set it apart and provide a strong selling point for users requiring precise control over their automation tasks.

Are you willing to work on this?

I am willing to contribute by providing detailed feedback and testing the feature during its development phase. However, my programming skills are limited, so I might not be able to contribute code directly.

hello @anas

you can handle that with workflowStaticData variable and IF node, or you can move the one-time functionality to another workflow that will have an n8n node in the end, which will disable the flow.

But the right way is to check when the API will return the 401 error and then execute the separate workflow, which will refresh the token.