รหัสข้อผิดพลาด SpeakNotes API
ความล้มเหลวทุกครั้งจะส่งคืน JSON envelope รูปแบบเดียวกัน: รหัสที่เสถียร ข้อความที่มนุษย์อ่านเข้าใจ ลิงก์ไปยังหน้านี้ และฟิลด์ที่เกิดข้อผิดพลาด (ถ้ามี)
รูปแบบ
ข้อผิดพลาดจะไม่ส่งกลับมาเป็น 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_request | 400 | The request was malformed or failed validation. |
invalid_token | 401 | The credential is missing, malformed, expired, or revoked. |
insufficient_scope | 403 | The credential is valid but lacks the scope this operation needs. |
not_found | 404 | The requested resource does not exist. |
method_not_allowed | 405 | That HTTP method is not supported on this path. |
conflict | 409 | The request conflicts with the current state of the resource. |
payload_too_large | 413 | The uploaded file exceeds the size limit. |
unsupported_media_type | 415 | The file format is not supported. |
insufficient_credits | 402 | The account has no credits left for this operation. |
rate_limited | 429 | Too many requests. Retry after the interval in the Retry-After header. |
upstream_failure | 502 | A provider SpeakNotes depends on failed. |
content_policy | 422 | The content was refused by the AI content policy. |
internal_error | 500 | SpeakNotes failed to process the request. |
Request ids
ทุกการตอบกลับจะมีส่วนหัว X-Request-Id และในเนื้อหาข้อผิดพลาดจะระบุซ้ำไว้ด้วย โปรดแจ้งรหัสนี้แก่ฝ่ายสนับสนุนเพื่อค้นหาความล้มเหลวที่เกิดขึ้นจริง
สิ่งที่ควรลองใหม่
ให้ลองใหม่สำหรับ rate_limited หลังจากช่วงเวลาใน Retry-After และสำหรับ upstream_failure ให้ลองใหม่หนึ่งหรือสองครั้งโดยใช้ backoff ห้ามลองใหม่สำหรับ invalid_request, insufficient_scope หรือ content_policy ที่ไม่มีการเปลี่ยนแปลง เพราะจะล้มเหลวในรูปแบบเดิมเสมอ