Errors
In most cases, the error body is an RFC 9457 Problem Details object. Its code is stable, so branch on it. Its detail wording can change, so don't.
What does an error response look like?
{
"type": "https://api.flownally.com/problems/404",
"title": "Not Found",
"status": 404,
"detail": "contact not found",
"code": "contacts_contact_not_found",
"traceId": "00-7b3a8c2e5d4f4a6c9e1d2f3a4b5c6d7e-0f1e2d3c4b5a6978-01"
}| Field | Meaning |
|---|---|
status | The HTTP status code. |
code | Stable, machine-readable error code. Branch on it. Codes start with the area they come from, such as contacts_, messaging_ or auth_. |
detail | Human-readable explanation, for logs. Don't parse it; the wording can change. |
errors | Fields that failed validation, each with field, code and message. |
traceId | Trace ID to quote when you contact support. |
messagingWindow | On messaging errors, whether the conversation can be messaged right now. |
type and title follow the HTTP status, so they don't add anything status doesn't.
Many operations list the codes they return in their reference. New codes can be added at any time, so handle an unknown code by its status.
Rate-limited responses have no body
Responses to rate-limited requests (429) have no body, so read the status alone.
Status codes
| Status | Meaning | What to do |
|---|---|---|
400 | The request is invalid: malformed JSON, a field that fails validation, or an expired page token. | Fix the request. Check errors for the fields. |
401 | The API key is missing, malformed or unknown. | Check the Authorization header. See Authentication. |
403 | The API key was revoked, or the action isn't allowed on this object, such as changing a predefined custom field. | For a revoked key, create a new one. Otherwise, read code. |
404 | The object doesn't exist in this workspace. | Check the ID and that the key belongs to the right workspace. |
409 | The request conflicts with current state, for example an Idempotency-Key reused for a different request. | Read the current state, then decide whether to send a new request. |
412 | The If-Match ETag is out of date. Segments and campaigns use ETags. | Get the object again and retry with its current ETag. |
422 | The request is valid, but the current state doesn't allow it. | Read code and detail, change the state or the request, then try again. |
428 | Updating a segment needs an If-Match header. | Send the segment's current ETag in If-Match. |
429 | You sent too many requests. Limits apply per client IP address. | Retry with exponential backoff and jitter. There's no Retry-After header. |
500 | Flownally failed to complete the request. | Retry with backoff. If it keeps failing, contact support with the traceId. |
503, 504 | A Flownally service was unavailable or didn't answer in time. | Retry with backoff. |
Retry safely
Retry network errors, timeouts, 429, 500, 503 and 504 with exponential backoff and jitter.
Cap the number of attempts, so a failing job stops instead of building a backlog. Don't retry other 4xx statuses until you've changed the request, the credentials or the data.
If the first attempt succeeded and only the response was lost, repeating the request can apply it twice. A retry is safe when that can't happen:
GET,PUTandDELETEcan be repeated. A repeatedDELETEcan return404because the first attempt already succeeded.PATCHcan be repeated when it sets the same fields. WithIf-Match, a repeat returns412if the first attempt succeeded.POSTwith anIdempotency-Keycan be repeated with the same key. These include sending messages, reacting to messages, importing contacts, scheduling and unscheduling campaigns, and recording events. Use a new key for each new request, and the same key for each retry of it.- Other
POSToperations may not be safe to repeat.POST /contactsis one of them. After a timeout, check whether the first attempt succeeded before you send it again.
When a message send is pending
When sending a message returns 503 with code messaging_messaging_send_result_pending, Flownally doesn't know yet whether the message went out. Retry with the same Idempotency-Key to get the result without sending it twice.
Log failures
For each failed request, log the method, path, status, code and traceId. Never log API keys, and don't log message content unless your privacy policy allows it.
A broken sync shows up as stale contacts or missed follow-ups long before anyone reads the logs. Alert a person when an integration keeps failing.
FAQ
Can I parse detail to tell errors apart?
detail to tell errors apart?No. detail is a human-readable explanation for logs, and its wording can change. Branch on the status and code instead.
What should I do after a 429?
429?Retry with exponential backoff and jitter. Limits apply per client IP address. The response has no body and no Retry-After header.
Why did a repeated DELETE return 404?
DELETE return 404?Most likely, the first attempt already succeeded and the object is gone. If there was no earlier attempt, check the ID and that the key belongs to the right workspace.
What does a 409 mean after a retry?
409 mean after a retry?Either something changed what the request depends on, or its Idempotency-Key was already used for a different request. Load the current state first. A real retry keeps the same key and body; anything new needs a new key, as Idempotency keys explains.
What should I send to support?
Quote the traceId from the error response. Log it with the method, path, status and code of every failed request, so you have it when a request keeps failing.