Dla programistów

Kody błędów API SpeakNotes

Każdy błąd zwraca ten sam format JSON: stały kod, czytelny dla człowieka komunikat, link do tej strony oraz pola, w których wystąpił błąd (jeśli dotyczy).

Struktura

Błędy nigdy nie są zwracane w formacie HTML. Kod błędu jest stały i można na nim polegać w logice aplikacji; komunikat może ulec zmianie w dowolnym momencie.

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"
  }
}

Kody

  • invalid_request400

    The request was malformed or failed validation.

  • invalid_token401

    The credential is missing, malformed, expired, or revoked.

  • insufficient_scope403

    The credential is valid but lacks the scope this operation needs.

  • not_found404

    The requested resource does not exist.

  • method_not_allowed405

    That HTTP method is not supported on this path.

  • conflict409

    The request conflicts with the current state of the resource.

  • payload_too_large413

    The uploaded file exceeds the size limit.

  • unsupported_media_type415

    The file format is not supported.

  • insufficient_credits402

    The account has no credits left for this operation.

  • rate_limited429

    Too many requests. Retry after the interval in the Retry-After header.

  • upstream_failure502

    A provider SpeakNotes depends on failed.

  • content_policy422

    The content was refused by the AI content policy.

  • internal_error500

    SpeakNotes failed to process the request.

Co ponawiać

Ponawiaj żądania typu rate_limited po czasie określonym w nagłówku Retry-After, a błędy typu upstream_failure raz lub dwa razy z użyciem mechanizmu backoff. Nigdy nie ponawiaj błędów invalid_request, insufficient_scope ani content_policy bez zmian: za każdym razem zakończą się tak samo.

Identyfikatory żądań

Każda odpowiedź zawiera nagłówek X-Request-Id, który jest powtarzany w treści błędów. Podaj go w zgłoszeniu do wsparcia, aby umożliwić dokładną analizę awarii.