Find Why My API Returns 422

Scenario

Your API call is returning 422 Unprocessable Entity but you cannot figure out why. The error message from the server is buried in the response body, and your client code only shows the status code.

Steps

Start the proxy:

roxyproxy start

If the target API uses HTTPS, trust the CA certificate so RoxyProxy can decrypt the traffic:

roxyproxy trust-ca

Make the API call through the proxy:

curl -x http://127.0.0.1:8080 https://api.example.com/endpoint

Query for the failed request:

roxyproxy requests --status 422 --format agent

The --status 422 flag filters to only that status code. The --format agent output includes the full response body, so you can read the validation error directly.

Common causes you will find in the response body:

  • Missing required field
  • Invalid field type (string instead of number)
  • Value out of allowed range or enum
  • Duplicate unique constraint violation

With Your AI Agent

With the AI Agent Plugin, describe the problem and let your agent trace it:

You: "My POST to /api/users is returning 422. What's wrong?"

Your agent queries RoxyProxy, finds the request, reads the validation
error in the response body, and fixes the request payload.

Your agent sees both what you sent and what the server rejected, then updates your code to match the expected schema.