Erros
Todos os códigos de erro que a API retorna, o que significam e o que fazer em seguida.
Toda resposta de erro tem o mesmo formato JSON. Decida pelo code, nunca pela message: os códigos são estáveis, as mensagens podem mudar.
hint diz o que fazer em seguida. retry_after vem preenchido quando esperar resolve, e o cabeçalho Retry-After traz o mesmo número. Informe o request_id (também no cabeçalho X-Request-Id) quando falar com o suporte.
Nenhum resultado não é um erro: é um 200 com uma lista vazia, e não é cobrado. Requisições com falha nunca são cobradas.
{
"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"
}
}| Código | Status | Significado |
|---|---|---|
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, the key's remaining budget or what is left of its daily limit. |
forbidden | 403 | This key may not use this product, or it may only read and this changes something. |
sending_suspended | 403 | Sending is suspended for this sender. |
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. |
no_domains | 409 | The sender has no sending domain that can send. |
sender_not_ready | 409 | We stopped the sender: it cannot send. |
content_rejected | 422 | The content of an email did not pass the checks. |
daily_limit_reached | 429 | The sender's domains have sent all the emails they may today. |
rate_limited | 429 | Too many requests. |
internal_error | 500 | Something went wrong on our side. |
out_of_stock | 503 | No sending domain that passes our checks is for sale right now. |
upstream_unavailable | 503 | A data source behind this capability is temporarily unavailable. |
invalid_input
HTTP 400
Mensagem (texto original da API): A parameter is missing, malformed or out of range.
O que fazer (texto original da API): Check the parameters against the API reference. The message names the field.
unauthorized
HTTP 401
Mensagem (texto original da API): The API key is missing, invalid or revoked.
O que fazer (texto original da API): Send Authorization: Bearer won_live_... with a key from the console.
insufficient_balance
HTTP 402
Mensagem (texto original da API): The balance cannot cover this request.
O que fazer (texto original da API): Top up in the console. The message says how much is missing.
budget_exceeded
HTTP 402
Mensagem (texto original da API): This request would cost more than max_cost, the key's remaining budget or what is left of its daily limit.
O que fazer (texto original da API): Raise max_cost, raise the key's budget or daily limit in the console, or narrow the request. A daily limit starts over at midnight UTC, which retry_after counts down to.
forbidden
HTTP 403
Mensagem (texto original da API): This key may not use this product, or it may only read and this changes something.
O que fazer (texto original da API): The message says which. Owners and admins set what a key may do on the API keys page of the console, and a connected app gets what was allowed when it was connected.
sending_suspended
HTTP 403
Mensagem (texto original da API): Sending is suspended for this sender.
O que fazer (texto original da API): Too many bounces or complaints, or we stopped it. The message says which, as does review_note in GET /email/senders/{id}. The account's other senders go on. Write to support to have it looked at.
not_found
HTTP 404
Mensagem (texto original da API): The resource or endpoint does not exist.
O que fazer (texto original da API): 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
Mensagem (texto original da API): This Idempotency-Key was already used with a different request body.
O que fazer (texto original da API): Use a new Idempotency-Key for a different request.
request_in_progress
HTTP 409
Mensagem (texto original da API): An identical request is still running.
O que fazer (texto original da API): Wait retry_after seconds, then send it again. Results you already paid for are not charged twice.
invalid_state
HTTP 409
Mensagem (texto original da API): The resource is in a state that does not allow this action.
O que fazer (texto original da API): The message names the current state and what is possible from it.
no_domains
HTTP 409
Mensagem (texto original da API): The sender has no sending domain that can send.
O que fazer (texto original da API): Buy one with POST /email/domains (sender_id, count, confirm: true). One that is still setting up is ready within minutes: see GET /email/domains?sender_id=....
sender_not_ready
HTTP 409
Mensagem (texto original da API): We stopped the sender: it cannot send.
O que fazer (texto original da API): review_note in GET /email/senders/{id} says why. Write to support to have it looked at.
content_rejected
HTTP 422
Mensagem (texto original da API): The content of an email did not pass the checks.
O que fazer (texto original da API): issues lists every problem and the step it is in. Fix them and send the request again.
daily_limit_reached
HTTP 429
Mensagem (texto original da API): The sender's domains have sent all the emails they may today.
O que fazer (texto original da API): Wait retry_after seconds, until midnight UTC, or buy another domain with POST /email/domains. Answers to replies are not limited.
rate_limited
HTTP 429
Mensagem (texto original da API): Too many requests.
O que fazer (texto original da API): Wait retry_after seconds, then retry with the same Idempotency-Key.
internal_error
HTTP 500
Mensagem (texto original da API): Something went wrong on our side.
O que fazer (texto original da API): Retry with the same Idempotency-Key. You are not charged for failed requests.
out_of_stock
HTTP 503
Mensagem (texto original da API): No sending domain that passes our checks is for sale right now.
O que fazer (texto original da API): Wait retry_after seconds, then ask again. Nothing was charged.
upstream_unavailable
HTTP 503
Mensagem (texto original da API): A data source behind this capability is temporarily unavailable.
O que fazer (texto original da API): Wait retry_after seconds, then retry with the same Idempotency-Key. You are not charged.
Última atualização em