Error envelope
404 for a URL that does not exist at all is still this envelope. One failure branch is enough.
The fields
Types
Validation errors name the valid values
An error from this API is written to be actionable, not merely correct. Where an enum is wrong, the message lists the accepted values; where a required field is missing, it says what a real value looks like.400 — bad trigger
400 in a terminal wants the same sentence.
What is safe to retry
429 and 5xx are the retryable failures. Everything in the 4xx range below 429 will fail identically until the request changes.
Retry with exponential backoff and jitter. A tight retry loop against a 429 extends the window you are limited for.
A 5xx never echoes an internal message. The body says temporary server error, retry, because an internal fault is not something the caller can act on, and the internals of a failure are not theirs to read. The X-Request-Id on the response is what identifies it — quote that in a support request.
Timeouts are not errors
POST /v1/ask and POST /v1/automations/{id}/runs start work that can outlive the request. They answer 200 with status: "running" and a session_id; that is the success case, not a failure.
Wait poll_after_ms, then poll GET /v1/sessions/{id} until status is complete or failed. Re-sending the original POST instead starts a second billed run.
Still stuck? Troubleshooting covers empty results, unexpected zeros and keys that stopped working.