API reference, Console billing
Cancel at the end of the paid month
DELETE/v1/console/subscriptionoperation id cancelSubscription
Sets cancel_at_period_end. The plan and its weekly allowance stay until current_period_end; afterwards
requests are paid from the balance at the standard rate. Cancelling again answers 200 with the same state.
Without an active subscription: 409 no_subscription. When Stripe refuses (restricted key): 503 maintenance.
Authentication. Console session cookie (__Host-dex_session), or an app session token (Authorization: Bearer dex_ses_...). With the cookie, state-changing routes also need the x-dex-csrf header.
Parameters
x-dex-csrfheader ยท stringcsrf_token returned by createSession (or handed over in the completeGoogleSignIn redirect). Required
with the session cookie on every state-changing console route; not used with a bearer app session.32 to 64 characters
Responses
200The subscription, now ending at the period end.
Headers: x-request-id
objectstringrequiredalways "subscription"
planstring | nullrequiredone of "base", "hot", "fierce", null
statusstringrequirednone: never subscribed, or the last subscription ended and the account is back on pay as you go.
incomplete: Checkout started, the first payment is not settled yet (delayed payment methods).
active: paid up; the weekly allowance is available. past_due: a renewal payment failed, the
allowance stays available during the grace period. frozen: the grace period passed, requests are paid
from the balance until the subscription is paid or ends. canceled: ended; plan is null.one of "none", "incomplete", "active", "past_due", "frozen", "canceled"
cancel_at_period_endbooleanrequiredcurrent_period_end (cancelSubscription).scheduled_planstring | nullrequiredcurrent_period_end (updateSubscription to a cheaper plan); null otherwise.one of "base", "hot", "fierce", null
current_period_startstring | nullrequiredformat date-time
current_period_endstring | nullrequiredformat date-time
week_started_atstring | nullrequiredformat date-time
week_resets_atstring | nullrequiredformat date-time
week_allowance_tokensintegerrequiredformat int64at least 0
week_used_tokensintegerrequiredformat int64at least 0
reset_price_centsinteger | nullrequiredresets_bought_this_weekintegerrequiredat least 0
billing_portalbooleanrequiredcreateBillingPortalSession works (the Stripe Customer Portal is configured for Dex and the account has a Stripe customer).currencystring | nullrequiredbilling_currency); null without a plan or before it is known. reset_price_cents stays in euro cents:
the reset in this currency is Plan.prices[currency].reset_price_cents. New currencies may appear within v1.one of "EUR", "USD", "GBP", "INR", null
401Missing, unknown, revoked or expired credentials.
Headers: x-request-id, x-client-request-id
Error envelope. See Errors for every type and code.
403The credentials are valid but not allowed to do this (missing scope, suspended account or failed CSRF check).
Headers: x-request-id, x-client-request-id
Error envelope. See Errors for every type and code.
409The idempotency key was used with a different body, or the first request with this key is still running.
Console billing routes also answer 409 for a state conflict: subscription_exists (createSubscriptionCheckout
while a subscription is live, joinWaitingList for a plan the account holds), no_subscription
(updateSubscription, cancelSubscription, createResetCheckout or createBillingPortalSession without one),
plan_sold_out (createSubscriptionCheckout or updateSubscription to a plan with no founding-round seat left;
with hints), key_revoked (updateKey on a revoked key).
Headers: x-request-id, x-client-request-id, retry-after
Error envelope. See Errors for every type and code.
500An unexpected error. Any charge was refunded. Retry with the same idempotency key.
Headers: x-request-id, x-client-request-id
Error envelope. See Errors for every type and code.
503maintenance: the console's database, sign-in or payments are unavailable for a moment (for
createGoogleSession also: Google sign-in is not configured, or Google's signing keys cannot be fetched).
Retry after retry-after. Nothing was changed.
Headers: x-request-id, retry-after
Error envelope. See Errors for every type and code.