api: exceptions replaced with json response