Valqio Docs
Guides

Handling denials

Turn Valqio deny decisions into clear product responses without running billable work.

A deny decision is a product response, not an exception. Your app should stop before billable work starts and return a clear next step.

Basic pattern

if (!decision.allowed) {
  return {
    status: 402,
    body: {
      reasonCode: decision.reasonCode,
      requestId,
    },
  }
}

Keep the customer-facing message in your app. Keep the Valqio reason code in logs and support context.

Suggested responses

Reason codeProduct response
HARD_CAPExplain the usage limit and link to plan management.
INSUFFICIENT_CREDITSAsk the customer to top up or wait for renewal.
RATE_LIMITEDAsk the customer to retry later.
ENTITLEMENT_MISSINGExplain that the feature is not included.
METER_NOT_FOUNDReturn a generic unavailable message and alert engineering.
INVALID_REQUESTReturn a generic unavailable message and inspect integration logs.

Keep evidence

Log:

  • request ID
  • subject type and key
  • meter or product action
  • reason code
  • idempotency key

That gives support and engineering a shared handle for Decisions → History.

On this page