Skip to main content
Krosyn is launching soon. Join the waitlist for early access.Join waitlist

Documentation

Learn how to use Krosyn to connect your applications.

Expression Language Reference

Complete reference for all expression syntax, functions, and accessors available in Krosyn.

Syntax Basics

Field References

Access data from the execution context using the $ prefix. Use dot notation for nested fields and brackets for array indices.

ExpressionDescription
$payload.emailAccess the email field from the payload
$payload.user.nameAccess nested fields with dots
$payload.items[0]Access array elements by index
$payload.items[0].nameAccess fields on array elements
$lookup.dataAccess data from the Process lookup
$secret.API_KEYAccess an organization secret

String Interpolation

If a string contains $ references mixed with other text, references are automatically replaced with their values.

Hello $payload.name, your order $payload.order_id is confirmed.

Function Calls

Functions use the format functionName(arg1, arg2, ...). Arguments can be field references, string literals (in quotes), numbers, or nested function calls.

uppercase(concat($payload.first_name, " ", $payload.last_name))

Array Literals

Create arrays using bracket syntax:

["value1", "value2", $payload.email]

String Functions

uppercase(value)

Converts a string to uppercase.

uppercase("hello") returns "HELLO"

lowercase(value)

Converts a string to lowercase.

lowercase("HELLO") returns "hello"

trim(value)

Removes whitespace from both ends of a string.

trim(" hello ") returns "hello"

concat(value1, value2, ...)

Joins one or more values into a single string. Accepts any number of arguments.

concat("Hello", " ", "World") returns"Hello World"
concat($payload.first, " ", $payload.last) returns"Jane Doe"

replace(search, replacement, subject)

Replaces all occurrences of search with replacement in subject.

replace("-", " ", "hello-world") returns"hello world"

substring(value, start, length?)

Extracts part of a string starting at the given position. length is optional.

substring("hello world", 0, 5) returns"hello"
substring("hello world", 6) returns "world"

split(delimiter, value)

Splits a string into an array by the given delimiter.

split(",", "a,b,c") returns ["a", "b", "c"]

startsWith(value, prefix)

Returns true if the string starts with the given prefix.

startsWith("hello world", "hello") returns true

endsWith(value, suffix)

Returns true if the string ends with the given suffix.

endsWith("hello world", "world") returns true

padStart(value, length, padString)

Pads the string from the start with padString until it reaches the target length.

padStart("42", 5, "0") returns "00042"

padEnd(value, length, padString)

Pads the string from the end with padString until it reaches the target length.

padEnd("hi", 5, ".") returns "hi..."

repeat(value, count)

Repeats a string the given number of times.

repeat("ab", 3) returns "ababab"

Comparison Functions

equals(a, b)

Returns true if a and b are strictly equal (same value and type).

equals($payload.status, "active") returns true or false

notEquals(a, b) / neq(a, b)

Returns true if a and b are not equal.

notEquals($payload.status, "deleted") returnstrue

contains(haystack, needle)

Returns true if haystack contains needle (string search).

contains($payload.email, "@company.com")

greaterThan(a, b) / gt(a, b)

Returns true if a is greater than b (numeric comparison).

greaterThan($payload.total, 100)

lessThan(a, b) / lt(a, b)

Returns true if a is less than b (numeric comparison).

lt($payload.quantity, 10)

gte(a, b)

Returns true if a is greater than or equal to b.

gte($payload.score, 80)

lte(a, b)

Returns true if a is less than or equal to b.

lte($payload.retries, 3)

Logical Functions

and(condition1, condition2, ...)

Returns true only if all arguments are truthy. Accepts 2 or more arguments.

and(equals($payload.status, "active"), greaterThan($payload.total, 50))

or(condition1, condition2, ...)

Returns true if any argument is truthy. Accepts 2 or more arguments.

or(equals($payload.priority, "high"), equals($payload.priority, "critical"))

not(condition)

Returns the boolean inverse of the argument.

not(equals($payload.status, "deleted"))

Math Functions

add(a, b)

Returns the sum of two numbers.

add($payload.subtotal, $payload.tax)

subtract(a, b)

Returns a - b.

subtract($payload.total, $payload.discount)

multiply(a, b)

Returns a * b.

multiply($payload.price, $payload.quantity)

divide(a, b)

Returns a / b. Returns null if b is zero.

divide($payload.total, $payload.count)

modulo(a, b)

Returns the remainder of a / b. Returns null if b is zero.

modulo($payload.index, 2) returns 0 for even, 1 for odd

