API returns correct HTTP status code