Skip to main content
Big news! Interval has been acquired by Meter. Learn more →

Input validation


The Validation API is available in SDK versions v0.22.0 and higher.

Out of the box, I/O methods handle basic validation for you. For example, will ensure the string you receive is a valid email and io.input.number will ensure you receive a valid number.

Custom validation can be performed by chaining a .validate() method call to an I/O method or to an The validation function that you pass to this method receives the group or method's potential return value as its argument and must return either a string error message if the value is invalid, or undefined if it is valid.

Error messages returned from a validation function will be shown to the user, giving them the opportunity to make changes and retry submission.


Validation functions are regular functions that run alongside the rest of your action logic on your infrastructure — you're able to reference any other code just like you can within actions.

Validation functions can also be async or return a Promise.


const { name, email, age, includeDrinkTickets } = await io
name: io.input.text("Name"),
email:"Email").validate(email => {
if (!email.endsWith(""))
return "Only Interval employees are invited to the holiday party.";
age: io.input.number("Age"),
includeDrinkTickets: io.input.boolean("Include drink tickets?"),
.validate(({ age, includeDrinkTickets }) => {
if (age < 21 && includeDrinkTickets)
return "Attendees must be 21 years or older to receive drink tickets.";

In the example above, only people with a matching organization email address are allowed to RSVP to the holiday party, and only attendees 21 years or older are allowed to receive drink tickets.

Did this section clearly explain what you wanted to learn?
On this page