api almost finished