Variables & Data
Set variables, access request data, and use expressions in your functions.
Variables & Data
Variables store data as your function runs. You create them with Set Variable steps and reference them in any step that follows.
The step properties panel showing variable configuration Configure step properties and variables in the right panel
Set a variable
Use a Set Variable step to create or update a variable:
- Variable Name — e.g., greeting, totalPrice, isAdmin - Value — An expression that computes the value
| Variable Name | Value | |--------------|-------------------------------------| | greeting | "Hello, " + input.name | | totalPrice | input.price * input.quantity | | isAdmin | vars.user.role === "admin" |
Built-in variables
Every function has access to these built-in data sources:
| Variable | What it contains | Example | |-----------|----------------------------------------------|----------------------------| | vars | Variables you set during the function | vars.cases | | input | The request body (POST, PUT, PATCH) | input.name | | params | URL path parameters | params.id | | query | URL query string parameters | query.page | | headers | HTTP request headers | headers.authorization | | env | Server environment variables | env.JWT_SECRET |
Examples
// Path: GET /api/cases/:id?include=updates params.id // "42" query.include // "updates"
// Body: POST /api/cases { "case_name": "Contract Review" }
input.case_name // "Contract Review"
// Environment env.API_KEY // Your configured API key
Good to know
Query string and path parameter values are always strings. Use params.id | toNumber or Number(params.id) when you need a number.
Using expressions
Expressions let you compute values dynamically. They use JavaScript syntax and work in any step property:
// Arithmetic input.price * input.quantity
// String concatenation "Hello, " + input.name
// Ternary vars.count > 0 ? "found" : "empty"
// Access nested data vars.user.address.city vars.products[0].name
// Default values input.page || 1 query.limit ? Number(query.limit) : 20
Filters
Filters transform values using a pipe (|) syntax. They are a shorthand for common operations:
input.email | lowercase | trim query.page | toNumber | default: 1 vars.items | map: "name" vars.name | uppercase
Pro tip
Check the Filters Reference for the full list of available filters.
Variable scoping
- Variables are scoped to the current function execution - A variable set inside an If/Else branch is still accessible after the branch - Each request creates a fresh context — variables do not leak between requests
Create a Function /flows/creating-flows Build your first function step by step Code View /flows/code-view See variables as JavaScript code Try & Runs /flows/debugging Inspect variable values at each step