Code draft for api routes