1/6

A JSON-RPC 2.0 Request is four members: jsonrpc, method, an optional params, and an optional id. A Response carries either result or error — never both, never neither.

{"jsonrpc": "2.0", "method": "sum", "params": [1, 2], "id": 3}
{"jsonrpc": "2.0", "error": {"code": -32601, "message": "Method not found"}, "id": 3}

Five codes are reserved, and they partition the failure space in the order you check them:

| code | meaning | what the caller learns | | --- | --- | --- | | -32700 | Parse error | the bytes were not JSON | | -32600 | Invalid Request | it parsed, but it is not a Request object | | -32601 | Method not found | this endpoint does not exist | | -32602 | Invalid params | it exists — retry with different arguments | | -32603 | Internal error | it is not you, it is the server |

-32000 through -32099 is left for the application's own server errors: -32001 Request timeout, -32002 Server busy, and whatever else your contract documents.