Inputs is a list of dynamic values passed to the flow at runtime.

What are inputs

A flow can be parameterized using inputs to allow multiple executions of the same flow, each with different input values. Flow inputs are stored as variables within the flow execution context and can be accessed within the flow using the syntax {{ inputs.parameter_name }}.

You can use inputs to make your tasks more dynamic. For instance, you can use an input to dynamically define the path of a file that needs to be processed within a flow.

You can inspect the input values in the Overview tab of the Execution page.

Declaring inputs

You can declare as many inputs as necessary for any flow. Inputs can be required or optional.

If an input is required, we recommend using the defaults property to set default values. The flow cannot start if the input is not provided during the creation of the Execution.

Every input will be parsed during the creation of the execution, and any invalid inputs will deny the creation of the execution.

Below is an example flow using several inputs:

id: inputs
namespace: dev

  - id: string
    type: STRING
  - id: optional
    type: STRING
    required: false
  - id: int
    type: INT
  - id: bool
    type: BOOLEAN
  - id: float
    type: FLOAT
  - id: instant
    type: DATETIME
  - id: date
    type: DATE
  - id: time
    type: TIME
  - id: duration
    type: DURATION
  - id: file
    type: FILE
  - id: optionalFile
    type: FILE
  - id: instantDefaults
    type: DATETIME
    defaults: "2013-08-09T14:19:00Z"
  - id: json
    type: JSON
  - id: uri
    type: URI
  - id: secret
    type: SECRET
  - id: nested.string
    type: STRING

Input types

Inputs in Kestra are strongly typed and validated before starting the flow execution.

Here is the list of supported data types:

  • STRING: It can be any string value — inputs of type STRING are passed to the execution in its raw format without parsing; for additional validation, you can add a custom regex validator to allow only specific string patterns.
  • INT: Must be a valid integer value (without any decimals).
  • FLOAT: Must be a valid float value (with decimals).
  • ENUM: Must be a valid string value from a predefined list of values.
  • BOOLEAN: Must be true or false passed as strings.
  • DATETIME: Must be a valid full ISO 8601 date and time with the timezone expressed in UTC format; pass input of type DATETIME in a string format following the pattern 2042-04-02T04:20:42.00Z.
  • DATE: Must be a valid full ISO 8601 date without the timezone from a text string such as 2042-12-03.
  • TIME: Must be a valid full ISO 8601 time without the timezone from a text string such as 10:15:30.
  • DURATION: Must be a valid full ISO 8601 duration from a text string such as PT5M6S.
  • FILE: Must be a file sent as Content-Type: multipart/form-data with Content-Disposition: form-data; name="files"; filename="my-file", where my-file is the name of the input.
  • JSON: Must be a valid JSON string and will be converted to a typed form.
  • URI: Must be a valid URI and will be kept as a string.
  • SECRET: a SECRET input is a string that is encrypted and stored in the database. It is decrypted at runtime and can be used in all tasks. The value of a SECRET input is masked in the UI and in the execution context. Note that you need to set the encryption key in your Kestra configuration before using it.

All inputs of type FILE will be automatically uploaded to Kestra's internal storage and accessible to all tasks. After the upload, the input variable will contain a fully qualified URL of the form kestra:///.../.../ that will be automatically managed by Kestra and can be used as-is within any task.

Input Properties

Below is the list of available properties for all inputs regardless of their types:

  • name: The input parameter name — this property is important as it's used to reference the input variables in your flow, e.g. {{ inputs.user }} will reference the input parameter named user.
  • type: The data type of the input parameter, as described in the previous section.
  • required: Whether the input is required or optional; if required is set to true and no default value is configured and also no input is provided at runtime, the execution will not be created as Kestra cannot know what value to use.
  • defaults: The default value that will be used if no custom input value is provided at runtime; this value must be provided as a string and will be coerced to the desired data type specified using the type property.
  • description: A markdown description to document the input.

Input validation

Kestra validates the type of each input. In addition to the type validation, some input types can be configured with validation rules that will be enforced at execution time.

  • STRING: A validator property allows the addition of a validation regex.
  • INT: min and max properties allow the addition of minimum and maximum value ranges.
  • FLOAT: min and max properties allow the addition of minimum and maximum ranges.
  • DURATION: min and max properties allow the addition of minimum and maximum ranges.
  • DATE: after and before properties help you ensure that the input value is within the allowed date range.
  • TIME: after and before properties help you ensure that the input value is within the allowed time range.
  • DATETIME: after and before properties help you ensure that the input value is within the allowed date range.

Example: using input validators in your flows

To ensure that your input value is within a certain integer value range, you can use the min and max properties. Similarly, to ensure that your string input matches a regex pattern, you can provide a custom regex validator. The following flow demonstrates how this can be accomplished:

id: regex-input
namespace: dev

  - id: age
    type: INT
    defaults: 42
    required: false
    min: 18
    max: 64

  - id: user
    type: STRING
    defaults: student
    required: false
    validator: ^student(\d+)?$

  - id: validator
    type: io.kestra.core.tasks.log.Log
    message: User {{ inputs.user }}, age {{ inputs.age }}

