Return
Halts execution and returns the defined result immediately. Return is useful when used in combination with conditional statements where you want to change the return based on the result of the condition.Try/Catch



- code is the error code
- message is the error message
- result will be any accompanying data. Most functions will not output a result, and only return data in code and message


Throw Error

Post Process
Post process allows you to execute additional logic after your API has provided a response. This can be useful if you want to see a response on your front-end without waiting for any additional processing to occur, but a background task does not meet your needs. Example

- Set var_1 to “Hello!”
- Send var_1 to external API
- The Xano API responds with “Hello!”
- Set **var_1 **to “Goodbye!”
- Send var_1 to external API

Debug Log
Debug Log allows you to output specific information in a new debug logging section of the Debugger. This is similar to how a console log statement in Javascript would behave. These steps will not run outside of Run & Debug.


Precondition
A precondition is a statement that says “this condition must evaluate as true, or we halt execution and return an error message.”1
Preconditions use the expression builder to define the conditions it checks. Click button below to define your conditions.

Using the Expression Builder
Each conditional has four different components.Conditional TypeThe conditional type determines how this condition is weighted in the final return. You can choose between AND and OR. AND conditionals require the present conditional and any others before it to be satisfied, such as “where the date is before today AND the user is an admin”. OR conditionals do not require any other conditionals to be satisfied, such as “if the user is an admin OR if the user is a manager”.Left ValueThis is the first value you’re using in the conditional. In a database query, this is usually going to be a column that you want to check against.OperatorsPlease note that operators may differ based on where you are building the expression. Database queries will have different operators available than regular conditional statements. Learn More
- Equals (==) - an exact match
- Not Equals (!=) - does not equal
-
Equals with type matching (===) - an exact value match and an exact type match
- Ex. Variable var_1 has a value of 123, with a type of text. You set up a conditional statement to check if var_1 === 123, but your value in the conditional statement is of type integer. This would return false, because the types do not match.
- Not equals with type matching (!==) - does not equal value or type, similar to ===
- Greater than (>) - the value on the left is greater than the value on the right
- Greater than or equals (≥) - the value on the left is greater than or equals to the value on the right.
- Less than (<) - the value on the left is less than the value on the right.
- Less than or equals (≤) - the value on the left is less than or equals to the value on the right.
- LIKE - Used for comparing text. Like is case-insensitive and compares if a text string is like another text string. It can be thought of as equals for text but upper case and lower case does not matter.
- NOT LIKE - Used for comparing text. Not Like is case-insensitive and compares if a text string is not like another. It is like not equals for text but upper case and lower case does not matter.
- INCLUDES - Used for comparing text. Includes is a flexible operator and is case-insensitive. It is able to determine if there is a partial match in a text string.
- DOES NOT INCLUDE - Used for comparing text. Does not include determines if a text string is not included in another text string.
- IN - If a single value is found in an array (list). Start with the single value on the left side and the right side should contain the array.
- NOT IN - If a single value is not found in an array (list). The single value should be on the left side and the array on the right side.
- REGEX MATCHES - Regular Expression used for finding patterns in text.
- REGEX DOES NOT MATCH - Regular Expression used for finding a pattern that does not match in text.
- OVERLAPS - Used for comparing two arrays. Overlaps determines if any values in one array are present in the second array.
- DOES NOT OVERLAP - Used for comparing two arrays. Does not overlaps determines if no values in the first array are present in the second array.
- CONTAINS - Contains is an advanced filter used for JSON and arrays. It looks for an exact schema match.
- DOES NOT CONTAIN - Does not contain is the opposite of contains. It determines if there is not an exact schema match.
Right Value
The right value is whatever you are checking against the left value. This could be a hardcoded value, a variable, or even a database field from the same record.2
Define what happens if the conditions do not evaluate as true.
You can provide a custom error message, choose an error type, and supply a payload to return, such as the values being checked in your conditions.

Stop & Debug
Halts execution and returns a value. Useful to ensure that specific pieces of your function stack are running as expected while building.
Group
Groups functions together. This is an organizational tool for you as you build your function stacks and does not impact any part of the actual execution.Sleep
Waits for a defined number of seconds before proceeding to the next step.
CSV Stream
CSV Stream is a powerful function allowing you to ‘stream’ chunks of a CSV file in sequence to your function stack, allowing for processing of large CSV files.- a file resource to ingest the CSV file This can come from either a File Resource input, or a file delivered by an external API, with a Create File Resource step applied
- a CSV stream function to stream the CSV data This function initiates the streaming of CSV data, and provides an output variable. This output variable is meant for use with a For Each loop
- a For Each loop to run through the individual CSV rows The loop is responsible for performing any functions you’d like on your CSV, such as adding each row to one of your database tables.


JSONL Stream
JSONL Stream is a powerful function allowing you to ‘stream’ chunks of JSON in sequence to your function stack, allowing for processing of large data sets, similar to the CSV Stream function above.HTTP Header
Set a custom HTTP header. This function is useful if you need your responses to deliver specific, custom headers. You can also use this to specify custom API response codes outside of the ones our Precondition function offers. The duplicates parameter lets you decide to either replace headers that already exist with your new header, or allow for duplicate headers to exist.
Examples of Custom HTTP Headers
Examples of Custom HTTP Headers
Please note that each individual header should use its own Set Header function.
Serving Content Downloads
If you want your API to directly serve file downloads, use this header:Custom HTTP Status
Sometimes, you might need to send an HTTP status that Xano doesn’t natively offer using preconditions.Get All Variables
Returns all of the variables present up to that point in the function stack.Get All Input
Returns all of the inputs sent to the API in a single object.Get All Raw Input
Returns all data sent to the API, even if they are not defined inputs. You’d use this function when building a **Webhook, **or you otherwise aren’t sure what data will be sent to this endpoint.Exclude Middleware Modification should be set to
false
if you intend on using the raw data in your function stack **before **it’s modified by Middleware.Get Environment Variables
Returns all of your environment variables in a single object.Calculate Distance
Calculate the distance between two longitude/Latitude points
IP Address Lookup
Takes in an IP address and returns geographical information based on that IP. This product includes GeoLite2 data created by MaxMind, available from https://www.maxmind.com.
Set Data Source
This function allows you to specify which data source that database operations following it target. Remember that the order of operations in a function stack matters, so any database operations that come before your Set Data Source statement will use whatever is used normally.