Generalize API endpoint