end and start called from api