added complete api endpoints, support for sessions