building the api layer