Handle API requests