Authorize
Scope
This page defines authorize-time admission behavior and lease issuance rules. For a read-only decision before beginning work, see Preflight.
Inputs and prerequisites
- Realm and billing account context must be present.
Idempotency-Keyis required.- Caller identity subject is required.
feature_codemust be a valid identifier.estimated_quantity_minoris optional and must be non-negative when provided.leaseis optional. It must be a unique, non-empty opaque reference within the current billing account and user when provided.budgetis optional and names a caller-owned Budget reference, not the internalbudget_id.
Decision sequence
- Resolve feature and feature family.
- Enforce entitlement for the feature/family.
- Resolve active policy windows for the current bundle.
- Evaluate quota/rate admission.
- Evaluate budget/funding feasibility in prepaid mode.
- Issue or reuse the requested lease lifecycle and return
lease+ window bounds.
Lease issuance rules
- A lease is issued only if feature is active, entitlement allows access, and at least one quota window exists for the feature.
leaseis optional on the request. When supplied, Vluna preserves it exactly; when omitted, Vluna generates an opaque reference.- Reauthorizing the same active
leasewith the same immutable binding returns the original authorization without repeating rate/admission side effects. - Reusing an active lease with another binding returns
GATE.LEASE_CONFLICT; terminal references returnGATE.LEASE_FINALIZEDand cannot be reused. - Unknown features may be auto-registered when auto-registry is enabled; otherwise authorize rejects unknown features.
- Lease metadata carries:
- feature and feature family
- quota/rate window metadata
- optional labels
- hint snapshot for replay consistency
- Lease TTL follows the deployment policy for gate session duration.
Idempotency behavior
- Reusing the same key with the same request hash returns the existing lease response.
- Reusing the same key with a different request hash returns conflict (
409).
Budget and funding semantics
- If the caller provides
budget, authorize resolves that opaque external reference and evaluates the current Budget headroom snapshot. - In prepaid mode, billable admission requires both the authoritative wallet balance and any selected Budget headroom to cover one
quantity_minorat the feature's current effective primary activity-meter rate. - The minimum admission funding is
ceil(unit_price_xusd / unit_quantity_minor). It is independent ofestimated_quantity_minor. - Estimated funding shortfalls remain advisory and never change admission.
- A zero-priced primary meter is not balance-limited. Missing pricing remains an accepted outcome with a pricing configuration hint.
- Funding and budget hints are muted in non-prepaid billing modes.
Advisory meter coverage
GET /limits/meters?expand[]=coverage can estimate how much usage the current
funding or Budget snapshot covers. This is advisory preflight information; it
does not reserve value and must not replace authorize or commit.
balance_limited=falsemeans the resolved price is zero, so XUSD balance is not the limiting factor. Both quantity estimates arenull.max_quantity_minor_estimatedis the conservative integer estimate.optimistic_quantity_minorincludes the amount that may become payable when the exact-rational remainder is carried forward. It can benullunless the optimistic profile was requested.basis=budgetrequires a Budget selection; the response still exposes the resolved internalbudget_idfor operations and diagnostics.
Hint semantics at authorize
Common hint families:
quota.remainingrate.limitfunding.xusd_shortfallbudget.shortfallpricing.not_configuredpricing.meter_price_missingpricing.contract_term_invalid
Recommended handling for these hints is documented in Hints and failure semantics.
Failure semantics
400: missing required transport input (for example idempotency key).401: missing auth context.402: blocked by quota/budget/funding policy.403: entitlement denied/required.409: idempotency conflict.422: invalid input or missing feature policy configuration.429: rate limit rejection.
For an entitlement 403, inspect the envelope code and meta. The server
returns the rejected resource_type, feature_code, and
feature_family_code, so logs can identify the exact denied resource without
reconstructing it from request text.
Verify checklist
- Same idempotency key + same payload returns the same lease.
- Changing payload under same idempotency key returns
409. - Denied entitlement never returns an active lease.
- Quota/rate/funding hints match expected account state.