move status and header to api callbacks