Skip to main content
Query parameters allow you to customize API requests to fetch exactly the data you need. The NestJS CRUD framework supports a rich set of query parameters for filtering, sorting, pagination, and more.

Overview

All query parameters are parsed from the URL query string and can be combined to create powerful, flexible API requests.

Available Parameters

The framework supports the following query parameter types:
Parameter names can be customized in the framework configuration, but the default names are shown above.

Delimiters

The framework uses two types of delimiters:
  • Field delimiter (||): Separates parts of a filter, join, or sort parameter
  • String delimiter (,): Separates multiple values within a parameter

Examples

Basic Usage

Simple Request

Fetch users with only specific fields:

Multiple Parameters

Combine multiple query parameters:

Array Parameters

Some parameters accept multiple values using arrays:

Value Parsing

The framework automatically parses values to the appropriate type:

Numbers

Booleans

Dates

Strings

Arrays

Large numbers that exceed JavaScript’s Number.MAX_SAFE_INTEGER are kept as strings to prevent data loss.

URL Encoding

When using special characters in query parameters, make sure to properly URL-encode them:

Advanced Search Parameter

The s parameter accepts JSON for complex queries:
When using the s (search) parameter, the filter and or parameters are ignored.

Best Practices

  1. Use field selection: Always request only the fields you need to reduce payload size
  2. Implement pagination: Use limit and offset or page for large datasets
  3. Encode URLs: Always URL-encode query parameters when using special characters
  4. Combine parameters: Chain multiple parameters for precise data fetching
  5. Use appropriate filters: Choose the right comparison operator for your use case

Example Requests

Get Active Users with Profiles

Search Users by Name or Email

Paginated Results with Sorting

Complex Query with Multiple Conditions

Next Steps

Filtering

Learn about all available filter operators

Sorting

Understand sorting and ordering results

Pagination

Implement pagination in your requests

Relations

Work with related entities using joins