The age input must be within a valid range between min and max integer value. Specifically, we specify that this input will be by default set to 42, but it can be overwritten at runtime to a value between 18 and 64. If you attempt to execute the flow with the age input set to 17 or 65, the validation will fail and the execution won't start.

Similarly, the Regex expression ^student(\d+)?$ is used to validate that the input argument user of type STRING follows the following pattern:

  • ^student: This part of the regex asserts that the string must begin with the lowercase string value student.
  • \d: This part of the regex matches any digit (0-9).
  • +: This part of the regex asserts that there is one or more of the preceding token (i.e., one or more digits are allowed after the value student).
  • ()?: The parentheses group the digits together, and the question mark makes the entire group optional — this means that the digits after the word student are optional.
  • $: This part of the regex asserts the end of the string. This ensures that the string doesn't contain any additional characters after the optional digits.

With this pattern:

  • "student" would be a match.
  • "student123" would be a match.
  • "studentabc" would not be a match because "abc" isn't a sequence of digits.
  • "student123abc" would not be a match because no more characters are allowed after the sequence of "students" with the following numbers.

Try running this flow with various inputs or adjust the regex pattern to see how the input validation works.

Nested Inputs

If you use a . inside the name of an input, the input will be nested.

Consider the input with the following configuration:

  - id: nested.string
    type: STRING
    required: false

You can access that input value using {{ inputs.nested.string }}. This syntax provides a convenient type validation of nested inputs without using raw JSON that would not be validated (JSON-type input values are passed as strings).

Using input value in a flow

Every input is available with dynamic variables such as: {{ }} or {{ inputs['name'] }}.

For example, if you declare the following inputs:

  - id: my-file
    type: FILE
  - id: my-string
    type: STRING
    required: true

You can use the value of the input my-string inside dynamic task properties with {{ inputs['my-string'] }}.

Set input values at flow execution

When you execute a flow with inputs, you must set all inputs (unless optional or with a default value) to be able to create the execution.

Let's consider the following example that defines multiple inputs:

id: kestra-inputs
namespace: dev

  - id: string
    type: STRING
    defaults: hello
  - id: optional
    type: STRING
    required: false
  - id: int
    type: INT
  - id: float
    type: FLOAT
  - id: instant
    type: DATETIME
  - id: file
    type: FILE

Here, the inputs {{ inputs.string }} and {{ inputs.optional }} can be skipped because the string input has a default value and the optional input is not required. All other inputs must be specified at runtime.

Set inputs from the web UI

When creating an execution from the web UI, you must set the inputs in the UI form. Kestra's UI will generate a dedicated form based on your inputs definition. For example, datetime input properties will have a date picker.

The input form for the inputs above looks as follows:

Flow inputs

Once the inputs are set, you can trigger an execution of the flow.

Set inputs when executing the flow using the curl command

To create an execution with these inputs using the curl command, you can use the following command:

curl -v "http://localhost:8080/api/v1/executions/trigger/io.kestra.test/kestra-inputs" \
    -H "Transfer-Encoding:chunked" \
    -H "Content-Type:multipart/form-data" \
    -F string="a string"  \
    -F optional="an optional string"  \
    -F int=1  \
    -F float=1.255  \
    -F instant="2023-12-24T23:00:00.000Z" \
    -F "files=@/tmp/128M.txt;filename=file"

All files must be sent as multipart form data named files with a header filename=my-file which will be the name of the input.

Set inputs when executing the flow in Python

To create an execution with these inputs in Python, you can use the following script:

import io
import requests
from requests_toolbelt.multipart.encoder import MultipartEncoder

with open("/tmp/example.txt", 'rb') as fh:
  url = f"http://localhost:8080/api/v1/executions/trigger/io.kestra.test/kestra-inputs"
  mp_encoder = MultipartEncoder(fields={
    "string": "a string",
    "optional": "an optional string",
    "int": str(1),
    "float": str(1.255),
    "instant": "2020-01-14T23:00:00.000Z",
    "files": ("file", fh, "text/plain")
  result =
      headers={"Content-Type": mp_encoder.content_type},

Set inputs when executing the flow in Java

To create an execution with these inputs in Java (with Apache Http Client 5), you can use the following script:

import org.apache.hc.client5.http.classic.methods.HttpPost;
import org.apache.hc.client5.http.entity.mime.FileBody;
import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder;
import org.apache.hc.client5.http.entity.mime.StringBody;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.HttpEntity;


class Application {
  public static void main(String[] args) {
    HttpEntity multipartEntity = MultipartEntityBuilder.create()
        .addPart("string", new StringBody("test", ContentType.DEFAULT_TEXT))
        .addPart("int", new StringBody("1", ContentType.DEFAULT_TEXT))
        .addPart("files", new FileBody(new File("/tmp/test.csv"), ContentType.DEFAULT_TEXT, "file"))

    try (CloseableHttpClient httpclient = HttpClientBuilder.create().build()) {
      HttpPost request = new HttpPost("http://kestra:8080/api/v1/executions/trigger/com.kestra.lde/inputs");

      CloseableHttpResponse response = httpclient.execute(request);

      System.out.println("Response " + response);
    } catch (Exception e) {
      throw new RuntimeException(e);