v51

latestOpenAPI 3.1.0raw.githubusercontent.com2026-08-01302395850.8 KB
v1
credits

Update subscription tier or start a Stripe Checkout session

post/api/credits/subscription

Request body

tier'NO_TIER' | 'BASIC' | 'PRO' | 'MAX' | 'BUSINESS' required
success_urlstring
cancel_urlstring
billing_cycle'monthly' | 'yearly'

Response

Successful Response

tier'NO_TIER' | 'BASIC' | 'PRO' | 'MAX' | 'BUSINESS' | 'ENTERPRISE' required
monthly_costinteger required
tier_costsobject required
tier_costs_yearlyobject

Tier → yearly amount in cents. Populated only for tiers with a yearly Stripe price configured in LaunchDarkly. Empty for monthly-only configurations.

billing_cycle'monthly' | 'yearly'

Billing cycle of the user's active Stripe subscription. Defaults to monthly for users without an active sub. monthly_cost above reflects this cycle's actual price (so a yearly subscriber sees their yearly amount, not the monthly equivalent).

tier_multipliersobject

Tier → rate-limit multiplier. Covers the same tiers listed in tier_costs so the frontend can render rate-limit badges relative to the lowest visible tier without knowing backend defaults.

proration_credit_centsinteger required
has_active_stripe_subscriptionboolean

True when the user has an active/trialing Stripe subscription. The frontend uses this to branch upgrade UX: modify-in-place + saved-card auto-charge when True, redirect to Stripe Checkout when False.

current_period_endinteger nullable

Unix timestamp of the active subscription's current_period_end. Used to show the date Stripe will issue the next invoice (with prorated upgrade charges, if any). None when no active sub.

pending_tier'NO_TIER' | 'BASIC' | 'PRO' | 'MAX' | 'BUSINESS' nullable
pending_tier_effective_atstring date-time nullable
pending_billing_cycle'monthly' | 'yearly' nullable

Billing cycle of the queued change, when resolvable. Set alongside pending_tier for tier downgrades and same-tier cycle switches (yearly→monthly). The frontend uses this to differentiate a cycle-only schedule (pending_tier == current tier) from a real tier downgrade so the UI copy can describe the actual change. None for cancellations and unconfigured legacy prices.

urlstring

Populated only when POST /credits/subscription starts a Stripe Checkout Session (BASIC → paid upgrade). Empty string in all other branches — the client redirects to this URL when non-empty.