round(value, precision?)

Rounds a number. Optional precision sets decimal places (default: 0).

round(3.7) returns 4
round(3.14159, 2) returns 3.14

ceil(value)

Rounds a number up to the nearest integer.

ceil(3.2) returns 4

floor(value)

Rounds a number down to the nearest integer.

floor(3.8) returns 3

abs(value)

Returns the absolute value of a number.

abs(-42) returns 42

min(a, b, ...)

Returns the smallest value. Accepts 2 or more arguments.

min($payload.price, 99.99) caps price at 99.99

max(a, b, ...)

Returns the largest value. Accepts 2 or more arguments.

max($payload.quantity, 1) ensures minimum quantity of 1

Array Functions

join(separator, array)

Joins array elements into a string with the given separator.

join(", ", $payload.tags) returns"tag1, tag2, tag3"

count(array)

Returns the number of elements in an array.

count($payload.items) returns 3

first(array)

Returns the first element of an array, or null if empty.

first($payload.results)

last(array)

Returns the last element of an array, or null if empty.

last($payload.history)

includes(array, value)

Returns true if the array contains the given value.

includes($payload.roles, "admin")

map(array, field)

Extracts a single field from each element in an array of objects. Returns a flat array of values.

map($payload.items, "name") returns["Widget", "Gadget"]

filter(array, field, value)

Returns only the elements where element[field] equals value.

filter($payload.items, "status", "active")

flatten(array)

Flattens a nested array by one level.

flatten([["a", "b"], ["c"]]) returns["a", "b", "c"]

unique(array)

Returns the array with duplicate values removed.

unique(["a", "b", "a"]) returns ["a", "b"]

sort(array)

Returns the array sorted in ascending order.

sort(["c", "a", "b"]) returns ["a", "b", "c"]

sum(array)

Returns the sum of all numeric values in the array.

sum(map($payload.items, "price")) returns the total price

Date/Time Functions

now()

Returns the current date and time in ISO 8601 format.

now() returns "2026-03-21T14:30:00+00:00"

formatDate(date, format)

Formats a date string using PHP date format characters (e.g. Y-m-d, d/m/Y H:i).

formatDate($payload.created_at, "d/m/Y") returns"21/03/2026"

timestamp()

Returns the current Unix timestamp (seconds since epoch).

timestamp() returns 1774310400

dateDiff(date1, date2)

Returns the absolute difference between two dates in seconds.

dateDiff($payload.start_date, $payload.end_date)returns seconds between dates

Type Functions

toNumber(value)

Converts a value to a number. Returns an integer when possible, otherwise a float.

toNumber("42") returns 42
toNumber("3.14") returns 3.14

toString(value)

Converts a value to a string. Booleans become "true"/"false", null becomes "", arrays become JSON.

toString(42) returns "42"

toBoolean(value)

Converts a value to a boolean. Truthy values become true, falsy values become false.

toBoolean($payload.is_active)

isNull(value)

Returns true if the value is null.

isNull($payload.optional_field)

isEmpty(value)

Returns true if the value is null, an empty string, an empty array, or false.

isEmpty($payload.notes)

Conditional

if(condition, thenValue, elseValue?)

If condition is truthy, returns thenValue. Otherwise returns elseValue (or null if not provided).

if(equals($payload.status, "active"), "yes", "no") returns"yes" or "no"
if(greaterThan($payload.total, 100), "premium") returns"premium" or null

Fallback

default(value, fallback)

Returns value if it is not null, otherwise returns fallback. Useful for providing default values for optional fields.

default($payload.nickname, $payload.name)
default($payload.currency, "USD")

Chained Accessors

Accessors are shorthand transformations that can be chained onto field references using dot notation. They apply after the field value is resolved.

AccessorDescriptionExample
.uppercaseConvert to uppercase$payload.name.uppercase
.lowercase / .downcaseConvert to lowercase$payload.email.lowercase
.upfirst / .ucfirstCapitalize first letter$payload.name.ucfirst
.lcfirstLowercase first letter$payload.type.lcfirst
.trimRemove leading/trailing whitespace$payload.input.trim
.lengthGet string length$payload.name.length
.reverseReverse the string$payload.code.reverse
.titleCapitalize each word$payload.title.title
.slugConvert to URL-friendly slug$payload.title.slug
.camelConvert to camelCase$payload.field_name.camel
.snakeConvert to snake_case$payload.fieldName.snake
.kebabConvert to kebab-case$payload.fieldName.kebab

Accessors can be chained: $payload.name.trim.uppercase