Skip to main content

Overview

Many list endpoints support filtering, sorting, and pagination through query parameters. This allows you to retrieve exactly the data you need.

Filtering

Use the filters parameter to filter results by field values.

Basic Syntax

?filters=fieldName==value

Examples

# Products with price exactly $29.99
GET /api/products?filters=price==29.99

# Products created after a specific date
GET /api/products?filters=createdAt>2025-01-01

# Orders with "pending" status
GET /api/orders?filters=status==pending

Operators

OperatorDescriptionExample
==Equalsstatus==pending
!=Not equalsstatus!=cancelled
>Greater thanprice>10
<Less thanprice<100
>=Greater than or equalstock>=5
<=Less than or equalstock<=50
@=Contains (case-sensitive)name@=premium
_=Starts withname_=Pro
@=*Contains (case-insensitive)name@=*PREMIUM
_=*Starts with (case-insensitive)name_=*pro

Multiple Filters

Combine multiple filters with commas (all conditions must match):
# Products priced between $10 and $50 with stock available
GET /api/products?filters=price>10,price<50,stock>0

# Orders that are pending and created in 2025
GET /api/orders?filters=status==pending,createdAt>=2025-01-01

OR Conditions

Use | for OR conditions within a single field:
# Products that are either "public" or "unlisted"
GET /api/products?filters=privacy==0|1

# Orders with status "pending" or "verifying"
GET /api/orders?filters=status==pending|verifying

Sorting

Use the sorts parameter to order results by one or more fields.

Basic Syntax

# Sort ascending
?sorts=fieldName

# Sort descending (add minus sign)
?sorts=-fieldName

Examples

# Sort products by price (lowest first)
GET /api/products?sorts=price

# Sort products by price (highest first)
GET /api/products?sorts=-price

# Sort by newest first
GET /api/orders?sorts=-createdAt

Multiple Sort Fields

Separate multiple sort fields with commas:
# Sort by status, then by date (newest first)
GET /api/orders?sorts=status,-createdAt

# Sort by price ascending, then name ascending
GET /api/products?sorts=price,name

Pagination

Control the number of results and which page to retrieve.

Parameters

page
integer
default:"1"
Page number (1-indexed)
pageSize
integer
default:"25"
Number of items per page (max varies by endpoint)

Example

# Get second page with 50 items per page
GET /api/products?page=2&pageSize=50

Combining Everything

You can combine filtering, sorting, and pagination in a single request:
# Get page 2 of public products under $100, sorted by price
GET /api/products?filters=privacy==0,price<100&sorts=price&page=2&pageSize=20

Response Format

Paginated responses include metadata about the total results:
{
  "success": true,
  "pages": 5,
  "data": [
    // ... items
  ]
}

Field Availability

Each endpoint supports different filterable and sortable fields. Check the specific endpoint documentation for available fields.

Important Notes

  • URL Encoding: Use URL encoding for special characters (spaces, dates with time, etc.)
  • Case Sensitivity: String comparisons are case-sensitive unless you use @=* or _=* operators
  • Date Format: Date filters use ISO 8601 format: 2025-01-01T00:00:00Z
  • Page Size Limits: Some endpoints may have maximum pageSize limits - check individual endpoint docs