List groups in an API route
1
Run the list workflow
Pass the fields you want and put filters and pagination in The workflow returns
variables.src/api/admin/purchases/route.ts
{ rows, metadata }. metadata carries count, skip, and take for pagination. Every row includes its child orders with payment_status and fulfillment_status.2
Add filters
Put filter keys next to the pagination keys in This returns the customer’s groups from October 2026 that have at least one captured or partially captured child order.
variables:Filters you can use
The Seller module reads groups through a custom repository that understands a fixed set of top-level keys:- Group filters:
id,customer_id,cart_id, as a string or an array - Order filters:
seller_id,status,payment_status,sales_channel_id, which match a group when at least one child order matches - Dates:
created_atandupdated_at, with$eq,$ne,$lt,$lte,$gt,$gte,$in,$nin,$like,$ilike - Search:
q, which matches the group id or customer id, and a display id such as#G98,G98, or98on the group or a child order
display_id, created_at, or updated_at. Without an order, groups come back newest first.
Scope groups to one seller
To show a seller only their part of each purchase, filter the groups and trim their orders:variables.seller_id keeps only the groups where the seller has an order. sellerId removes the other sellers’ orders from each returned group. sellerId also accepts an array of seller ids.
seller_count and total still describe the whole group when you scope it. Sum the trimmed orders to get the seller’s share.List groups without child orders
When you only need group rows, call the Seller module service. It skips the child order expansion and the status work:MercurModules comes from @mercurjs/types. The rows still include the computed seller_count and total.