Inputs allow you to make your flows more dynamic and reusable.

Instead of hardcoding values in your flow, you can use inputs to make your workflows more adaptable to change.

How to retrieve inputs

Inputs can be accessed in any task using the following expression {{ inputs.input_name }}.


Defining inputs

Similar to tasks, inputs is a list of key-value pairs. Each input must have a name and a type. You can also set defaults for each input. Setting default values for an input is always recommended, especially if you want to run your flow on a schedule.

To reference an input value in your flow, use the {{ inputs.input_name }} syntax.

yaml
id: inputs_demo
namespace: dev

inputs:
  - id: user
    type: STRING
    defaults: Rick Astley

tasks:
  - id: hello
    type: io.kestra.core.tasks.log.Log
    message: Hey there, {{ inputs.user }}

Try running the above flow with different values for the user input. You can do this by clicking on the Execute button in the UI, and then typing the desired value in the menu.

Inputs

Here are the most common input types:

TypeDescription
STRINGIt can be any string value. Strings are not parsed, they are passed as-is to any task that uses them.
INTIt can be any valid integer number (without decimals).
BOOLEANIt must be either true or false.

Check the inputs documentation for a full list of supported input types.


Parametrize your flow

In our example, we will provide the URL of the API as an input. This way, we can easily change the URL when calling the flow without having to modify the flow itself.

yaml
id: getting_started
namespace: dev

inputs:
  - id: api_url
    type: STRING
    defaults: https://dummyjson.com/products

tasks:
  - id: api
    type: io.kestra.plugin.fs.http.Request
    uri: "{{ inputs.api_url }}"

To learn more about inputs, check out the full inputs documentation.