Errors and exit codes
The CLI reports failures in a single, stable shape. The exit status says only whether the command succeeded; the detail is in a JSON error envelope on stderr.
Exit codes
The exit status carries only two meanings:
The exit status is deliberately binary. Scripts should branch on the code field of the error envelope, not on numeric exit codes.
The error envelope
Fields of the error object:
The envelope is always written to stderr, so stdout stays empty on failure and pipelines do not receive partial output.
CLI error codes
These codes come from the CLI itself, distinct from codes the API returns:
API errors
When the API returns an error status after the retry policy is exhausted, the CLI maps the response into the same envelope:
codeis the API’s error code when the response includes one, otherwisehttp.<status>, for examplehttp.403.- For validation responses with an
errorsarray,messagelists each field and its problem, for exampleamount: must be a positive number; date_submitted: is required. request_idis always present so that Deel support can locate the request.
The Hypertext Transfer Protocol (HTTP) status codes and their meanings are documented in the API reference.
Handle errors in scripts
Capture stderr and read code with jq: