group api and sorting api