Add function for API