Skip to main content
The Store API uses Ransack for filtering and sorting collection endpoints. All query parameters are passed via the q parameter.

Filtering

Pass filter conditions using the q parameter with Ransack predicates:

Common Predicates

The SDK automatically wraps filter keys in q[...] and appends [] for array values — just pass flat params.

Combining Filters

Multiple filters are combined with AND logic:

Filtering by Association

You can filter by associated model attributes using underscore notation:

Product Scopes

Products support additional filter scopes beyond standard Ransack predicates:

Sorting

Use the sort parameter on any list endpoint. Prefix a field with - for descending order (ascending is the default). This follows the JSON:API sorting convention.

Product Sort Options

Sorting Other Resources

The sort parameter works on all list endpoints. Use any sortable column name:

Expanding Associations

Use the expand parameter to include associated resources in the response. Pass a comma-separated list of association names:

Nested Expand

Use dot notation to expand nested associations (up to 4 levels deep):

Rules

  • Maximum depth is 4 levels (e.g., a.b.c.d)
  • A nested expand automatically includes its parent — expand=variants.media expands both variants and their media
  • Nested expand only applies to conditional associations (those controlled by expand)

Field Selection

Use the fields parameter to request only specific fields in the response. This reduces payload size for bandwidth-sensitive clients like mobile apps or server-side rendering.

Rules

  • The id field is always included, even if not listed in fields
  • Omitting fields returns all fields (default behavior)
  • Field selection applies to the top-level resource only — expanded associations always return their full set of fields
  • Expanded associations are always included in the response regardless of fields?fields=name&expand=variants returns id, name, and variants
The SDK TypeScript types remain fully typed regardless of field selection. When using fields, be aware that only the requested fields will be present at runtime.

Pagination

All collection endpoints return paginated results. Control pagination with page and limit parameters:

Pagination Parameters

Pagination Metadata

Collection responses include a meta object with pagination info: