Task globals

Values available to use when executing a template for a task
Airplane supports JS templates for specifying various task fields including environment variable values, REST request parameters, and SQL query bodies.
See the documentation for the specific task type for more details on which fields can be templated; as mentioned in the JS templates page, these fields are also marked by a {} symbol in the UI.
The sections below discuss the global objects that you can access inside these templates.

Parameters

All top-level task parameters are stored in a global object called params. You can use this object along with the parameter's slug to refer to any parameter within a template. So, for instance, if you have a user_id parameter, you can refer to this by {{params.user_id}} in a template-enabled task field.

Config variables

Similar to parameters, any attached configs are stored in a global object called configs. You can reference the config by its name in any templated field, e.g. a config named API_KEY can be used as {{configs.API_KEY}}.

Globals reference

Here's a full list of the global variables that you can use in task templates, including the ones described above:
NameDescription
{{params}}An object, keyed by parameter slug, containing the task's parameter values.
{{run.id}}The id of the task run.
{{run.url}}A URL to the task run page in the Airplane UI.
{{run.runner.id}}The id of the user who started the run.
{{run.runner.email}}The email of the user who started the run.
{{run.runner.name}}The name of the user who started the run.
{{run.requester.id}}The id of the user who requested the run.
{{run.requester.email}}The email of the user who requested the run.
{{run.requester.name}}The name of the user who requested the run.
{{task.id}}The id of the task.
{{task.revisionID}}The id of the task revision (i.e., version).
{{task.url}}A URL to the task page in the Airplane UI.
{{task.name}}The name of the task.
{{configs}}An object, keyed by config name, containing the task's config attachments.
{{resources}}An object, keyed by the resource slug, containing information about the resource (varies by resource type).
{{env.id}}The id of the environment context of the task run. For information on environments, see Environments.
{{env.slug}}The slug of the environment context of the task run.
{{env.name}}The name of the environment context of the task run.
{{env.is_default}}true if the environment context of the task run is the team's default environment.
Note that not all globals are applicable in all cases; the run.requester values, for instance, won't be set if there was no run request.