API Q&A: The JSON is valid, so why did the API return 422?
Parseable JSON does not guarantee valid API parameters. Start with the field path and the serialized request, then add fields one at a time to a known-good request.
When an API returns 422 Unprocessable Content, don't start by replacing the key or replaying the request unchanged. Check whether the endpoint accepts the fields and values actually sent. In HTTP terms, the server understands the content type and the content syntax is correct, but it cannot process the instructions. A JSON parser can tell you the quotes and brackets make sense; it cannot tell you whether parameter types, values, or combinations satisfy this API contract. 1
How is 422 different from 400?
400 Bad Request covers a broader class of client errors, including malformed syntax, invalid message framing, or routing problems. With 422, start by asking which instruction the server understood but could not process. Some services also use 400 for field validation, so don't rely on the status alone. Read the error message, field path, and error code, then consult the documentation for the endpoint you actually called—not another protocol that happens to serve a model with the same name. 12
What do I change when a field is invalid?
Check what went over the wire, not just the object in your source code. Suppose an endpoint requires an integer but your form supplies a string. The serialized value might still be "8". Both 8 and "8" are valid JSON, but they are different types. Omitting a field, sending null, and sending an empty array can likewise produce three different behaviors. Unless the documentation specifies it, do not assume the SDK normalizes them into the same request.
Read the error path from the outer object through any array index to the field. If the server points to items[0].count, inspect the first item's count; do not change every field named count at once. If the name differs from your source, check whether SDK serialization, an alias mapping, or gateway conversion changed it. Retain only redacted fields, types, and relevant paths. Do not paste whole requests, API keys, file URLs, or business content into a support ticket.
How do I narrow it down without a field path?
- Start with a minimal example from the endpoint's official docs. In a test environment, establish a working baseline through the same gateway, endpoint, and model alias. If you change the model, SDK, and proxy together, you won't know which change mattered.
- Add one optional field at a time. If fields only make sense together, test them as a group. Record the difference between the last success and first failure, then look for types, enumerated values, ranges, and mutually exclusive combinations.
- If the gateway path fails, compare the same protocol in an environment you are authorized to use. If direct comparison isn't possible, give support the timestamp, status, request ID, redacted error, and smallest difference. Ask which layer performed validation rather than assuming the model provider rejected it. Keep the failing input as a small test you can rerun after an SDK upgrade or gateway switch.
When should I send the request again?
Make a change you can explain, then verify with a test request. Correct a type to match the docs or remove an optional parameter the endpoint doesn't support. If the response points to a resource-state issue, update the state according to the contract and then decide whether to resend. For endpoints that create or modify resources, check for existing results as the docs prescribe; an error alone does not prove there were no side effects. If the minimal example also fails, stop guessing and take the redacted evidence to support. Sending identical content usually just produces the same 422. 1
Sources & attribution
This article references the public materials listed below. Analysis and wording are SalpX's own; quoted material remains the property of its original authors and publishers.
- 422 Unprocessable Content — MDN Web Docs · accessed 2026-12-04Note:Explains HTTP 422 and why unchanged requests are expected to fail again.
- 400 Bad Request — MDN Web Docs · accessed 2026-12-04Note:Explains that 400 is broader than malformed JSON.
One key for Claude, GPT and 50+ models
The SalpX gateway is OpenAI-SDK compatible. Point base_url at https://www.salpx.com/v1 and you are done.