Added session checking to API index method