MostlyQR

エラー

REST APIは標準HTTPステータスコードを使用し、JSONエラーボディを返します:

json
{ "error": "unauthorized", "message": "Missing or invalid API key" }

# ステータスコード

Status error When
400 invalid-argument Malformed body or a missing required field.
401 unauthorized Missing, invalid, or revoked API key.
403 permission-denied Beyond your plan’s entitlement (a feature your plan doesn’t include).
404 not-found No link/campaign/job with that id, or not owned by your account.
405 method_not_allowed That HTTP method isn’t supported on the path.
409 failed-precondition The resource isn’t in a state that allows the operation — e.g. editing a frozen link, or minting serialized codes beyond your Enterprise allotment (the limit is in the message).
429 rate_limited / resource-exhausted Per-key rate limit hit (rate_limited — includes a retry_at timestamp and X-RateLimit-* response headers) or a plan quota exhausted (resource-exhausted). Back off and retry.
5xx internal Something went wrong our end; safe to retry idempotent reads.

トランスポートレベルのエラー(認証、ルーティング、レート制限)は snake_case コードを使用します。リソースレベルのエラーは kebab-case を使用します(Firebase呼び出し規約)。常にHTTPステータスで判定し、error 文字列では判定しないでください。

# 所有権

すべての読み取りと書き込みは、APIキーが解決するアカウントにスコープされます。別のアカウントのリンクまたはキャンペーンをリクエストすると、404 が返されます(403 ではありません)。存在することは明かしません。

# 非同期ジョブ

Batch および serialized mint ジョブはリクエストを受け入れ(200queued)、その後、元のHTTPレスポンスではなく、ジョブステータスstatus: "failed" と理由)に失敗を表示します。常にジョブをポーリングしてください。

# 検証

公開検証エンドポイントは不明なシリアルでエラーを発生させません。status: "unknown" を返します(偽造/未発行コードは404ではなく、意味のある回答です)。

#