本文へスキップ
Won.dev
ドキュメントAPIリファレンス

エラーコード

APIが返すすべてのエラーコードと、その意味、次にとるべき対応。

エラーレスポンスはすべて同じJSON形式です。分岐には message ではなく code を使ってください。code は変わりませんが、message は変わることがあります。

hint には次にとるべき対応が入ります。時間をおけば解決する場合は retry_after が設定され、Retry-After ヘッダーにも同じ秒数が入ります。サポートに連絡するときは request_id(X-Request-Id ヘッダーと同じ値)を添えてください。

結果が0件なのはエラーではありません。空のリストとともに 200 が返り、料金はかかりません。失敗したリクエストに料金がかかることはありません。

{
  "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"
  }
}
コードステータス意味
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

メッセージ(APIの原文): A parameter is missing, malformed or out of range.

対応(APIの原文): Check the parameters against the API reference. The message names the field.

unauthorized

HTTP 401

メッセージ(APIの原文): The API key is missing, invalid or revoked.

対応(APIの原文): Send Authorization: Bearer won_live_... with a key from the console.

insufficient_balance

HTTP 402

メッセージ(APIの原文): The balance cannot cover this request.

対応(APIの原文): Top up in the console. The message says how much is missing.

budget_exceeded

HTTP 402

メッセージ(APIの原文): This request would cost more than max_cost, the key's remaining budget or what is left of its daily limit.

対応(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

メッセージ(APIの原文): This key may not use this product, or it may only read and this changes something.

対応(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

メッセージ(APIの原文): Sending is suspended for this sender.

対応(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

メッセージ(APIの原文): The resource or endpoint does not exist.

対応(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

メッセージ(APIの原文): This Idempotency-Key was already used with a different request body.

対応(APIの原文): Use a new Idempotency-Key for a different request.

request_in_progress

HTTP 409

メッセージ(APIの原文): An identical request is still running.

対応(APIの原文): Wait retry_after seconds, then send it again. Results you already paid for are not charged twice.

invalid_state

HTTP 409

メッセージ(APIの原文): The resource is in a state that does not allow this action.

対応(APIの原文): The message names the current state and what is possible from it.

no_domains

HTTP 409

メッセージ(APIの原文): The sender has no sending domain that can send.

対応(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

メッセージ(APIの原文): We stopped the sender: it cannot send.

対応(APIの原文): review_note in GET /email/senders/{id} says why. Write to support to have it looked at.

content_rejected

HTTP 422

メッセージ(APIの原文): The content of an email did not pass the checks.

対応(APIの原文): issues lists every problem and the step it is in. Fix them and send the request again.

daily_limit_reached

HTTP 429

メッセージ(APIの原文): The sender's domains have sent all the emails they may today.

対応(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

メッセージ(APIの原文): Too many requests.

対応(APIの原文): Wait retry_after seconds, then retry with the same Idempotency-Key.

internal_error

HTTP 500

メッセージ(APIの原文): Something went wrong on our side.

対応(APIの原文): Retry with the same Idempotency-Key. You are not charged for failed requests.

out_of_stock

HTTP 503

メッセージ(APIの原文): No sending domain that passes our checks is for sale right now.

対応(APIの原文): Wait retry_after seconds, then ask again. Nothing was charged.

upstream_unavailable

HTTP 503

メッセージ(APIの原文): A data source behind this capability is temporarily unavailable.

対応(APIの原文): Wait retry_after seconds, then retry with the same Idempotency-Key. You are not charged.

最終更新日

このページの内容