Backend API
Use the sort parameter to sort results. The format consists of <field> <direction>. Direction is recognized as a case-insensitive word like ascending and descending, or as abbreviated asc and desc.
You can combine multiple sort fields in a single comma-separated string, with the first taking precedence in order. The sort value must be a string—array values are ignored.
By default, list results are sorted by id desc (newest first). Any direction word that doesn't start with desc is treated as ascending.
Example query using sort
const { swell } = require('swell-node');
swell.init('store-id', 'secret-key');
await swell.get('/products', {
sort: 'name asc', // or desc
});