separated the api into a service