SpeakNotes API 錯誤代碼
每次失敗都會回傳相同的 JSON 封裝:穩定的代碼、人類可讀的訊息、此頁面的連結,以及發生錯誤時的相關欄位。
格式
錯誤永遠不會以 HTML 形式回傳。代碼是穩定且可安全用於分支判斷的;訊息則可能隨時變更。
HTTP/1.1 402 Payment Required
X-Request-Id: 0f0a3f2c-6f1e-4a5e-9f1b-9d0b5a2c7e11
{
"error": {
"type": "billing_error",
"code": "insufficient_credits",
"message": "This operation costs 14 credits and the account has 3 left.",
"doc_url": "https://speaknotes.io/developers/errors#insufficient_credits",
"request_id": "0f0a3f2c-6f1e-4a5e-9f1b-9d0b5a2c7e11"
}
}代碼
invalid_request400The request was malformed or failed validation.
invalid_token401The credential is missing, malformed, expired, or revoked.
insufficient_scope403The credential is valid but lacks the scope this operation needs.
not_found404The requested resource does not exist.
method_not_allowed405That HTTP method is not supported on this path.
conflict409The request conflicts with the current state of the resource.
payload_too_large413The uploaded file exceeds the size limit.
unsupported_media_type415The file format is not supported.
insufficient_credits402The account has no credits left for this operation.
rate_limited429Too many requests. Retry after the interval in the Retry-After header.
upstream_failure502A provider SpeakNotes depends on failed.
content_policy422The content was refused by the AI content policy.
internal_error500SpeakNotes failed to process the request.
重試機制
在 Retry-After 指定的時間間隔後重試 rate_limited,並使用退避機制重試 upstream_failure 一到兩次。切勿重試 invalid_request、insufficient_scope 或 content_policy,因為它們每次都會以相同方式失敗。
請求 ID
每個回應都帶有 X-Request-Id 標頭,錯誤主體也會重複此 ID。提供此 ID 給支援團隊,即可找到確切的失敗原因。