Skip to content

Request Parameters

Parameters define the inputs your route accepts from callers.

PropertyDescription
NameParameter name (use camelCase, e.g., firstName)
RequiredWhether the parameter must be provided
ValidatorsOne or more validation rules (see below)
Is NullableWhether the parameter can explicitly be null

SourceDescriptionExample
Query stringParameters passed in the URL?name=John
Request bodyParameters sent as JSON in POST/PUT/PATCH requests{ "name": "John" }
Path parametersDynamic segments captured from the URL/users/:id

Use prefixes to reference parameters in where clauses and assignments:

PrefixTypeExampleDescription
$Local parameter$firstNameA request parameter specific to this route
#Global parameter#userIdA value from the authenticated user context

Local parameters are specific to a single route. They come from:

  • Query string parameters (for GET requests)
  • Request body (for POST/PUT/PATCH requests)
  • Path parameters (captured from the URL)

Example usage in where clauses:

user.id = $userId
user.email LIKE $searchTerm
order.status IN $statuses

Example usage in assignments:

firstName = $firstName
companyId = $companyId

Global parameters are values from the authenticated user context, available in all routes. They are typically populated by your authentication handler.

Example usage:

user.id = #userId
order.companyId = #companyId

Learn more about configuring global parameters.


Validators ensure incoming data meets your requirements before processing.

ValidatorDescriptionValue Format
Type CheckEnsures the parameter matches an expected data typestring, number, boolean, object, string[], number[], any[]
MinEnforces a minimum value for numbersNumber (e.g., 0)
MaxEnforces a maximum value for numbersNumber (e.g., 100)
One OfRestricts values to a specific allowed setComma-separated values (e.g., active,pending,closed)
  1. Request validation – Incoming parameters are checked against defined validators
  2. Coercion – Query string parameters are automatically converted to expected types (strings become numbers, booleans, etc.)
  3. Processing – If validation passes, the request proceeds to SQL generation or handler code

You can apply multiple validators to a single parameter:

name: quantity
validators:
- Type Check: number
- Min: 1
- Max: 1000

This ensures the quantity parameter is:

  • A number (not a string or boolean)
  • At least 1
  • No more than 1000

name: id
required: true
validators:
- Type Check: number
- Min: 1
name: searchTerm
required: false
validators:
- Type Check: string
name: status
required: false
validators:
- Type Check: string
- One Of: active,pending,completed,cancelled

For PAGED routes, these parameters are added automatically:

page: number (default: 1)
perPage: number (default: 10)
filter: string (optional)
sortBy: string (optional)
sortOrder: string (optional, ASC or DESC)

Learn more about pagination.


When validation fails, Restura returns a 422 VALIDATION_ERROR response:

{
"error": {
"code": "VALIDATION_ERROR",
"message": "Parameter 'quantity' must be between 1 and 1000"
}
}

Learn more about error handling.