changed to api instead of db connection