Skip to main content
Anona holds the Stripe relationship, so you never touch Stripe keys directly. Paid-plan changes go through Stripe Checkout or the Customer Portal; free-plan changes happen in place.

View billing status

GET /v1/billing returns the current plan, credit usage, and every plan you could switch to. credits_reset_at is when the credit allowance refreshes: on a paid plan, the end of the Stripe billing period, so it falls on the day of the month you subscribed; on Free, the signup anniversary. It is not the 1st of the calendar month. A date landing in a month too short for it (the 31st, in February) moves to the last day of that month.
current_month_ops and the line_items counts are still measured over the calendar month to date, which is a different window from the credit period whenever your billing date is not the 1st. credits_used is the figure that matches credits_reset_at.
line_items is credit-cost accounting, not a Stripe invoice. The amount you are actually billed comes from Stripe.

Change plan

Free tiers

Valid only for plans priced at zero. Any paid plan returns 400 payment_required and directs you to /v1/billing/checkout instead.
Redirect the user to checkout_url. Stripe’s webhook flips the organization onto the new plan and syncs its quota once payment completes, so polling /v1/billing right after the redirect may still show the old plan for a few seconds.

Manage an existing subscription

POST /v1/billing/portal requires an existing Stripe customer, meaning you have completed checkout at least once.
Redirect the user there to update a payment method, view invoices, switch between paid plans, or cancel. Plan switches are prorated by Stripe, which is why they belong in the portal rather than in a second checkout. An upgrade applies immediately, and the organization’s unused credits are added on top of the new plan’s allowance for the current period. A downgrade is scheduled for the end of the period already paid for, exactly like a cancellation: the organization keeps the larger plan and its limits until then, and GET /v1/billing keeps reporting the larger plan until the change lands.

Cancel

Cancellation takes effect at the end of the current billing period, the same date as credits_reset_at. The organization keeps its paid plan and credits until then.

Error responses

See the full error reference.