added api to index.php