Errors
Every error code the API returns, what it means and what to do next.
Every error response has the same JSON shape. Branch on code, never on message: codes are stable, messages may change.
hint says what to do next. retry_after is set when waiting helps, and the Retry-After header carries the same number. Quote request_id (also the X-Request-Id header) when you contact support.
No results is not an error: it is a 200 with an empty list, and it is free. Failed requests are never charged.
{
"error": {
"code": "insufficient_balance",
"message": "The balance cannot cover this request.",
"hint": "Top up in the console. The message says how much is missing.",
"docs_url": "https://won.dev/docs/errors#insufficient_balance",
"retry_after": null,
"request_id": "req_6f1c0d3a9b8e4f2a8c7d5e4b3a2f1e0d"
}
}| Code | Status | Meaning |
|---|---|---|
invalid_input | 400 | A parameter is missing, malformed or out of range. |
unauthorized | 401 | The API key is missing, invalid or revoked. |
insufficient_balance | 402 | The balance cannot cover this request. |
budget_exceeded | 402 | This request would cost more than max_cost or the key's remaining budget. |
forbidden | 403 | This key is not allowed to perform this action. |
sending_suspended | 403 | Sending is suspended for this account. |
not_found | 404 | The resource or endpoint does not exist. |
idempotency_conflict | 409 | This Idempotency-Key was already used with a different request body. |
request_in_progress | 409 | An identical request is still running. |
invalid_state | 409 | The resource is in a state that does not allow this action. |
sender_not_ready | 409 | We stopped the sender: it cannot send. |
content_rejected | 422 | The content of an email did not pass the checks. |
rate_limited | 429 | Too many requests. |
internal_error | 500 | Something went wrong on our side. |
upstream_unavailable | 503 | A data source behind this capability is temporarily unavailable. |
invalid_input
HTTP 400
Message: A parameter is missing, malformed or out of range.
What to do: Check the parameters against the API reference. The message names the field.
unauthorized
HTTP 401
Message: The API key is missing, invalid or revoked.
What to do: Send Authorization: Bearer won_live_... with a key from the console.
insufficient_balance
HTTP 402
Message: The balance cannot cover this request.
What to do: Top up in the console. The message says how much is missing.
budget_exceeded
HTTP 402
Message: This request would cost more than max_cost or the key's remaining budget.
What to do: Raise max_cost, raise the key's budget in the console, or narrow the request.
forbidden
HTTP 403
Message: This key is not allowed to perform this action.
What to do: Check the key's permissions in the console.
sending_suspended
HTTP 403
Message: Sending is suspended for this account.
What to do: Too many bounces or complaints, or we stopped it. The message says which. Write to support to have it looked at.
not_found
HTTP 404
Message: The resource or endpoint does not exist.
What to do: Check the ID and the path. An ID starts with its type, such as co_ for a company or cmp_ for a campaign, and only works with the endpoints of that type.
idempotency_conflict
HTTP 409
Message: This Idempotency-Key was already used with a different request body.
What to do: Use a new Idempotency-Key for a different request.
request_in_progress
HTTP 409
Message: An identical request is still running.
What to do: Wait retry_after seconds, then send it again. Results you already paid for are not charged twice.
invalid_state
HTTP 409
Message: The resource is in a state that does not allow this action.
What to do: The message names the current state and what is possible from it.
sender_not_ready
HTTP 409
Message: We stopped the sender: it cannot send.
What to do: review_note in GET /email/senders/{id} says why. Write to support to have it looked at.
content_rejected
HTTP 422
Message: The content of an email did not pass the checks.
What to do: issues lists every problem and the step it is in. Fix them and send the request again.
rate_limited
HTTP 429
Message: Too many requests.
What to do: Wait retry_after seconds, then retry with the same Idempotency-Key.
internal_error
HTTP 500
Message: Something went wrong on our side.
What to do: Retry with the same Idempotency-Key. You are not charged for failed requests.
upstream_unavailable
HTTP 503
Message: A data source behind this capability is temporarily unavailable.
What to do: Wait retry_after seconds, then retry with the same Idempotency-Key. You are not charged.