Api upgrade

I'm pretty sure this was all finished and working correctly. But hadn't been merged in because of the seesion stuff, but that can be done later.
Wut