When running API routes, the server by default will respond with an HTML website. To get the errors in JSON output, you will need to set the Accept header to application/json.

curl -H Accept=application/json ...