Skip to content

Latest commit

 

History

History
56 lines (44 loc) · 3.35 KB

File metadata and controls

56 lines (44 loc) · 3.35 KB

Credence API Error Codes

This reference is generated from src/lib/errorCatalog.ts and is the source of truth for machine-readable API error codes.

Stability contract

  • Error-code strings are stable public API values. Consumers may safely branch on code (and the error_code alias where present).
  • New codes may be added in minor releases.
  • Existing codes must not be removed or renamed without adding a deprecation entry in ERROR_CODE_DEPRECATIONS.
  • HTTP statuses, categories, and default messages are catalog-managed so handlers do not invent uncatalogued responses.
  • Production responses use catalog default messages and omit details to avoid leaking PII, stack traces, or chained error internals.

Active codes

Code HTTP status Category Default message
invalid_input 400 Invalid input
unauthorized 401 authentication Authentication is required
forbidden 403 authorization The authenticated caller is not allowed to perform this action
insufficient_credits 402 business Monthly credit budget exhausted
idempotency_key_mismatch 409 business Idempotency key is already bound to a different actor or payload
insufficient_funds 422 business The account has insufficient funds for this operation
invalid_dispute_transition 422 business Invalid dispute state transition
rate_limit_exceeded 429 rate_limit Rate limit exceeded
not_found 404 resource The requested resource was not found
conflict 409 resource The request conflicts with the current resource state
internal_server_error 500 system An unexpected internal server error occurred
service_unavailable 503 system Service temporarily unavailable
batch_size_too_small 400 validation The batch size is below the allowed minimum
field_required 400 validation A required field is missing
invalid_address 400 validation The request contains an invalid address
invalid_format 400 validation The request contains a field with an invalid format
invalid_stellar_address 400 validation The request contains an invalid Stellar address
invalid_type 400 validation The request contains a field with an invalid type
unexpected_field 400 validation The request contains an unexpected field
unsafe_redirect_target 400 validation The requested redirect target is not permitted
validation_failed 400 validation Validation failed
value_too_large 400 validation The request contains a value above the allowed maximum
value_too_small 400 validation The request contains a value below the allowed minimum
batch_size_exceeded 413 validation The batch size exceeds the allowed maximum
request_too_large 413 validation The request body exceeds the maximum allowed size

Localization catalog

ERROR_LOCALIZATION_CATALOG currently ships default English (en) messages keyed by error code. Add locales in the catalog before returning localized production responses.

Locale Coverage Notes
en 29 messages Catalog default messages for active codes.

Deprecated codes

No error codes are currently deprecated.