q parameter; sorting and pagination are top-level params.
Filtering
Pass filter conditions viaq:
The SDK automatically wraps filter keys in
q[...] and appends [] for array values — pass flat params.Common predicates
Prefixed IDs in filters
Resource ID filters accept Stripe-style prefixed IDs directly. The server decodes them before querying:_id_in, _id_not_eq, and other ID predicates.
Combining filters
Multiple filters combine with AND:Filtering by association
Use underscore notation to filter on associated model attributes:Custom search scopes
Some resources expose convenience search scopes:Sorting
Use the top-levelsort parameter on any list endpoint. Prefix with - for descending. Follows the JSON:API sorting convention.
whitelisted_ransackable_attributes). Sorting on a virtual column (e.g., a serializer-computed field like display_total_spent) is not supported.
Pagination
All collection endpoints return paginated results. Control withpage and limit:
Pagination metadata
Responses include ameta object:
Expanding associations
Most admin endpoints return slim payloads by default — associations are returned as IDs. Use theexpand parameter to include related resources inline:
Nested expand
Use dot notation up to 4 levels deep:expand: ['items.variant'] returns both items and their variant data.
What can I expand?
Each endpoint documents its supported expand keys in the OpenAPI reference. Common admin expansions:Field selection
Use thefields parameter to request only specific fields on a resource. Reduces payload size for bandwidth-sensitive integrations:
idis always included- Expanded associations return their full payload regardless of
fields - Field selection applies to the top-level resource only
TypeScript types in
@spree/admin-sdk remain fully typed regardless of fields. At runtime, only the requested fields are present — the rest are undefined.
