DeuteroError. Errors returned by the API are APIError subclasses, chosen by HTTP status code.
Exception hierarchy
APIError.
deutero.ConnectionError and deutero.TimeoutError shadow Python’s built-ins of the same name. Import them qualified (import deutero and then deutero.TimeoutError) if you also use the built-ins.What’s on an APIError
str
A readable summary, such as
HTTP 404: Study not found. Field-level validation errors are joined into one line, for example name: field required; max_responses: must be positive.int
The HTTP status code.
Any
The parsed response body: a dict for JSON responses, otherwise the raw text. This is where the details live for refusals such as a blocked publish or an invalid flow.
str | None
The
x-request-id response header, if present. Include it when contacting support.Common cases
A publish is refused (409)
A publish is refused (409)
studies.publish raises ConflictError when the plan’s open-study limit, credits or validation block it. e.body carries the refusal code, the issues and the validation_run_id. If only methodological issues remain, publish again with acknowledge_validation_run_id. See Publish.An interview flow is invalid (422) or stale (409)
An interview flow is invalid (422) or stale (409)
graph.set and graph.patch save nothing unless the result is valid. An invalid flow raises ValidationError with every problem in e.body. A stale expected_graph_version raises ConflictError: re-read the flow and retry. See Safe concurrent edits.Not enough credits (402)
Not enough credits (402)
InsufficientCreditsError is raised when the organization can’t cover an operation, such as a simulation. Check your balance with client.credits.get_balance().Rate limited (429)
Rate limited (429)
Back off and retry.
studies.draft_from_site also returns 429 once a site’s draft allowance is used up.Slow model calls time out
Slow model calls time out
Drafting, question generation and validation can take a minute or more. If you see
TimeoutError, raise the client timeout.Retrying
The SDK doesn’t retry failed requests. To retry connection failures, pass anhttpx client with a retrying transport:
.png?fit=max&auto=format&n=G_hwo_L4hZsQ93vT&q=85&s=c00b6042d4688a9b776bae65a530206a)