API error handling
Outside services fail sometimes: a wrong key, a missing record, a slow network. This page explains what counts as an error, what your users see, and how to build around it.
API error handling
Outside services fail sometimes: a wrong key, a missing record, a slow network. This page explains what counts as an error, what your users see, and how to build around it.
When to use
- A Call API action "does nothing" or shows an error toast.
- A workflow run is marked failed on a Call API step.
- You want graceful behaviour when the service is down.
What counts as an error
| Situation | In a Call API action | In a Call API workflow step |
|---|---|---|
| Service answers 2xx | Success; result saved | Success; result saved |
| Service answers 4xx/5xx | The action completes; the result holds the mapped body, plus the status and an ok = false flag | The step fails with API returned HTTP <status> |
| Timeout (no answer within the API's timeout, default 10 s) | Error; remaining actions skipped | Step fails |
| Missing secret for the environment | Error: API "…" needs the secret NAME in production. | Step fails with the same message |
| Response larger than 2 MB | Error: API "…" returned more than 2 MB. | Step fails |
| Blocked address (private network, non-http) | Error: Requests to private network addresses are not allowed. | Step fails |
| API not allowed from the app | Error: This API can only be used from workflows. | — |
What users see
- Actions: on error, the remaining actions in the list are skipped and an error toast shows the message. On a form, the form's onError actions run.
- Bindings: a component bound to a failing API shows its empty state; no toast is shown.
- Workflows: the run is marked failed and the step's error appears in Run history. Later steps do not run.
Handling a non-2xx answer in actions
Because the action completes, you can check the status yourself:
- Call API with Save result as
lookup. - If / else on Result › lookup (for example Result › lookup.error is not empty, or compare a field you expect on success).
- Then: Show message "Could not find that address" (style error). Else: continue.
The HTTP status code is not exposed to later actions, so base the check on the mapped body: most services return an error or message field on failure, or omit a field that is always present on success.
Handling failures in workflows
- Put a Call API step on its own path where a failure is acceptable: an If / else before it can skip the call when input is missing.
- Keep the critical steps (create the record, send the confirmation) before the API step so they are not lost when it fails.
- Read the exact error in Run history and re-run with Test run after fixing the secret or parameters.
Timeouts
Set the Timeout (ms) per API (500 to 30,000; default 10,000). Lengthen it for slow services; shorten it for lookups on interactive pages so users are not kept waiting.
Common mistakes
- Expecting an action to stop on a 404. It does not; check the result or use a workflow step where failure stops the run.
- Testing only in Development. Secrets and base URLs may differ per environment; test the staging app too.
- Retrying inside the app. There is no automatic retry; keep workflows idempotent and re-run them from Test run when needed.
Related
- APIs overview · Test request · Authentication
- Call API action · Call API step · If / else action
- API request failing
Advanced
executeApiSource returns { ok, status, data, raw, durationMs } and only throws for transport-level problems (invalid URL, SSRF block, timeout via AbortSignal.timeout, size cap). The actions endpoint returns { result: data, status, ok }; the workflow api node throws when !ok. Rate limits: 60 action calls per minute per user, 120 binding loads per minute.