Update api.php

Fix for 2.3 and some other additional features I will outline in a doc.