pass sort to API directly rather than sorting in Python