using api instead of cookies