Skip to Content
ReferenceError Codes

Error Codes

RustBill returns structured JSON errors with consistent error codes.

Error Response Format

{ "error": "error_code", "message": "Human-readable description" }

Validation errors include field-level details:

{ "error": "validation_error", "message": "Validation failed", "fields": { "email": "Invalid email format" } }

Authentication Errors

CodeHTTP StatusDescription
unauthorized401Missing or invalid session/API key
session_expired401Session has expired, re-login required
forbidden403Authenticated but insufficient permissions
invalid_credentials401Wrong email or password
invalid_api_key401API key not found or revoked
invalid_cron_secret401Wrong cron secret header

Validation Errors

CodeHTTP StatusDescription
validation_error400Request body failed validation (see fields)
invalid_uuid400Path parameter is not a valid UUID
missing_field400Required field not provided

Resource Errors

CodeHTTP StatusDescription
not_found404Resource does not exist
already_exists409Resource with unique constraint already exists
delete_conflict409Cannot delete — resource has dependencies

Billing Errors

CodeHTTP StatusDescription
subscription_not_active400Operation requires active subscription
plan_not_found404Pricing plan does not exist
invoice_already_paid400Cannot modify a paid invoice
invoice_voided400Cannot modify a voided invoice
insufficient_credit400Customer credit balance too low
coupon_expired400Coupon has expired
coupon_usage_exceeded400Coupon max usage limit reached
payment_failed400Payment processing failed
refund_exceeds_payment400Refund amount exceeds original payment

License Errors

CodeHTTP StatusDescription
license_not_found404License key does not exist
license_expired400License has expired
license_suspended400License is suspended
license_revoked400License has been revoked
activation_limit_reached400Maximum device activations exceeded

Provider Errors

CodeHTTP StatusDescription
provider_not_configured400Payment provider credentials not set
provider_error502External provider returned an error
webhook_signature_invalid400Webhook signature verification failed

Server Errors

CodeHTTP StatusDescription
internal_error500Unexpected server error
database_error500Database query failed
Last updated on