Pular para o conteúdo
Won.dev
DocumentaçãoReferência da API

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ódigoStatusSignificado
invalid_input400A parameter is missing, malformed or out of range.
unauthorized401The API key is missing, invalid or revoked.
insufficient_balance402The balance cannot cover this request.
budget_exceeded402This request would cost more than max_cost, the key's remaining budget or what is left of its daily limit.
forbidden403This key may not use this product, or it may only read and this changes something.
sending_suspended403Sending is suspended for this sender.
not_found404The resource or endpoint does not exist.
idempotency_conflict409This Idempotency-Key was already used with a different request body.
request_in_progress409An identical request is still running.
invalid_state409The resource is in a state that does not allow this action.
no_domains409The sender has no sending domain that can send.
sender_not_ready409We stopped the sender: it cannot send.
content_rejected422The content of an email did not pass the checks.
daily_limit_reached429The sender's domains have sent all the emails they may today.
rate_limited429Too many requests.
internal_error500Something went wrong on our side.
out_of_stock503No sending domain that passes our checks is for sale right now.
upstream_unavailable503A 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

Nesta página